build.xml 23.3 KB
Newer Older
1
<project name="disl" default="build" basedir=".">
Lukáš Marek's avatar
Lukáš Marek committed
2

3
	<property name="build.sysclasspath" value="ignore" />
4
	<property file="disl.version" />
5
	<property file="build.properties" />
Lukáš Marek's avatar
Lukáš Marek committed
6

7

8
9
10
11
12
13
14
15
16
17
18
19
20
	<!--
		Define additional tasks from ant-contrib.
	-->
	<taskdef resource="${ant-contrib.resource}">
		<classpath>
			<pathelement location="${ant-contrib.path}" />
		</classpath>
	</taskdef>


	<!--
		Define various class path elements.
	-->
21
	<path id="asm.classpath">
22
		<pathelement location="${asm.path}" />
23
24
25
	</path>

	<path id="junit.classpath">
František Haas's avatar
František Haas committed
26
27
28
29
		<pathelement location="${junit.core.path}" />
		<pathelement location="${junit.hamcrest.path}" />
	</path>

30
31
32
33
34
35
36
37
38
39

	<path id="util.classpath">
		<pathelement location="${build.util}" />
	</path>

	<path id="disl.classpath">
		<pathelement location="${build.disl}" />
	</path>

	<path id="disl.bypass.classpath">
40
		<pathelement location="${build.disl.bypass}/dynamic" />
41
42
43
44
45
46
47
48
49
50
	</path>

	<path id="shvm.classpath">
		<pathelement location="${build.shvm}" />
		<pathelement location="${build.shvm.dispatch}" />
	</path>


	<!-- Initialization -->

51
	<target name="determine-lib-names">
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
		<!--
			Determine the names of native agent libraries.
			Mac OS X (Darwin) is considered a Unix family.
		-->
		<if>
			<os family="windows" />
			<then>
				<property name="dl.prefix" value="" />
				<property name="dl.suffix" value=".dll" />
			</then>
			<else><if>
				<os family="unix" />
				<then>
					<property name="dl.prefix" value="lib" />
					<if>
						<os family="mac" />
						<then>
							<property name="dl.suffix" value=".jnilib" />
						</then>
						<else>
							<property name="dl.suffix" value=".so" />
						</else>
					</if>
				</then>
				<else>
					<fail message="Unsupported operating system: ${os.name}" />
				</else>
			</if></else>
		</if>

82
83
		<property name="disl.agent.lib" value="${dl.prefix}${disl.agent.lib.base}${dl.suffix}" />
		<property name="shvm.agent.lib" value="${dl.prefix}${shvm.agent.lib.base}${dl.suffix}" />
84
85
86
	</target>


87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
	<!--
		Looks for a class file or a source file with a given name, and
		sets the value of a given property to the fully qualified
		class name when a matching class (or source) file is found.
	-->
	<macrodef name="find-class">
		<attribute name="dir" />
		<attribute name="name" />
		<attribute name="property" />
		<attribute name="suffix" default=".class" />
		<attribute name="setonempty" default="true" />
		<sequential>
			<pathconvert property="@{property}" setonempty="@{setonempty}">
				<fileset dir="@{dir}" includes="**/@{name}@{suffix}" />
				<mapper type="package" from="${basedir}/@{dir}/*@{suffix}" to="*" />
			</pathconvert>
		</sequential>
	</macrodef>


107
108
	<!-- DiSL bypass -->

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
	<!--
		To compile DiSL bypass code, we need an extended Thread class
		containing a public "bypass" field used by the dynamic bypass
		code. When running an application with DiSL instrumentation,
		the Thread class will be extended at load time, but we need
		one also for compilation.

		Here we first check if the extended Thread class exists, and
		if not, we compile a simple Thread class extender and use it
		to generate the extended Thread. The check is inside a target
		so that it is performed only before actually attempting to
		create the extended Thread.
	-->
	<target name="check-disl-thread">
		<pathconvert property="disl.thread.available" setonempty="false">
			<fileset dir="." includes="${build.disl.thread}/**/Thread.class" />
		</pathconvert>
	</target>

	<target name="create-disl-thread" depends="check-disl-thread" unless="disl.thread.available">
		<!-- Compile Thread extender -->
130
		<mkdir dir="${build.disl}" />
131
132
133
		<javac destdir="${build.disl}" srcdir="${src.disl}" debug="yes">
			<include name="**/ExtendThread.java" />
			<classpath refid="asm.classpath" />
