-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.xml
310 lines (288 loc) · 11 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<?xml version='1.0' encoding='utf-8'?>
<project name="FreeDots" default="build.jar" basedir=".">
<description>MusicXML to braille music transcription</description>
<!-- set global properties for this build -->
<property file="build.properties" />
<property name="src" location="src"/>
<property name="test" location="test"/>
<property name="build" location="build"/>
<property name="javadocs" location="doc/api"/>
<property name="dist" location="dist"/>
<property name="freedots.jar.main.class" value="freedots.Main"/>
<property name="freedots.version" value="0.6" />
<property name="freedots.minimum.javaversion" value="1.6" />
<tstamp/>
<path id="class.path">
</path>
<path id="class.path.test">
<pathelement location="${lib.junit.jar}" />
<pathelement location="${test}" />
<pathelement location="${build}"/>
<path refid="class.path" />
</path>
<presetdef name="validate-musicxml">
<schemavalidate noNamespaceFile="xsd/musicxml.xsd"
failonerror="true" warn="true">
<dtd publicId="-//Recordare//DTD MusicXML 0.6b Partwise//EN"
location="dtd/musicxml/1.0/partwise.dtd"/>
<dtd publicId="-//Recordare//DTD MusicXML 1.0 Partwise//EN"
location="dtd/musicxml/1.0/partwise.dtd"/>
<dtd publicId="-//Recordare//DTD MusicXML 1.1 Partwise//EN"
location="dtd/musicxml/1.1/partwise.dtd"/>
<dtd publicId="-//Recordare//DTD MusicXML 2.0 Partwise//EN"
location="dtd/musicxml/2.0/partwise.dtd"/>
<dtd publicId="-//Recordare//DTD MusicXML 2.0 Opus//EN"
location="dtd/musicxml/2.0/opus.dtd"/>
<schema namespace="http://www.w3.org/XML/1998/namespace"
file="xsd/xml.xsd" />
<schema namespace="http://www.w3.org/1999/xlink"
file="xsd/xlink.xsd" />
</schemavalidate>
</presetdef>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<echo>java.version: ${java.version}</echo>
<condition property="freedots.java.version.p">
<or>
<matches string="${java.version}" pattern="1\.6"/>
</or>
</condition>
</target>
<target name="freedots.java.warning"
depends="init" unless="freedots.java.version.p">
<echo>WARNING: Use of Java version ${java.version} not recommended.</echo>
</target>
<target name="compile" depends="init,freedots.java.warning"
description="compile the source">
<!-- Compile the java code from ${src} into ${build} -->
<mkdir dir="${build}"/>
<javac srcdir="${src}"
destdir="${build}" debug="true"
source="${freedots.minimum.javaversion}"
target="${freedots.minimum.javaversion}"
excludes="freedots/web/"
includeantruntime="false">
<classpath refid="class.path"/>
</javac>
<propertyfile file="${build}/compilation.properties">
<entry key="freedots.compile.version" value="${freedots.version}"/>
<entry key="freedots.compile.timestamp" type="date" value="now" pattern="E MMMM dd yyyy, HH:mm z"/>
</propertyfile>
<!-- Copy resources into build directory -->
<copy todir="${build}/freedots/musicxml">
<fileset dir="dtd/musicxml">
<include name="**/*.dtd"/>
<include name="**/*.mod"/>
<include name="**/*.ent"/>
</fileset>
</copy>
<copy file="${font.dejavuserif.ttf}"
tofile="${build}/freedots/gui/swing/DejaVuSerif.ttf"/>
<copy todir="${build}/freedots/gui/swing">
<fileset dir="icons">
<include name="*.xml"/>
</fileset>
</copy>
<copy todir="${build}/freedots/musicxml/">
<fileset dir="scores">
<include name="bwv*.xml"/>
<include name="lvb-*.xml"/>
<include name="autumn_leaves.xml"/>
<include name="blue_and_sentimental.xml"/>
</fileset>
</copy>
<copy todir="${build}">
<fileset dir="${src}">
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<!-- Testing framework -->
<target name="compile.test" depends="compile">
<javac srcdir="${test}" verbose="false" debug="true" encoding="utf8">
<classpath refid="class.path.test"/>
</javac>
</target>
<target name="clean.compile.test">
<delete> <fileset dir="${test}" includes="**/*.class" /> </delete>
</target>
<target name="test" depends="compile.test"
description="run the test suite">
<junit fork="yes" forkmode="once" failureProperty="test.failure">
<classpath refid="class.path.test" />
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test}" includes="**/Test*.class" />
</batchtest>
</junit>
<fail message="test failed" if="test.failure" />
</target>
<!-- Validate XML content -->
<target name="validate.scores">
<validate-musicxml>
<fileset dir="scores" includes="**/*.xml"/>
<fileset dir="${test}" includes="*.xml"/>
</validate-musicxml>
</target>
<target name="build.jar" depends="test, validate.scores"
description="generate the jar">
<mkdir dir="${dist}"/>
<jar jarfile="${dist}/FreeDots-${DSTAMP}.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="${freedots.jar.main.class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="build.jar">
<java jar="${dist}/FreeDots-${DSTAMP}.jar" fork="true" />
</target>
<target name="build.manual" depends="build.jar"
description="build the user manual">
<presetdef name="freedots">
<java jar="dist/FreeDots-${DSTAMP}.jar" fork="true"
failonerror="true" logError="true">
</java>
</presetdef>
<!-- Build examples -->
<freedots output="doc/example1-2.brl">
<arg value="-nw"/><arg value="-emf"/><arg value="doc/example1-2.mid"/>
<arg value="input/nimobmn-examples/example1-2.xml"/>
</freedots>
<freedots output="doc/example1-11.brl">
<arg value="-nw"/><arg value="-emf"/><arg value="doc/example1-11.mid"/>
<arg value="input/nimobmn-examples/example1-11.xml"/>
</freedots>
<exec executable="xsltproc" logError="true" failonerror="true" output="doc/manual.html">
<arg value="--xinclude"/>
<arg value="${style.docbook.xhtml}"/> <arg value="doc/manual.xml"/>
</exec>
<exec executable="lynx" logError="true" output="doc/manual.txt">
<arg value="--nonumbers"/><arg value="--dump"/>
<arg value="doc/manual.html"/>
</exec>
<exec executable="xsltproc" logError="true">
<arg value="--xinclude"/>
<arg value="--stringparam"/>
<arg value="man.output.base.dir"/> <arg value="'doc/'"/>
<arg value="${style.docbook.manpage}"/>
<arg value="doc/manual.xml"/>
</exec>
</target>
<target name="checkstyle"
description="check the coding style">
<taskdef name="checkstyle"
classname="com.puppycrawl.tools.checkstyle.CheckStyleTask"
classpath="lib/checkstyle-all-5.0.jar"/>
<checkstyle config="checkstyle.xml">
<fileset dir="${src}" includes="**/*.java"/>
</checkstyle>
</target>
<target name="build.installer" depends="build.jar, build.manual"
description="generate the MS Windows installer">
<taskdef name="nsis" classname="net.sf.nsisant.Task">
<classpath location="lib/nsisant-1.2.jar"/>
</taskdef>
<nsis script="WindowsInstaller.nsi" verbosity="2">
<define name="JARFILE" value="FreeDots-${DSTAMP}.jar"/>
<define name="OUTFILE" value="dist/FreeDots-${DSTAMP}.exe"/>
<define name="VERSION" value="${freedots.version}"/>
</nsis>
</target>
<target name="clean" depends="clean.compile.test"
description="clean up">
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${javadocs}"/>
<delete file="doc/manual.txt"/>
<delete file="doc/manual.html"/>
<delete file="doc/man1/freedots.1"/>
<delete>
<fileset dir="doc" includes="example*.*"/>
</delete>
</target>
<target name="javadoc"
description="build program documentation using javadoc">
<mkdir dir="${javadocs}"/>
<javadoc packagenames="freedots.*"
sourcepath="${src}"
destdir="${javadocs}"
Overview="${src}/overview.html"
author="true"
version="false"
use="true"
noindex="true"
windowtitle="FreeDots"
doctitle="freedots"
package="true">
<classpath refid="class.path"/>
<link href="http://java.sun.com/javase/6/docs/api/"/>
</javadoc>
</target>
<!-- Google AppEngine -->
<property name="gae.sdk.dir" location="../appengine-java-sdk-1.3.5" />
<available file="${gae.sdk.dir}" type="dir" property="gae.sdk.present"/>
<import file="${gae.sdk.dir}/config/user/ant-macros.xml" optional="true"/>
<path id="gae.classpath">
<pathelement path="war/WEB-INF/classes" />
<fileset dir="war/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="${gae.sdk.dir}/lib">
<include name="shared/**/*.jar" />
</fileset>
</path>
<target name="build.gae" depends="test" if="gae.sdk.present">
<copy todir="war/WEB-INF/lib" flatten="true">
<fileset dir="${gae.sdk.dir}/lib/user">
<include name="**/*.jar" />
</fileset>
<fileset dir="/usr/share/java">
<include name="commons-fileupload.jar" />
</fileset>
</copy>
<mkdir dir="war/WEB-INF/classes" />
<javac srcdir="${src}"
destdir="war/WEB-INF/classes" debug="true"
source="${freedots.minimum.javaversion}"
target="${freedots.minimum.javaversion}"
excludes="freedots/gui/ freedots/Main.* freedots/musicxml/MIDISequence.* freedots/playback/"
includeantruntime="false">
<classpath refid="gae.classpath"/>
</javac>
<propertyfile file="war/WEB-INF/classes/compilation.properties">
<entry key="freedots.compile.version" value="${freedots.version}"/>
<entry key="freedots.compile.timestamp" type="date" value="now" pattern="E MMMM dd yyyy, HH:mm z"/>
</propertyfile>
<!-- Copy resources into build directory -->
<copy todir="war/WEB-INF/classes/freedots/musicxml">
<fileset dir="dtd/musicxml/2.0">
<include name="*.dtd"/>
<include name="*.mod"/>
<include name="*.ent"/>
</fileset>
</copy>
</target>
<target name="gae.run" depends="build.gae">
<dev_appserver war="war" />
</target>
<target name="gae.request_logs"
description="Downloads log data from App Engine for the application.">
<appcfg action="request_logs" war="war">
<options>
<arg value="--num_days=5"/>
</options>
<args>
<arg value="logs.txt"/>
</args>
</appcfg>
</target>
<target name="gae.update" depends="build.gae"
description="Uploads the application to App Engine.">
<appcfg action="update" war="war" />
</target>
<target name="rollback" depends="build.gae"
description="Rolls back an interrupted application update.">
<appcfg action="rollback" war="war" />
</target>
</project>