-
Notifications
You must be signed in to change notification settings - Fork 40
/
build.xml
407 lines (364 loc) · 17.2 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
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="TAJS" default="all" basedir=".">
<property name="project" value="tajs" />
<property name="version" value="0.25" />
<property name="optimize" value="on" />
<property name="debug" value="off" />
<property name="statsquiet" value="false" />
<property file="tajs.properties"/>
<path id="classpath">
<fileset dir=".">
<include name="lib/*.jar"/>
<include name="extras/jalangilogger/build/libs/*.jar"/>
<include name="extras/inspector/dist/*.jar"/>
<include name="extras/ts-spec-reader/build/libs/*.jar"/>
</fileset>
</path>
<path id="classpath.test">
<fileset dir=".">
<include name="lib/*.jar"/>
<include name="extras/jalangilogger/build/libs/*.jar"/>
<include name="extras/ts-spec-reader/build/libs/*.jar"/>
<include name="extras/inspector/dist/*.jar"/>
<include name="lib/test/*.jar"/>
</fileset>
<pathelement location="antbuild"/>
<pathelement location="test-resources"/>
<pathelement location="benchmarks"/>
</path>
<path id="classpath.run">
<fileset dir=".">
<include name="lib/*.jar"/>
</fileset>
<pathelement location="antbuild"/>
</path>
<condition property="isWindows">
<os family="windows"/>
</condition>
<target name="all" depends="clean,install-javascript-modules,jar-all,tajs-functions,doc" description="Rebuild everything" />
<target name="compile" description="Compile all Java code">
<!--
<property name="cp" refid="classpath"/>
<echo message="Classpath is ${cp}"/>
-->
<mkdir dir="antbuild"/>
<javac srcdir="src" includes="**" destdir="antbuild" optimize="${optimize}"
debug="${debug}" includeantruntime="false">
<classpath refid="classpath" />
<compilerarg line="-encoding ISO-8859-1 -Xlint:deprecation" compiler="modern" />
<!--
<compilerarg line="-Xlint -Xlint:-serial -Xlint:-path" compiler="modern" />
-->
</javac>
<copy todir="antbuild">
<fileset dir="resources"/>
</copy>
</target>
<target name="install-javascript-modules" description="Install JavaScript modules in extras and test-resources">
<exec executable="node" dir="extras/jsdelta">
<arg line="install"/>
</exec>
<exec executable="node" dir="extras/babel">
<arg line="install"/>
</exec>
<exec executable="node" dir="extras/jalangilogger/javascript">
<arg line="install"/>
</exec>
<exec executable="node" dir="extras/ts-spec-reader">
<arg line="install"/>
</exec>
<exec executable="node" dir="test-resources/src/tsspecs">
<arg line="install"/>
</exec>
</target>
<target name="tajs-functions" depends="compile" description="Generate TAJS-functions.md">
<java classname="dk.brics.tajs.analysis.nativeobjects.TAJSFunctionEvaluator" fork="true" failonerror="true" maxmemory="2048m" output="TAJS-functions.md">
<classpath refid="classpath.run" />
</java>
</target>
<target name="jar" depends="clean,compile" description="Rebuild tajs.jar">
<mkdir dir="dist" />
<jar jarfile="dist/${project}.jar" basedir="antbuild" includes="**"/>
</target>
<target name="jar-all" depends="jar" description="Rebuild tajs.jar and tajs-all.jar">
<jar jarfile="dist/${project}-all.jar">
<zipgroupfileset dir="lib" includes="*.jar"/>
<zipgroupfileset dir="extras/jalangilogger/build/libs" includes="*.jar"/>
<zipgroupfileset dir="extras/inspector/dist" includes="*.jar"/>
<zipgroupfileset dir="extras/ts-spec-reader/build/libs" includes="*.jar"/>
<zipfileset src="dist/${project}.jar"/>
<manifest>
<attribute name="Main-Class" value="dk.brics.tajs.Main" />
</manifest>
</jar>
</target>
<target name="clean" description="Clean generated files">
<delete dir="antbuild" />
<delete dir="doc" />
<delete dir="flowgraphs" />
<delete dir="dist" />
</target>
<target name="clean-all" depends="clean" description="Clean generated files and installed JavaScript modules">
<delete dir="extras/babel/node_modules" />
<delete file="extras/babel/package-lock.json" />
<delete dir="extras/jalangilogger/javascript/node_modules" />
<delete file="extras/jalangilogger/javascript/package-lock.json" />
<delete dir="extras/jsdelta/node_modules" />
<delete file="extras/jsdelta/package-lock.json" />
<delete dir="extras/ts-spec-reader/node_modules" />
<delete file="extras/ts-spec-reader/package-lock.json" />
</target>
<target name="doc" depends="jar" description="Generate javadoc">
<mkdir dir="doc" />
<javadoc overview="src/overview.html" Package="true" sourcepath="src" destdir="doc" nodeprecated="true" author="true" notree="true" nohelp="true" windowtitle="TAJS" additionalparam="-Xdoclint:-html,-missing">
<doctitle>
<![CDATA[Type Analyzer for JavaScript (TAJS) API Specification]]>
</doctitle>
<bottom><![CDATA[<i> Copyright © 2009-2019 Aarhus University </i>]]></bottom>
<link href="http://docs.oracle.com/en/java/javase/11/docs/api/"/>
<link href="http://www.mozilla.org/rhino/apidocs/" />
<classpath refid="classpath" />
</javadoc>
</target>
<target name="zip" depends="all" description="Rebuild everything and generate tajs-N.N.zip">
<fail message="option 'debug' should be disabled before making zip">
<condition>
<istrue value="${debug}" />
</condition>
</fail>
<property name="dir" value="${project}-${version}" />
<mkdir dir="${dir}" />
<copy todir="${dir}">
<fileset dir="." includes="README.md,LICENSE,build.xml,TAJS-functions.md" />
</copy>
<copy file="dist/${project}.jar" todir="${dir}/dist" />
<mkdir dir="${dir}/doc" />
<copy todir="${dir}/doc">
<fileset dir="doc" />
</copy>
<copy todir="${dir}/lib">
<fileset dir="lib" />
</copy>
<mkdir dir="${dir}/src" />
<copy todir="${dir}/src">
<fileset dir="src" excludes="**/*.class" />
</copy>
<zip zipfile="dist/${dir}.zip" basedir="." includes="${dir}/**" />
<!--
<tar tarfile="${dir}.tar" basedir="." includes="${dir}/**" />
<gzip zipfile="${dir}.tar.gz" src="${dir}.tar" />
<delete file="${dir}.tar" />
-->
<delete dir="${dir}" />
</target>
<target name="compile-test" depends="compile" description="Compile test files">
<javac srcdir="test/src" includes="**" destdir="antbuild" optimize="${optimize}" debug="${debug}"
includeantruntime="false">
<classpath refid="classpath.test"/>
<compilerarg line="-encoding ISO-8859-1" compiler="modern"/>
<compilerarg line="-Xlint -Xlint:-serial -Xlint:-path" compiler="modern"/>
</javac>
</target>
<target name="test-fast" depends="compile-test" description="Run fast tests">
<junit fork="true" printsummary="yes" showoutput="yes" haltonfailure="no" haltonerror="no" failureproperty="test.failed" maxmemory="2048m">
<classpath refid="classpath.test" />
<test name="dk.brics.tajs.test.RunFast"/>
</junit>
<fail message="tests failed" if="test.failed"/>
</target>
<target name="test-medium" depends="compile-test" description="Run medium tests">
<junit fork="true" printsummary="yes" showoutput="yes" haltonfailure="no" haltonerror="no" failureproperty="test.failed" maxmemory="2048m">
<classpath refid="classpath.test" />
<test name="dk.brics.tajs.test.RunMedium"/>
</junit>
<fail message="tests failed" if="test.failed"/>
</target>
<target name="test-slow" depends="compile-test" description="Run slow tests">
<junit fork="true" printsummary="yes" showoutput="yes" haltonfailure="no" haltonerror="no" failureproperty="test.failed" maxmemory="2048m">
<classpath refid="classpath.test" />
<test name="dk.brics.tajs.test.RunSlow"/>
</junit>
<fail message="tests failed" if="test.failed"/>
</target>
<target name="test-all" depends="compile-test" description="Run all tests">
<junit fork="true" printsummary="yes" showoutput="yes" haltonfailure="no" haltonerror="no" failureproperty="test.failed" maxmemory="2048m">
<classpath refid="classpath.test" />
<test name="dk.brics.tajs.test.RunAll" />
</junit>
<fail message="tests failed" if="test.failed"/>
</target>
<target name="test-stats-standard" depends="compile-test" description="Run StatsStandard">
<java classname="dk.brics.tajs.test.stats.StatsStandard" fork="true" failonerror="true" maxmemory="2048m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="test-stats-extra" depends="compile-test" description="Run StatsExtra">
<java classname="dk.brics.tajs.test.stats.StatsExtra" fork="true" failonerror="true" maxmemory="2048m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="test-stats-libs" depends="compile-test" description="Run StatsLibs">
<java classname="dk.brics.tajs.test.stats.StatsLibs" fork="true" failonerror="true" maxmemory="8192m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="test-stats-jquery" depends="compile-test" description="Run StatsJQuery">
<java classname="dk.brics.tajs.test.stats.StatsJQuery" fork="true" failonerror="true" maxmemory="8192m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="test-stats-value-partitioning-underscore" depends="compile-test" description="Run StatsValuePartitioning.Underscore">
<java classname="dk.brics.tajs.test.stats.StatsValuePartitioning$Underscore" fork="true" failonerror="true" maxmemory="8192m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="test-stats-value-partitioning-lodash3" depends="compile-test" description="Run StatsValuePartitioning.Lodash3">
<java classname="dk.brics.tajs.test.stats.StatsValuePartitioning$Lodash3" fork="true" failonerror="true" maxmemory="8192m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="test-stats-value-partitioning-lodash4" depends="compile-test" description="Run StatsValuePartitioning.Lodash4">
<java classname="dk.brics.tajs.test.stats.StatsValuePartitioning$Lodash4" fork="true" failonerror="true" maxmemory="8192m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="test-stats-value-partitioning-prototype" depends="compile-test" description="Run StatsValuePartitioning.Prototype">
<java classname="dk.brics.tajs.test.stats.StatsValuePartitioning$Prototype" fork="true" failonerror="true" maxmemory="8192m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="test-stats-value-partitioning-scriptaculous" depends="compile-test" description="Run StatsValuePartitioning.Scriptaculous">
<java classname="dk.brics.tajs.test.stats.StatsValuePartitioning$Scriptaculous" fork="true" failonerror="true" maxmemory="8192m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="test-stats-value-partitioning-jquery" depends="compile-test" description="Run StatsValuePartitioning.JQuery">
<java classname="dk.brics.tajs.test.stats.StatsValuePartitioning$JQuery" fork="true" failonerror="true" maxmemory="8192m">
<classpath refid="classpath.test" />
<sysproperty key="statsquiet" value="${statsquiet}"/>
</java>
</target>
<target name="publish" depends="all" description="Rebuild everything and publish to public directory">
<fail message="property 'public' should be set in tajs.properties">
<condition>
<not>
<isset property="public" />
</not>
</condition>
</fail>
<fail message="option 'debug' should be disabled before publishing">
<condition>
<istrue value="${debug}" />
</condition>
</fail>
<property name="doc" value="doc-${version}" />
<property name="dist" value="dist-${version}" />
<delete dir="${public}/${doc}" />
<mkdir dir="${public}/${doc}" />
<copy todir="${public}/${doc}">
<fileset dir="doc" />
</copy>
<mkdir dir="${public}/${dist}" />
<copy todir="${public}/${dist}">
<fileset dir="dist" includes="*.jar" />
</copy>
<copy todir="${public}/${dist}">
<fileset dir="lib" />
</copy>
<chmod dir="${public}" perm="go+r" includes="${doc}/**,${doc},${dist}/**,${dist}" type="both" />
<chmod dir="${public}" perm="go+x" includes="${doc}/**,${doc},${dist}/**,${dist}" type="dir" />
</target>
<target name="dotview" description="View dot file (use with -Ddotfile=<path>)">
<fail message="parameter 'dotfile' missing">
<condition>
<not>
<isset property="dotfile" />
</not>
</condition>
</fail>
<fail message="property 'dot' should be set in tajs.properties">
<condition>
<not>
<isset property="dot" />
</not>
</condition>
</fail>
<fail message="property 'imgviewer' should be set in tajs.properties">
<condition>
<not>
<isset property="imgviewer" />
</not>
</condition>
</fail>
<tempfile property="temp.file" suffix=".png" destdir="${java.io.tmpdir}" />
<exec executable="${dot}">
<arg value="-Tpng" />
<arg value="-o${temp.file}" />
<arg value="${dotfile}" />
</exec>
<echo message="Created PNG: ${temp.file}" />
<exec executable="${imgviewer}" spawn="true">
<arg value="${temp.file}" />
</exec>
</target>
<target name="view-callgraph" description="View call graph (out/callgraph.dot)">
<antcall target="dotview">
<param name="dotfile" value="out/callgraph.dot" />
</antcall>
</target>
<target name="view-state" description="View abstract state (out/state.dot)">
<antcall target="dotview">
<param name="dotfile" value="out/state.dot" />
</antcall>
</target>
<target name="view-flowgraph" description="View flow graph (out/flowgraphs/final.dot)">
<antcall target="dotview">
<param name="dotfile" value="out/flowgraphs/final.dot" />
</antcall>
</target>
<target name="dotfiles" description="Convert dot files to PNG (use with -Ddotdir=<path>)">
<fail message="parameter 'dotdir' missing">
<condition>
<not>
<isset property="dotdir" />
</not>
</condition>
</fail>
<fail message="property 'dot' should be set in tajs.properties">
<condition>
<not>
<isset property="dot" />
</not>
</condition>
</fail>
<fileset dir="${dotdir}" id="dotfiles">
<include name="**/*.dot" />
</fileset>
<pathconvert pathsep=" " property="dotfiles_flattened" refid="dotfiles" />
<echo message="Converting dot files: ${dotfiles_flattened}" />
<exec executable="${dot}">
<arg value="-Tpng" />
<arg value="-O" />
<arg line="${dotfiles_flattened}" />
</exec>
</target>
<target name="dot-flowgraphs" description="Convert flow graphs (out/flowgraphs) to PNG">
<antcall target="dotfiles">
<param name="dotdir" value="out/flowgraphs" />
</antcall>
</target>
<target name="dot-newflows" description="Convert new-flows (out/newflows) to PNG" >
<antcall target="dotfiles">
<param name="dotdir" value="out/newflows" />
</antcall>
</target>
</project>