Lukáš Marek's avatar
Lukáš Marek committed
134
		</javac>
Lukáš Marek's avatar
Lukáš Marek committed
135

136
137
138
		<!-- Generated extended Thread -->
		<local name="extender.class" />
		<find-class property="extender.class" dir="${build.disl}" name="ExtendThread" />
139
140

		<mkdir dir="${build.disl.thread}" />
141
		<java classname="${extender.class}" fork="true">
142
143
144
145
146
			<classpath>
				<path refid="disl.classpath" />
				<path refid="asm.classpath" />
			</classpath>
			<arg value="${basedir}/${build.disl.thread}" />
147
		</java>
Lukáš Marek's avatar
Lukáš Marek committed
148
149
150
	</target>


151
152
153
154
155
156
	<!--
		Compile multiple versions of the bypass code: one which always
		bypasses the instrumentation, one which never bypasses the
		instrumentation, and one that checks the "bypass" field in
		the extended Thread class to determine whether to bypass the
		instrumentation or not.
Lukáš Marek's avatar
Lukáš Marek committed
157

158
159
160
161
162
163
164
165
166
167
168
		After compiling, create a file set of default bypass classes.
		The DiSL agent requires those so that instrumented application
		can find the BypassCheck class, and after switch to dynamic
		bypass performed by the agent, also the DynamicBypass class.
		The DiSL server requires both classes to create class literals
		in the weaver code.
	-->
	<target name="compile-disl-bypass" depends="create-disl-thread">
		<for list="always,never,dynamic" param="variant">
			<sequential>
				<mkdir dir="${build.disl.bypass}/@{variant}" />
169
				<javac destdir="${build.disl.bypass}/@{variant}" srcdir="${src.disl.bypass}/@{variant}" debug="true" source="1.4" target="1.4">
170
171
172
173
					<compilerarg value="-Xbootclasspath/p:${basedir}/${build.disl.thread}" />
				</javac>
			</sequential>
		</for>
174

175
176
177
178
		<union id="disl.bypass.files">
			<fileset dir="${build.disl.bypass}/always" includes="**/BypassCheck.class" />
			<fileset dir="${build.disl.bypass}/dynamic" includes="**/DynamicBypass.class" />
		</union>
179
180
	</target>

181

182
183
184
185
186
187
188
189
	<!--
		Package the default variant of the bypass code which will
		be included in the boot classpath. By default, we include
		a BypassCheck variant that always bypasses instrumentation.
		We also include DynamicBypass class that is needed by the
		dynamic variant of the BypassCheck class, which will be
		substituted by the DiSL agent in place of the default on.
	-->
190
	<target name="build-disl-bypass" depends="compile-disl-bypass">
191
192
		<jar destfile="${out.lib}/${disl.bypass.lib}">
			<resources refid="disl.bypass.files" />
193
		</jar>
194
195
	</target>

196
197
198

	<!-- Shared utility code -->

199
	<target name="compile-util">
200
		<mkdir dir="${build.util}" />
201
		<javac destdir="${build.util}" srcdir="${src.util}" debug="true" />
202
203
	</target>

204
205
206

	<!-- DiSL -->

207
208
209
	<target name="compile-disl" depends="compile-util,compile-disl-bypass">
		<mkdir dir="${build.disl}" />
		<javac destdir="${build.disl}" srcdir="${src.disl}" debug="true">
210
211
			<classpath>
				<path refid="disl.bypass.classpath" />
212
				<path refid="util.classpath" />
213
214
				<path refid="asm.classpath" />
			</classpath>
215
216
217
		</javac>
	</target>

Lukáš Marek's avatar
Lukáš Marek committed
218

219
	<target name="build-disl" depends="compile-disl,build-disl-bypass">
220
221
222
223
		<local name="disl.server.class" />
		<find-class property="disl.server.class" dir="${build.disl}" name="DiSLServer" />

		<jar destfile="${out.lib}/${disl.lib}">
224
			<manifest>
225
				<attribute name="Class-Path" value="${asm.lib}" />
226
				<attribute name="Main-Class" value="${disl.server.class}" />
227
				<attribute name="DiSL-Version" value="${disl.version}" />
228
			</manifest>
229

230
231
232
			<fileset dir="${build.util}" />
			<fileset dir="${build.disl}" excludes="**/ExtendThread.class" />
			<resources refid="disl.bypass.files" />
