-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
444 lines (387 loc) · 16.5 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
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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
<project name="VStar" default="dist" basedir=".">
<description>
Ant build file for VStar.
</description>
<!-- Set global properties for this build -->
<property name="src" location="src" />
<property name="test" location="test" />
<property name="script" location="script" />
<property name="plugin" location="plugin" />
<property name="src_build" location="src/build" />
<property name="src_build_debug" location="src/build_debug" />
<property name="test_build" location="test/build" />
<property name="mutation_coverage_dir" location="mutation_coverage"/>
<property name="manifest_file" location="MANIFEST.MF" />
<property name="dist" location="dist" />
<property name="dist_debug" location="dist_debug" />
<property name="dist_mac" location="." />
<property name="dist_win32" location="." />
<property name="install_files" location="install-files" />
<property name="dmg_template" location="${install_files}/mac/vstar-template.dmg" />
<!--
<property name="launch4j_dir" location="/Applications/Development/launch4j" />
-->
<property name="vstar_volume" location="/Volumes/VStar" />
<property name="extlib" location="extlib" />
<property name="ui_resources" location="src/org/aavso/tools/vstar/ui/resources" />
<property name="test_report" location="test_report" />
<property name="doc" location="doc" />
<property name="javadoc" location="doc/vstar_docs" />
<property name="mac_identity" value="P433N2A49C" />
<!-- Classpaths -->
<path id="build.classpath">
<fileset dir="${extlib}" includes="*.jar"
excludes="junit*.jar,hamcrest*.jar,testng*.jar,quicktheories*.jar,pitest*.jar" />
</path>
<path id="test.classpath">
<fileset dir="${extlib}" includes="*.jar" />
<pathelement location="${dist}/vstar.jar" />
<pathelement path="${test_build}" />
</path>
<path id="pitest.classpath">
<fileset dir="${extlib}">
<include name="pitest*.jar" />
<include name="testng*.jar" />
</fileset>
</path>
<!-- Task definitions -->
<taskdef name="pitest"
classname="org.pitest.ant.PitestTask"
classpathref="pitest.classpath" />
<target name="init">
<!-- Create the time stamp -->
<tstamp>
<format property="BUILD_TIME" pattern="yyyy-MM-dd HH:mm"/>
</tstamp>
<!-- Create the build directory structure used by compile and test. -->
<mkdir dir="${src_build}" />
<mkdir dir="${src_build_debug}" />
<mkdir dir="${mutation_coverage_dir}" />
<mkdir dir="${dist}" />
<mkdir dir="${dist_debug}" />
<mkdir dir="${test_build}" />
<mkdir dir="${test_report}" />
<mkdir dir="${dist_mac}" />
<mkdir dir="${dist_win32}" />
</target>
<!-- Build targets -->
<target name="antlr4" depends="init" description="Generate Java source code from ANTLR VeLa grammar.">
<java jar="${extlib}/antlr-4.5.3-complete.jar" fork="true">
<arg value="${src}/org/aavso/tools/vstar/vela/VeLa.g4" />
<arg value="-o" />
<arg value="${src}/org/aavso/tools/vstar/vela" />
<arg value="-listener" />
<arg value="-visitor" />
<arg value="-package" />
<arg value="org.aavso.tools.vstar.vela" />
<arg value="-encoding" />
<arg value="UTF-8" />
</java>
</target>
<target name="compile_src" depends="init,antlr4" description="Compile the source">
<!-- Update git revision -->
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="rev-parse" />
<arg value="--short" />
<arg value="HEAD" />
</exec>
<condition property="git_revision" value="${git.revision}" else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater" />
</and>
</condition>
<copy file="${ui_resources}/RevisionAccessor.java.template" tofile="${ui_resources}/RevisionAccessor.java" overwrite="true" />
<replace file="${ui_resources}/RevisionAccessor.java" token="@revision@" value="${git_revision}" />
<replace file="${ui_resources}/RevisionAccessor.java" token="@build_time@" value="${BUILD_TIME}" />
<!-- Compile source -->
<javac compiler="modern" source="1.8" target="1.8" encoding="UTF-8"
srcdir="${src}" destdir="${src_build}" includeantruntime="false"
debug="on" debuglevel="lines,vars,source">
<classpath refid="build.classpath" />
</javac>
</target>
<target name="debug" depends="init,antlr4,manifest" description="Compile the source for debug">
<!-- Compile source. -->
<javac compiler="modern" source="1.8" target="1.8" srcdir="${src}" destdir="${src_build_debug}" debug="on" debuglevel="lines,vars,source">
<classpath refid="build.classpath" />
</javac>
<jar jarfile="${dist_debug}/vstar.jar" basedir="${src_build_debug}" manifest="${manifest_file}" excludes="**/external/plugin/*.class">
<fileset dir="${ui_resources}" />
</jar>
<delete file="${manifest_file}" />
</target>
<target name="manifest" description="Creates a manifest file for VStar">
<manifestclasspath property="jar.classpath" jarfile="${dist}/vstar.jar">
<classpath refid="build.classpath" />
</manifestclasspath>
<manifest file="${manifest_file}">
<attribute name="Application-Name" value="VStar" />
<attribute name="Manifest-Version" value="1.0" />
<attribute name="Created-By" value="${user.name}" />
<attribute name="Main-Class" value="org.aavso.tools.vstar.ui.VStar" />
<attribute name="Class-Path" value="${jar.classpath}" />
<attribute name="Permissions" value="all-permissions" />
<!--
<attribute name="Codebase" value="http://www.aavso.org/files/vstar/" />
-->
</manifest>
</target>
<target name="dist" depends="compile_src,manifest" description="Generate the distribution">
<jar jarfile="${dist}/vstar.jar" basedir="${src_build}" manifest="${manifest_file}" excludes="**/external/plugin/*.class">
<fileset dir="${ui_resources}" />
</jar>
<delete file="${manifest_file}" />
</target>
<target name="bash" depends="dist,javadoc" description="Create a standalone distribution archive for bash">
<zip destfile="vstar-bash.zip">
<zipfileset dir="${dist}" prefix="vstar/dist" />
<zipfileset dir="${extlib}" prefix="vstar/extlib">
<include name="vstar.jar" />
<include name="commons-math-2.2.jar" />
<include name="javacsv.jar" />
<include name="jfreechart-1.5.2.jar" />
<include name="jmathplot.jar" />
<include name="antlr-runtime-4.5.3.jar" />
<include name="nico-camargo-toolbar-icons-4.0.jar" />
<include name="vstaricon.png" />
</zipfileset>
<zipfileset file="VStar.sh" prefix="vstar" filemode="755" />
<zipfileset dir="data" prefix="vstar/data" />
<zipfileset dir="${doc}" prefix="vstar/doc">
<include name="license/*" />
</zipfileset>
<zipfileset dir="${doc}" prefix="vstar/doc">
<include name="vstar_docs/**" />
</zipfileset>
<zipfileset file="${doc}/user_manual/VStarUserManual.pdf" prefix="vstar/doc" />
<zipfileset file="${plugin}/doc/vstar_plugin_dev.pdf" prefix="vstar/doc" />
<zipfileset dir="${plugin}/plugin-dev" prefix="vstar/plugin-dev" />
<zipfileset file="src/org/aavso/tools/vstar/ui/resources/icons/vstaricon.png" prefix="vstar/doc" />
<zipfileset file="ReadMe.txt" prefix="vstar" />
<zipfileset file="ChangeLog.txt" prefix="vstar" />
</zip>
</target>
<target name="win" depends="dist,javadoc" description="Create a standalone distribution archive for Win32">
<!--
<launch4j configFile="${install_files}/vstar-launch4j.xml" />
-->
<zip destfile="vstar-win.zip">
<zipfileset dir="${dist}" prefix="vstar/dist" />
<zipfileset dir="${extlib}" prefix="vstar/extlib">
<include name="vstar.jar" />
<include name="commons-math-2.2.jar" />
<include name="javacsv.jar" />
<include name="jfreechart-1.5.2.jar" />
<include name="jmathplot.jar" />
<include name="antlr-runtime-4.5.3.jar" />
<include name="nico-camargo-toolbar-icons-4.0.jar" />
<include name="vstaricon.png" />
</zipfileset>
<zipfileset file="${install_files}/VStar.exe" prefix="vstar" />
<zipfileset file="${install_files}/JavaOsArch.class" prefix="vstar" />
<zipfileset file="${install_files}/VStar.ini" prefix="vstar" />
<zipfileset file="${install_files}/VStar.bat" prefix="vstar" />
<zipfileset file="${install_files}/VeLa.bat" prefix="vstar" />
<zipfileset file="${install_files}/CreateVStarShortcuts.vbs" prefix="vstar" />
<zipfileset dir="data" prefix="vstar/data" />
<zipfileset dir="${doc}" prefix="vstar/doc">
<include name="license/*" />
</zipfileset>
<zipfileset dir="${doc}" prefix="vstar/doc">
<include name="vstar_docs/**" />
</zipfileset>
<zipfileset file="${doc}/user_manual/VStarUserManual.pdf" prefix="vstar/doc" />
<zipfileset file="${plugin}/doc/vstar_plugin_dev.pdf" prefix="vstar/doc" />
<zipfileset dir="${plugin}/plugin-dev" prefix="vstar/plugin-dev" />
<zipfileset file="src/org/aavso/tools/vstar/ui/resources/icons/vstaricon.png" prefix="vstar/doc" />
<zipfileset file="ReadMe.txt" prefix="vstar" />
<zipfileset file="ChangeLog.txt" prefix="vstar" />
</zip>
</target>
<target name="mac" depends="dist,javadoc" description="Create a standalone distribution archive for Mac">
<echo message="Creating Mac app and DMG" />
<echo message="VStar.app: creating" />
<exec executable="./script/create_mac_app.sh" />
<echo message="codesign: signing" />
<exec executable="codesign">
<arg value="--force" />
<arg value="--deep" />
<arg value="--verbose" />
<arg value="-s" />
<arg value="${mac_identity}" />
<arg value="${dist_mac}/VStar.app" />
</exec>
<echo message="create disk image: attaching" />
<exec executable="hdiutil">
<arg value="attach" />
<arg value="${dmg_template}" />
</exec>
<echo message="create disk image: preparing" />
<delete dir="${vstar_volume}/Extras" />
<echo message="create disk image: copying files" />
<delete dir="${vstar_volume}/VStar.app" failonerror="true" />
<exec executable="cp">
<arg value="-r" />
<arg value="${dist_mac}/VStar.app" />
<arg value="${vstar_volume}" />
</exec>
<!--
<exec executable="xattr">
<arg value="-c" />
<arg value="${vstar_volume}/VStar.app" />
</exec>
-->
<mkdir dir="${vstar_volume}/Extras" />
<copy todir="${vstar_volume}/Extras">
<fileset file="ReadMe.txt" />
<fileset file="ChangeLog.txt" />
</copy>
<mkdir dir="${vstar_volume}/Extras/doc" />
<copy todir="${vstar_volume}/Extras/doc">
<fileset dir="${doc}">
<include name="license/*" />
</fileset>
<fileset dir="${doc}">
<include name="vstar_docs/**" />
</fileset>
<fileset file="${doc}/user_manual/VStarUserManual.pdf" />
<fileset file="${plugin}/doc/vstar_plugin_dev.pdf" />
</copy>
<mkdir dir="${vstar_volume}/Extras/data" />
<copy todir="${vstar_volume}/Extras/data">
<fileset dir="data" />
</copy>
<mkdir dir="${vstar_volume}/Extras/plugin-dev" />
<copy todir="${vstar_volume}/Extras/plugin-dev">
<fileset dir="${plugin}/plugin-dev" />
</copy>
<echo message="create disk image: detaching" />
<exec executable="hdiutil">
<arg value="detach" />
<arg value="${vstar_volume}" />
</exec>
<echo message="create disk image: compressing" />
<exec executable="hdiutil">
<arg value="convert" />
<arg value="${dmg_template}" />
<arg value="-quiet" />
<arg value="-format" />
<arg value="UDZO" />
<arg value="-imagekey" />
<arg value="zlib-level=9" />
<arg value="-o" />
<arg value="${dist_mac}/vstar-mac.dmg" />
</exec>
</target>
<!-- Run targets -->
<target name="run" depends="dist" description="Run VStar GUI">
<java fork="true" jar="${dist}/vstar.jar">
<jvmarg value="-ea" />
</java>
</target>
<target name="run_debug" depends="debug" description="Run debug VStar GUI">
<java jar="${dist_debug}/vstar.jar" fork="true">
<sysproperty key="DEBUG" value="true" />
<arg value="-h" />
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y" />
<jvmarg value="-ea" />
</java>
</target>
<!-- Unit test targets -->
<target name="compile_ut" depends="dist" description="Compile the test code">
<javac compiler="modern" source="1.8" target="1.8" srcdir="${test}"
destdir="${test_build}" debug="on" debuglevel="lines,vars,source">
<classpath refid="test.classpath" />
</javac>
</target>
<target name="test" depends="compile_ut" description="Run unit tests">
<!-- Run the tests -->
<junit fork="yes" printsummary="withOutAndErr" showoutput="true">
<formatter type="plain" />
<jvmarg value="-ea" />
<formatter type="plain" />
<batchtest todir="${test_report}" unless="testcase">
<fileset dir="${test}">
<include name="org/**/*Test.java" />
</fileset>
</batchtest>
<classpath refid="test.classpath" />
</junit>
<!-- Generate a summary report file to make it easier to spot failures. -->
<concat destfile="${test_report}/summary.txt">
<header filtering="no" trimleading="yes">
Test Summary
============
</header>
<path>
<fileset dir="${test_report}" includes="TEST-org*" />
</path>
<filterchain>
<linecontains>
<contains value="Tests run:" />
</linecontains>
</filterchain>
</concat>
<exec command="cat ${test_report}/summary.txt"/>
<!--
<exec command="cat ${test_report}/TEST-org.aavso.tools.vstar.util.locale.NumberParserTest.txt"/>
<exec command="cat ${test_report}/TEST-org.aavso.tools.vstar.vela.VeLaTest.txt"/>
<exec command="cat ${test_report}/TEST-org.aavso.tools.vstar.plugin.PluginManagerTest.txt"/>
<exec command="cat ${test_report}/TEST-org.aavso.tools.vstar.input.text.TextFormatObservationReaderTest.txt"/>
<exec command="cat ${test_report}/TEST-org.aavso.tools.vstar.input.database.VSXWebServiceAIDCSV2ObservationReaderTest.txt"/>
-->
<!-- Exit with status 1 if there were UT failures or errors. -->
<fileset id="build.failures" file="${test_report}/summary.txt">
<containsregexp expression="(Errors|Failures): [123456789]+" />
</fileset>
<fail status="1" message="One or more failures detected">
<condition>
<resourcecount when="greater" count="0" refid="build.failures" />
</condition>
</fail>
</target>
<target name="pit" depends="test">
<path id="mutation.path">
<path refid="pitest.classpath"/>
<path refid="test.classpath"/>
</path>
<!-- export feature activated to write mutants to file -->
<pitest
features="+EXPORT"
threads="2"
pitClasspath="pitest.classpath"
classPath="mutation.path"
targetClasses="org.aavso.tools.vstar.*"
targetTests="org.aavso.tools.vstar.*"
excludedtestclasses="org.aavso.tools.vstar.util.period.dcdft.*,org.aavso.tools.vstar.util.stats.DescStatsTest,org.aavso.tools.vstar.util.stats.anova.*"
reportDir="${mutation_coverage_dir}"
sourceDir="${src}" />
</target>
<!-- Documentation targets -->
<target name="javadoc" description="Javadoc generation">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${javadoc}" includes="**/*" />
</delete>
<javadoc sourcepath="${src}" destdir="${javadoc}" classpathref="build.classpath" header="VStar" />
<zip destfile="${doc}/vstar_docs.zip" basedir="${doc}" includes="vstar_docs/**/*" />
</target>
<!-- Clean targets -->
<target name="clean" description="Clean up">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${src_build}" includes="**/*" />
<fileset dir="${src_build_debug}" includes="**/*" />
<fileset dir="${test_build}" includes="**/*" />
<fileset dir="${dist}" includes="**/*" />
<fileset dir="${test_report}" includes="**/*" />
<fileset dir="${javadoc}" includes="**/*" />
<fileset file="${javadoc}.zip" />
<fileset file="vstar*.zip" />
<fileset dir="VStar.app" />
<fileset file="*.dmg" />
<fileset file="*.exe" />
<fileset file="*.bat" />
<fileset dir="${mutation_coverage_dir}" />
</delete>
</target>
</project>