File: build.xml

package info (click to toggle)
brailleutils 1.2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,084 kB
  • sloc: java: 13,138; xml: 659; makefile: 29; sh: 1
file content (426 lines) | stat: -rw-r--r-- 16,908 bytes parent folder | download | duplicates (4)
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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<?xml version="1.0" encoding="utf-8"?>
<project default="buildAndTest">
	<description>Buildfile for this project</description>
	
	<!-- Timestamp format definition -->
	<tstamp>
		<format property="ISO-TODAY" pattern="yyyy-MM-dd"/>
	</tstamp>
	
	<!-- ================================================================== -->
	<!-- Common properties                                                  -->
	<!-- ================================================================== -->

	<property name="release-name" value="Braille Utils"/>
	<property name="release-version" value="snapshot"/>
	<property name="repository-revision" value="N/A"/> 
	
	<property name="ant-build.dir" value="${basedir}/ant-build"/>
	<property name="ant-output.dir" value="${ant-build.dir}/output"/>
	<property name="dist.dir" value="${ant-output.dir}/dist"/>
	<property name="lib.dir" value="${basedir}/lib"/>
	
	<property name="src.dir" value="${basedir}/src"/>
	<property name="test-src.dir" value="${basedir}/tests"/>
	<property name="catalog-src.dir" value="${basedir}/catalog"/>
	
	<property name="build.dir" value="${ant-output.dir}/build.temp"/>
	<property name="test-build.dir" value="${ant-output.dir}/test-build.temp"/>
	<property name="catalog-build.dir" value="${ant-output.dir}/catalog-build.temp"/>
	
	<property name="test.report.dir" value="${ant-output.dir}/test-report"/>
	<property name="test.report-temp.dir" value="${ant-output.dir}/test-report.temp"/>
	<property name="javadoc.dir" value="${ant-output.dir}/docs/javadoc"/>
	<property name="javadoc-catalog.dir" value="${ant-output.dir}/docs/catalog-javadoc"/>

	<property name="javac.source" value="1.5"/>
	<property name="javac.target" value="1.5"/>
	<property name="useExternalJarsOnLinux" value="false"/>

	<!--
		Core jars for Braille Utils
	-->
	<property name="core-jar.name" value="brailleUtils-core.jar"/>
	<property name="catalog-jar.name" value="brailleUtils-catalog.jar"/>

	<property name="braille.jar" value="${dist.dir}/${core-jar.name}"/>
	<property name="catalog.jar" value="${dist.dir}/${catalog-jar.name}"/>
	
	<!--
		UI jar for Braille Utils
	 -->
	<property name="brailleUtils.jar" value="${dist.dir}/brailleUtils-ui.jar"/>

	<!--
		Standalone distribution for Braille Utils
	 -->	
	<property name="distribution.zip" value="${dist.dir}/brailleUtils-${release-version}.zip"/>
	<property name="javadoc.zip" value="${dist.dir}/brailleUtils-${release-version}-javadoc.zip"/>

	<patternset id="braille-jar.patternset">
		<include name="org/daisy/braille/**/*.*"/>
		<include name="org/daisy/cli/**/*.*"/>
		<include name="org/daisy/factory/**/*.*"/>
		<include name="org/daisy/paper/**/*.*"/>
		<include name="org/daisy/printing/**/*.*"/>
		<include name="org/daisy/validator/**/*.*"/>
		<include name="META-INF/**/*.*"/>
		<exclude name="org/daisy/braille/ui/**/*.*"/>
	</patternset>

	<patternset id="braille-ui-jar.patternset">
		<include name="org/daisy/braille/ui/**/*.*"/>
	</patternset>

	<patternset id="catalog-jar.patternset">
		<include name="**/*.*"/>
		<exclude name="**/doc-files/**/*.*"/>
	</patternset>

	<!-- ================================================================== -->
	<!-- Private targets                                                    -->
	<!-- ================================================================== -->

        <!-- - - - - - - - - - - - - - - - - -
          target: setClasspath
         - - - - - - - - - - - - - - - - - -->

        <target name="setClasspath" depends="detectOS, debianProperties">
            <!--
            <property name="file.reference.saxon"      value="lib/saxon8.jar"/>
            <property name="file.reference.stax-api"   value="lib/stax-api-1.0.1.jar"/>
            <property name="file.reference.wstx"       value="lib/wstx-lgpl-3.2.8.jar"/>
            <property name="file.reference.jing"       value="lib/jing.jar"/>
            <property name="file.reference.xercesImpl" value="lib/xercesImpl.jar"/>
            <property name="file.reference.xml-apis"   value="lib/xml-apis.jar"/>
            <property name="file.reference.isorelax"   value="lib/isorelax.jar"/>
			<property name="file.reference.junit"      value="lib/junit-4.7.jar"/>
            -->
            <path id="core.classpath">
                <pathelement location="${file.reference.saxon}"/>
                <pathelement location="${file.reference.stax-api}"/>
                <pathelement location="${file.reference.wstx}"/>
                <pathelement location="${file.reference.jing}"/>
                <pathelement location="${file.reference.xercesImpl}"/>
                <pathelement location="${file.reference.xml-apis}"/>
                <pathelement location="${file.reference.isorelax}"/>
            </path>
			
			<path id="catalog.classpath">
				<path refid="core.classpath"/>
				<fileset dir="${dist.dir}">
                    <include name="${core-jar.name}"/>
                </fileset>
            </path>
			
			<path id="test.classpath">
			    <path refid="core.classpath"/>
				<pathelement location="${file.reference.junit}"/>
                <fileset dir="${dist.dir}">
                    <include name="${core-jar.name}"/>
                    <include name="${catalog-jar.name}"/>
                </fileset>
			</path>

            <path id="test.run.classpath">
                <path refid="test.classpath"/>
				<pathelement location="${file.reference.junit}"/>
                <fileset dir="${ant-output.dir}">
                    <include name="test.jar"/>
                </fileset>
            </path>

            <path id="javadoc.classpath">
                <path refid="core.classpath"/>
            </path>

            <path id="catalog-javadoc.classpath">
                <path refid="core.classpath"/>
                <fileset dir="${dist.dir}">
                    <include name="**/*.jar"/>
                </fileset>
            </path>

            <pathconvert refid="core.classpath" property="core.classpath.attribute" pathsep=" " dirsep="/">
                <flattenmapper/>
            </pathconvert>
            
            <property name="ui.classpath.attribute" value="lib/${core-jar.name} lib/${catalog-jar.name}"/>

        </target>

        <!-- - - - - - - - - - - - - - - - - -
          target: detectOS
         - - - - - - - - - - - - - - - - - -->

        <target name="detectOS">
            <condition property="is.windows">
                <os family="windows"/>
            </condition>
            <condition property="is.macosx">
               <and>
                   <os family="mac"/>
                   <os family="unix"/>
               </and>
            </condition>
            <condition property="is.linux">
            	<and>
            		<istrue value="${useExternalJarsOnLinux}"/>
                    <and>
                        <os family="unix"/>
                    	<not><os family="mac"/></not>
                    </and>
            	</and>
            </condition>
        </target>

        <!-- - - - - - - - - - - - - - - - - -
          target: debianProperties
         - - - - - - - - - - - - - - - - - -->

        <target name="debianProperties" if="is.linux" depends="detectOS">
            <property file="build.debian.properties"/>
        </target>
	
	<!-- - - - - - - - - - - - - - - - - - 
          target: createCatalogJavadocDir                      
         - - - - - - - - - - - - - - - - - -->
    <target name="createCatalogJavadocDir">
    	<mkdir dir="${javadoc-catalog.dir}"/>
    </target>
	
	
	<!-- - - - - - - - - - - - - - - - - - 
          target: createDistDir                      
         - - - - - - - - - - - - - - - - - -->
    <target name="createDistDir">
		<mkdir dir="${dist.dir}"/>
    </target>

	<!-- - - - - - - - - - - - - - - - - - 
          target: buildCoreJar                      
         - - - - - - - - - - - - - - - - - -->
    <target name="buildCoreJar" depends="setClasspath, createDistDir">
    	<!-- Empty build dir -->
    	<delete dir="${build.dir}"/>
    	<mkdir dir="${build.dir}"/>

    	<!-- Compile core files -->
        <javac srcdir="${src.dir}" destdir="${build.dir}" includeantruntime="false" debug="true" encoding="UTF-8" source="${javac.source}" target="${javac.target}" compiler="javac1.5">
			<classpath>
				<path refid="core.classpath"/>
			</classpath>
        </javac>

    	<!-- Build Core Jar -->
    	<jar destfile="${braille.jar}">
    		<fileset dir="${build.dir}">
    			<patternset refid="braille-jar.patternset"/>
    		</fileset>
    		<fileset dir="${src.dir}">
    			<patternset refid="braille-jar.patternset"/>  			
    		</fileset>
    		<manifest>
    			<attribute name="Built-By" value="${user.name}"/>
    			<attribute name="Built-On" value="${ISO-TODAY}"/>
    			<attribute name="Repository-Revision" value="${repository-revision}"/>
    			<attribute name="Implementation-Title" value="${release-name} Core"/>
    			<attribute name="Implementation-Version" value="${release-version}"/>
    			<attribute name="Implementation-URL" value="http://code.google.com/p/brailleutils/"/>
    			<attribute name="Class-Path" value="${core.classpath.attribute}"/>
    		</manifest>
    	</jar>
    	
    	<!-- Build UI jar -->
    	<jar destfile="${brailleUtils.jar}" >
    		<fileset dir="${build.dir}">
    			<patternset refid="braille-ui-jar.patternset"/>
    		</fileset>
    		<fileset dir="${src.dir}">
    			<patternset refid="braille-ui-jar.patternset"/>
    		</fileset>
    		<manifest>
    			<attribute name="Main-Class" value="org.daisy.braille.ui.BasicUI"/>
    			<attribute name="Built-By" value="${user.name}"/>
    			<attribute name="Built-On" value="${ISO-TODAY}"/>
    			<attribute name="Repository-Revision" value="${repository-revision}"/>
    			<attribute name="Implementation-Title" value="${release-name} UI"/>
    			<attribute name="Implementation-Version" value="${release-version}"/>
    			<attribute name="Implementation-URL" value="http://code.google.com/p/brailleutils/"/>
    			<attribute name="Class-Path" value="${ui.classpath.attribute}"/>
    		</manifest>
    	</jar>
    	
    	<!-- Remove build files -->
    	<delete dir="${build.dir}"/>
    </target>
	
	<!-- - - - - - - - - - - - - - - - - - 
          target: buildCatalogJar                      
         - - - - - - - - - - - - - - - - - -->
    <target name="buildCatalogJar" depends="buildCoreJar, createDistDir">
    	<!-- Empty catalog build dir -->
    	<delete dir="${catalog-build.dir}"/>
    	<mkdir dir="${catalog-build.dir}"/>
    		
    	<!-- Compile catalog files -->
        <javac srcdir="${catalog-src.dir}" destdir="${catalog-build.dir}" includeantruntime="false" debug="true" encoding="UTF-8" source="${javac.source}" target="${javac.target}" compiler="javac1.5">
			<classpath>
				<path refid="catalog.classpath"/>
			</classpath>
        </javac>

    	<jar destfile="${catalog.jar}">
    		<fileset dir="${catalog-build.dir}">
    			<patternset refid="catalog-jar.patternset"/>
    		</fileset>
    		<fileset dir="${catalog-src.dir}">
    			<patternset refid="catalog-jar.patternset"/>  			
    		</fileset>
    		<manifest>
    			<attribute name="Built-By" value="${user.name}"/>
    			<attribute name="Built-On" value="${ISO-TODAY}"/>
    			<attribute name="Repository-Revision" value="${repository-revision}"/>
    			<attribute name="Implementation-Title" value="${release-name} Catalog"/>
    			<attribute name="Implementation-Version" value="${release-version}"/>
    			<attribute name="Implementation-URL" value="http://code.google.com/p/brailleutils/"/>
    		</manifest>
    	</jar>
    	
    	<!-- Remove build files -->
    	<delete dir="${catalog-build.dir}"/>
    </target>
	
	<!-- ================================= 
          target: buildJavadoc                      
         ================================= -->
    <target name="buildJavadoc" depends="setClasspath" description="Build javadoc">
    	<!-- Empty javadoc dir -->
    	<delete dir="${javadoc.dir}"/>
    	<mkdir dir="${javadoc.dir}"/>
    	
    	<javadoc destdir="${javadoc.dir}"
    			windowtitle="Braille Utils"
    			encoding="UTF-8"
    			charset="UTF-8"
    			classpathref="javadoc.classpath"
    			sourcepath="${src.dir}"
    		>
    		<link offline="true" href="http://java.sun.com/javase/6/docs/api/" packagelistLoc="ant-build/resources/javase-6"/>
    	</javadoc>
    </target>
	
	<!-- ================================= 
          target: buildCatalogJavadoc                      
         ================================= -->
    <target name="buildCatalogJavadoc" depends="createCatalogJavadocDir, buildCoreJar" description="Build catalog javadoc">
    	<javadoc destdir="${javadoc-catalog.dir}"
    			windowtitle="Catalog"
    			encoding="UTF-8"
    			charset="UTF-8"
    			classpathref="catalog-javadoc.classpath"
    			sourcepath="${catalog-src.dir}"
    		>
    		<link offline="true" href="http://java.sun.com/javase/6/docs/api/" packagelistLoc="ant-build/resources/javase-6"/>
    		<fileset dir="${src.dir}">
    			<include name="**/*.java"/>
    		</fileset>
    		<fileset dir="${catalog-src.dir}">
    			<include name="**/*.java"/>
    		</fileset>
    	</javadoc>
    	<delete dir="${build.dir}"/>
    </target>
	

	<!-- ================================= 
          target: buildJavadocZip 
         ================================= -->
    <target name="buildJavadocZip" depends="buildJavadoc, createDistDir" description="Build zip javadoc">
    	<zip destfile="${javadoc.zip}">
    		<zipfileset dir="${javadoc.dir}" prefix="brailleUtils/docs/api">
    			<include name="**/*.*"/>
    		</zipfileset>
    	</zip>
    </target>
	
	<!-- ================================= 
          target: buildZip 
         ================================= -->
    <target name="buildZip" description="Build zip distribution" depends="detectOS">
    	<!-- Empty dist dir -->
    	<delete dir="${dist.dir}"/>

    	<antcall target="buildCatalogJar"/>

    	<zip destfile="${distribution.zip}">
    		<zipfileset file="${brailleUtils.jar}" prefix="brailleUtils/"/>
    		<zipfileset file="${catalog.jar}" prefix="brailleUtils/lib"/>
    		<zipfileset file="${braille.jar}" prefix="brailleUtils/lib"/>
    		<zipfileset dir="${lib.dir}" prefix="brailleUtils/lib">
    			<include name="*.jar" unless="is.linux"/>
    			<exclude name="junit*.*"/>
    		</zipfileset>
    		<zipfileset dir="${basedir}/licenses" prefix="brailleUtils/licenses/">
    			<include name="**/*.*"/>
    		</zipfileset>
    	</zip>
    </target>

	<!-- ================================= 
          target: buildAndTest             
         ================================= -->
    <target name="buildAndTest" depends="buildZip, buildJavadoc" description="Build jars, javadoc and run unit tests">
    	
    	<!-- Empty reports dir -->
    	<delete dir="${test.report.dir}"/>
    	<mkdir dir="${test.report.dir}"/>
    	
		<!-- Empty test build dir -->
    	<delete dir="${test-build.dir}"/>
    	<mkdir dir="${test-build.dir}"/>

    	<!-- Compile test files -->
	    <javac srcdir="${test-src.dir}" destdir="${test-build.dir}" includeantruntime="false" debug="true" encoding="UTF-8" source="${javac.source}" target="${javac.target}" compiler="javac1.5">
			<classpath>
				<path refid="test.classpath"/>
			</classpath>
	    </javac>

		<jar destfile="${ant-output.dir}/test.jar" >
    		<fileset dir="${test-build.dir}">
    			<patternset refid="catalog-jar.patternset"/>
    		</fileset>
			<fileset dir="${test-src.dir}">
				<patternset refid="catalog-jar.patternset"/>
			</fileset>
    	</jar>

		<mkdir dir="${test.report-temp.dir}"/>
		
		<junit fork="yes" printsummary="no" haltonfailure="no">
			<batchtest fork="yes" todir="${test.report-temp.dir}">
		      <fileset dir="${test-build.dir}">
		        <include name="**/*Test.class" />
		      	<include name="**/TestUnit.class" />
		      	<exclude name="**/Test.class" />
		      </fileset>
		    </batchtest>
		    <formatter type="xml" />
		    <classpath refid="test.run.classpath" />
		</junit>

		<junitreport todir="${test.report.dir}">
			<fileset dir="${test.report-temp.dir}">
				<include name="TEST-*.xml" />
			</fileset>
			<report todir="${test.report.dir}" />
		</junitreport>
		
		<delete dir="${test.report-temp.dir}"/>
		<delete dir="${test-build.dir}"/>
    	<delete dir="${catalog-build.dir}"/>
		<delete deleteonexit="true" file="${ant-output.dir}/test.jar"/>
    </target>

</project>