233
234
235
		</jar>
	</target>

236
237
238

	<!-- DiSL agent -->

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
	<!--
		The DiSL agent requires a header file containing flags for
		various code generation options. This target generates the
		header using "javah" after compiling DiSL.
	-->
	<property name="disl.agent.codeflags.path" value="${src.disl.agent}/codeflags.h" />
	<uptodate property="disl.agent.codeflags.uptodate" targetfile="${disl.agent.codeflags.path}">
		<srcfiles dir="${src.disl}" includes="**/DiSL.java" />
	</uptodate>

	<target name="prepare-disl-agent-codeflags" depends="compile-disl" unless="disl.agent.codeflags.uptodate">
		<local name="flags.class" />
		<find-class property="flags.class" dir="${build.disl}" name="*CodeOption$Flag" />

		<javah outputFile="${disl.agent.codeflags.path}">
			<class name="${flags.class}" />
			<classpath refid="disl.classpath" />
		</javah>
	</target>


	<!--
		The DiSL agent requires the bytecode of several bypass
		classes. The agent build system will convert the bytecode to
		a C source file, but it needs to know where to look for the
		class files. This target generates "Makefile.bypass" which
		provides the C build system with the necessary information.
	-->
	<property name="disl.agent.makefile.path" value="${src.disl.agent}/Makefile.bypass" />
	<available property="disl.agent.makefile.available" file="${makefile.path}" />

	<target name="prepare-disl-agent-makefile" depends="compile-disl" unless="disl.agent.makefile.available">
		<echo file="${disl.agent.makefile.path}"># Generated using the "prepare-disl-agent-makefile" Ant target.${line.separator}</echo>
		<echo file="${disl.agent.makefile.path}" append="true">BYPASS_DIR = ../${build.disl.bypass}${line.separator}</echo>
		<echo file="${disl.agent.makefile.path}" append="true">BYPASS_PKG_PATH = ch/usi/dag/disl/dynamicbypass${line.separator}</echo>

		<for param="path">
			<path>
				<fileset dir="${build.disl.bypass}" includes="**/BypassCheck.class" />
				<!-- fileset dir="${build.disl.bypass}" includes="**/DynamicBypass.class" /-->
			</path>
			<sequential>
				<local name="path.relative" />
				<pathconvert property="path.relative">
					<path path="@{path}" />
					<mapper type="glob" from="${basedir}/*" to="../*" />
				</pathconvert>
				<echo file="${disl.agent.makefile.path}" append="true">BYPASS_FILES += ${path.relative}${line.separator}</echo>
			</sequential>
		</for>
	</target>

	<target name="prepare-disl-agent" depends="prepare-disl-agent-codeflags,prepare-disl-agent-makefile" />


	<target name="compile-disl-agent" depends="prepare-disl-agent,determine-lib-names">
		<exec executable="make" dir="${src.disl.agent}">
			<arg value="WHOLE=1" />
		</exec>
	</target>


	<!--
		This target cross-compiles the DiSL agent library for
		Windows using MinGW. It is currently not used in the
		default build, but should be used for binary releases.
	-->
	<target name="compile-disl-agent-mingw" depends="prepare-disl-agent,determine-lib-names">
		<exec executable="make" dir="${src.disl.agent}">
			<arg value="WHOLE=1" />
			<arg value="TARGET_ENV=MinGW" />
		</exec>
Lukáš Marek's avatar
Lukáš Marek committed
311
312
313
	</target>


314
	<target name="build-disl-agent" depends="compile-disl-agent">
315
		<copy file="${src.disl.agent}/${disl.agent.lib}" todir="${out.lib}" />
316
	</target>
Lukáš Marek's avatar
Lukáš Marek committed
317
318


319
	<!-- Shadow VM -->
Lukáš Marek's avatar
Lukáš Marek committed
320

321
322
323
324
325
326
	<target name="compile-shvm-dispatch">
		<mkdir dir="${build.shvm.dispatch}" />
		<javac destdir="${build.shvm.dispatch}" srcdir="${src.shvm.dispatch}" debug="true" />
	</target>


327
	<target name="build-shvm-dispatch" depends="compile-shvm-dispatch">
328
329
330
331
332
		<jar destfile="${out.lib}/${shvm.dispatch.lib}" basedir="${build.shvm.dispatch}" />
	</target>


	<target name="compile-shvm" depends="compile-shvm-dispatch">
333
		<mkdir dir="${build.shvm}" />
334
335
		<javac destdir="${build.shvm}" srcdir="${src.shvm}" debug="true">
			<classpath refid="asm.classpath" />
336
		</javac>
Lukáš Marek's avatar
Lukáš Marek committed
337
338
	</target>

339

340
	<target name="build-shvm" depends="compile-shvm,build-shvm-dispatch">
341
342
343
344
		<local name="shvm.server.class" />
		<find-class property="shvm.server.class" dir="${build.shvm}" name="DiSLREServer" />

		<jar destfile="${out.lib}/${shvm.lib}" basedir="${build.shvm}">
345
			<manifest>
346
				<attribute name="Class-Path" value="${asm.lib}" />
347
				<attribute name="Main-Class" value="${shvm.server.class}" />
348
				<attribute name="DiSL-Version" value="${disl.version}" />
349
350
351
352
			</manifest>
		</jar>
	</target>

353
	<!-- Shadow VM agent -->
Lukáš Marek's avatar
Lukáš Marek committed
354

355
	<target name="compile-shvm-agent" depends="determine-lib-names">
356
357
		<exec executable="make" dir="${src.shvm.agent}/javahome" />
		<exec executable="make" dir="${src.shvm.agent}" />
358
359
360
	</target>


361
	<target name="build-shvm-agent" depends="compile-shvm-agent">
362
		<copy file="${src.shvm.agent}/${shvm.agent.lib}" todir="${out.lib}" />
363
	</target>
František Haas's avatar
František Haas committed
364

365

366
	<!-- JUnit tests and DiSL/Shadow VM test suites -->
367

368
	<target name="compile-test" depends="compile-util,compile-disl,compile-shvm">
369
		<mkdir dir="${build.test}" />
370
		<javac destdir="${build.test}" srcdir="${src.test}" debug="true">
371
372
373
374
375
376
377
378
			<classpath>
				<path refid="util.classpath" />
				<path refid="disl.classpath" />
				<path refid="shvm.classpath" />
				<path refid="junit.classpath" />
				<path refid="asm.classpath" />
			</classpath>
		</javac>
František Haas's avatar
František Haas committed
379

380
381
382
383
384
385
		<!-- Copy test resource files from source to class output directory. -->
		<copy todir="${build.test}">
			<fileset dir="${src.test}">
				<include name="**/*.resource" />
			</fileset>
		</copy>
František Haas's avatar
František Haas committed
386
387
388
	</target>


389
390
391
392
393
394
395
396
397
398
	<macrodef name="package2path">
		<attribute name="package" />
		<attribute name="property" />
		<sequential>
			<pathconvert property="@{property}">
				<path path="@{package}" />
				<mapper type="unpackage" from="${basedir}/*" to="*" />
			</pathconvert>
		</sequential>
	</macrodef>
František Haas's avatar
František Haas committed
399

František Haas's avatar
František Haas committed
400

401
	<target name="build-test" depends="compile-test">
402
403
404
405
406
407
		<property name="suite.base.pkg" value="ch.usi.dag.disl.test.suite" />
		<package2path package="${suite.base.pkg}" property="suite.base.path" />

		<condition property="test.suites" value="${test.name}" else="*">
			<isset property="test.name" />
		</condition>
František Haas's avatar
František Haas committed
408

409
		<for param="suite.path">
František Haas's avatar
František Haas committed
410
			<path>
411
412
				<dirset dir="${src.test}/${suite.base.path}">
					<include name="${test.suites}" />
František Haas's avatar
František Haas committed
413
414
415
				</dirset>
			</path>
			<sequential>
416
417
				<local name="suite.name" />
				<basename file="@{suite.path}" property="suite.name" />
418
				<antcall target="build-test-suite">
419
420
421
					<param name="test.suite.name" value="${suite.name}" />
					<param name="test.suite.path" value="${suite.base.path}/${suite.name}" />
					<param name="test.suite.pkg" value="${suite.base.pkg}.${suite.name}" />
František Haas's avatar
František Haas committed
422
423
424
425
426
				</antcall>
			</sequential>
		</for>
	</target>

František Haas's avatar
František Haas committed
427

428
	<target name="build-test-suite">
429
430
431
		<!-- Package target application classes. -->
		<jar destfile="${out.test}/${test.suite.name}-app.jar">
			<fileset dir="${build.test}" includes="${test.suite.path}/app/**" />
432
433
434
435
			<manifest>
				<attribute name="Main-Class" value="${test.suite.pkg}.app.TargetClass" />
			</manifest>
		</jar>
František Haas's avatar
František Haas committed
436

437
438
		<!-- Package instrumentation classes. -->
		<property name="inst.jar" value="${out.test}/${test.suite.name}-inst.jar" />
439
440
441
442
443
444
445
446
447
448
449
450
451
452
		<property name="inst.manifest" value="${test.suite.path}/instr/MANIFEST.MF" />

		<fileset id="inst.files" dir="${build.test}">
			<include name="${test.suite.path}/instr/**" />
			<exclude name="${inst.manifest}" />
		</fileset>

		<!--
			If the suite has a MANIFEST.MF, use it when creating the instrumentation
			jar file, otherwise generate a manifest with a default DiSL class.
		-->
		<if>
			<available file="${src.test}/${inst.manifest}" />
			<then>
453
				<jar destfile="${inst.jar}" manifest="${src.test}/${inst.manifest}">
454
455
456
					<fileset refid="inst.files" />
				</jar>
			</then><else>
457
				<jar destfile="${inst.jar}">
458
459
460
461
462
463
464
					<fileset refid="inst.files" />
					<manifest>
						<attribute name="DiSL-Classes" value="${test.suite.pkg}.instr.DiSLClass" />
					</manifest>
				</jar>
			</else>
		</if>
František Haas's avatar
František Haas committed
465
	</target>
František Haas's avatar
František Haas committed
466
467


468
	<target name="test" depends="build,build-test" description="Runs all tests or a selected (-Dtest.name=...) test suite.">
469
470
471
472
473
		<!--
			If test.name is set to a name of a test suite, only include the test suite
			in the batch of tests to be run, otherwise include all tests and suites.
		-->
		<if>
František Haas's avatar
František Haas committed
474
			<isset property="test.name" />
475
476
477
			<then>
				<echo>Running a single test suite: ${test.name}</echo>
				<fileset id="test.batch" dir="${src.test}">
478
					<include name="**/suite/${test.name}/junit/*Test.java" />
479
480
481
482
				</fileset>
			</then><else>
				<echo>Running all tests.</echo>
				<fileset id="test.batch" dir="${src.test}">
483
					<include name="**/junit/*Test.java" />
484
485
486
				</fileset>
			</else>
		</if>
František Haas's avatar
František Haas committed
487

488
489
490
		<!--
			Run the batch of junit tests and junit-wrapped test suites.
		-->
František Haas's avatar
František Haas committed
491
		<junit haltonfailure="no" haltonerror="no" failureproperty="junit.failure">
František Haas's avatar
František Haas committed
492
			<formatter type="brief" usefile="false" />
493
494
495
496
497
498
499
500
501
502

			<classpath>
				<path refid="asm.classpath" />
				<path refid="junit.classpath" />
				<pathelement location="${build.test}" />
				<pathelement location="${build.util}" />
				<pathelement location="${build.disl}" />
				<pathelement location="${build.shvm}" />
			</classpath>

503
			<!-- allow "disl.", "dislserver.", and "dislreserver." properties to be passed to tests -->
František Haas's avatar
František Haas committed
504
			<syspropertyset>
505
506
507
				<propertyref prefix="disl." />
				<propertyref prefix="dislserver." />
				<propertyref prefix="dislreserver." />
František Haas's avatar
František Haas committed
508
			</syspropertyset>
509
510
511

			<sysproperty key="disl.lib.dir" value="${out.lib}" />
			<sysproperty key="test.lib.dir" value="${out.test}" />
512
513
514
			<sysproperty key="disl.agent.lib" value="${disl.agent.lib}" />
			<sysproperty key="shvm.agent.lib" value="${shvm.agent.lib}" />

František Haas's avatar
František Haas committed
515
			<batchtest fork="yes">
516
				<fileset refid="test.batch" />
František Haas's avatar
František Haas committed
517
518
519
			</batchtest>
		</junit>
	</target>
520
521
522
523


	<!-- Eclipse support -->

524
	<target name="build-eclipse-agent">
525
526
527
528
		<local name="agent.class" />
		<find-class property="agent.class" dir="${src.test}" name="Agent" suffix=".java" />

		<jar destfile="${out.lib}/${eclipse.agent.lib}">
529
			<manifest>
530
				<attribute name="Premain-Class" value="${agent.class}" />
531
532
533
534
535
536
537
			</manifest>
		</jar>
	</target>


	<!-- Documentation -->

538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
	<macrodef name="pdflatex">
		<attribute name="dir" default="." />
		<element name="exec-elements" implicit="yes" />
		<sequential>
			<local name="pdflatex.output" />
			<local name="pdflatex.result" />

			<exec executable="pdflatex" dir="@{dir}" outputproperty="pdflatex.output" resultproperty="pdflatex.result">
				<exec-elements />
			</exec>
			<fail message="${pdflatex.output}">
				<condition><isfailure code="${pdflatex.result}" /></condition>
			</fail>
		</sequential>
	</macrodef>


	<target name="check-doc">
		<property name="doc.intro.tex" value="dislintro.tex" />
		<property name="doc.intro.pdf" value="${build.doc.intro}/dislintro.pdf" />
		<fileset id="doc.intro.files" dir="${src.doc.intro}" />

		<uptodate property="doc.intro.uptodate" targetfile="${doc.intro.pdf}">
			<srcfiles refid="doc.intro.files" />
		</uptodate>
	</target>


	<target name="build-doc" depends="check-doc" unless="doc.intro.uptodate">
567
568
		<delete dir="${build.doc.intro}" />
		<copy todir="${build.doc.intro}">
569
			<fileset refid="doc.intro.files" />
570
		</copy>
571
572
573
574
575
576
577
578
579
580

		<echo>Compiling Introduction to Instrumentation with DiSL</echo>
		<pdflatex dir="${build.doc.intro}">
			<arg value="-draftmode" />
			<arg value="${doc.intro.tex}" />
		</pdflatex>

		<pdflatex dir="${build.doc.intro}">
			<arg value="${doc.intro.tex}" />
		</pdflatex>
581
582
583
584
	</target>


	<target name="build-jdoc" depends="compile">
585
586
587
		<mkdir dir="${out.doc.jdoc}" />
		<javadoc destdir="${out.doc.jdoc}"
			access="public" author="true" version="true" use="true"
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
			nodeprecated="false" nodeprecatedlist="false"
			noindex="false" splitindex="true" nonavbar="false" notree="false"
			overview="${src.doc.jdoc}/overview.html"
			source="1.7"
		>
			<sourcepath>
				<pathelement path="${src.disl}" />
			</sourcepath>

			<sourcefiles>
				<fileset dir="${src.disl}">
					<include name="**/DiSL.java" />
					<include name="**/Scope.java" />
					<include name="**/ScopeImpl.java" />
					<include name="**/Shadow.java" />
				</fileset>
				<fileset dir="${src.disl.bypass}">
					<include name="**/DynamicBypass.java" />
				</fileset>
			</sourcefiles>

			<classpath>
				<path refid="disl.bypass.classpath" />
				<path refid="asm.classpath" />
			</classpath>

			<package name="ch.usi.dag.disl.annotation" />
			<package name="ch.usi.dag.disl.marker" />
			<package name="ch.usi.dag.disl.guardcontext" />
			<package name="ch.usi.dag.disl.staticcontext" />
			<package name="ch.usi.dag.disl.dynamiccontext" />
			<package name="ch.usi.dag.disl.classcontext" />
			<package name="ch.usi.dag.disl.processorcontext" />
			<package name="ch.usi.dag.disl.transformer" />
		</javadoc>
	</target>


	<!-- Miscellaneous -->

	<target name="copy-asm">
629
		<copy file="${asm.path}" tofile="${out.lib}/${asm.lib}" />
630
631
632
633
	</target>


	<target name="package-src">
634
		<zip destfile="${out.src}/src.zip">
635
			<zipfileset dir="${src.disl}" />
636
			<zipfileset dir="${src.disl.bypass}/dynamic" />
637
638
639
640
641
642
643
644
645
			<zipfileset dir="${src.shvm}" />
			<zipfileset dir="${src.shvm.dispatch}" />
			<zipfileset dir="${src.util}" />
		</zip>
	</target>


	<!-- Releases -->

646
	<target name="release-bin" depends="build,package-src">
647
		<!-- Collect the artifacts from output and source directories. -->
648
		<zip destfile="${release.bin.zip}">
649
650
651
652
653
654
655
656
657
658
			<zipfileset prefix="${disl.prefix}/${dist.bin}" dir="${src.bin}" filemode="755" />
			<zipfileset prefix="${disl.prefix}/${dist.lib}" dir="${out.lib}">
				<include name="${asm.lib}" />
				<include name="${disl.lib}" />
				<include name="${disl.bypass.lib}" />
				<include name="${disl.agent.lib}" />
				<include name="${shvm.lib}" />
				<include name="${shvm.dispatch.lib}" />
				<include name="${shvm.agent.lib}" />
			</zipfileset>
659
			<zipfileset prefix="${disl.prefix}/${dist.doc.intro}" file="${doc.intro.pdf}" />
660
661
662
663
664
665
666
667
668
669
			<zipfileset prefix="${disl.prefix}/${dist.doc.jdoc}" dir="${out.doc.jdoc}" />
			<zipfileset prefix="${disl.prefix}/${dist.examples}" dir="${src.examples}">
				<exclude name="build-override.properties" />
			</zipfileset>
			<zipfileset prefix="${disl.prefix}/${dist.src}" dir="${out.src}" />
			<zipfileset prefix="${disl.prefix}" dir=".">
				<include name="COPYING" />
				<include name="README" />
				<include name="USER_ERRORS" />
			</zipfileset>
670
671
		</zip>

672
		<!-- Convert the zip archive to bzip2 compressed tar. -->
673
674
675
676
677
678
		<tar destfile="${release.bin.tar}" compression="bzip2">
			<zipfileset src="${release.bin.zip}" />
		</tar>
	</target>


679
	<target name="release-src" depends="clean-examples">
680
681
		<zip destfile="${release.src.zip}">
			<zipfileset prefix="disl-${disl.version}" dir=".">
682
683
684
685
686
				<include name="${src.bin}/" />
				<include name="${src.doc}/" />
				<include name="${src.examples}/" />
				<include name="${lib.dir}/*.jar" />
				<include name="${lib.dir}/*.txt" />
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
				<include name="COPYING" />
				<include name="README" />
				<include name="README_TESTS" />
				<include name="USER_ERRORS" />
				<include name="build.properties" />
				<include name="build.xml" />
				<include name="disl.version" />
				<include name=".settings/" />
				<include name=".project" />
				<include name=".classpath" />
				<include name="eclipse.*" />
			</zipfileset>
			<zipfileset prefix="disl-${disl.version}" dir="." includes="src*/" excludes="**/var,**/find.sh,**/*.so,**.jnilib,**/*.o" />
			<zipfileset prefix="disl-${disl.version}" dir="." includes="src*/**/find.sh" filemode="755" />
		</zip>

		<tar destfile="${release.src.tar}" compression="bzip2">
			<zipfileset src="${release.src.zip}" />
		</tar>
	</target>


	<!-- Summary targets -->

711
	<target name="compile" depends="compile-disl,compile-disl-agent,compile-shvm,compile-shvm-agent" description="Compiles DiSL, Shadow VM, and the JVM agents for both." />
712

713
	<target name="build" depends="build-disl,build-disl-agent,build-shvm,build-shvm-agent,copy-asm" description="Builds DiSL and Shadow VM, without documentation." />
714

715
	<target name="eclipse" depends="build-eclipse-agent,build-disl-bypass" description="Creates libraries for developing DiSL under Eclipse." />
716

717
	<target name="doc" depends="build-doc,build-jdoc" description="Builds DiSL documentation (requires javadoc and pdflatex)." />
718

719
	<target name="release" depends="doc,release-bin,release-src" description="Produces DiSL source and binary release archives." />
720
721
722
723


	<!-- Clean up -->

724
725
726
727
728
729
	<target name="clean-examples">
		<ant dir="${src.examples}" target="clean" />
	</target>


	<target name="clean" depends="clean-examples">
730
		<exec executable="make" dir="${src.disl.agent}">
731
			<arg value="cleanall" />
732
733
734
735
736
737
738
739
		</exec>

		<exec executable="make" dir="${src.shvm.agent}/javahome">
			<arg value="clean" />
		</exec>
		<exec executable="make" dir="${src.shvm.agent}">
			<arg value="clean" />
		</exec>
740
741

		<delete dir="${out.dir}" />
742
743
	</target>

Lukáš Marek's avatar
Lukáš Marek committed
744
</project>