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
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
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
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
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
|
<!-- ========================================================================= -->
<!-- Copyright (c) 2003 Contributors. -->
<!-- All rights reserved. -->
<!-- This program and the accompanying materials are made available -->
<!-- under the terms of the Common Public License v1.0 -->
<!-- which accompanies this distribution and is available at -->
<!-- http://www.eclipse.org/legal/cpl-v10.html -->
<!-- -->
<!-- Contributors: -->
<!-- Wes Isberg initial implementation -->
<!-- ========================================================================= -->
<project name="build" default="all" basedir=".">
<!-- ========================================================================= -->
<target name="info" depends="init-variables">
<echo>
Build and test the AspectJ source tree. Targets:
all (default)
install # install distribution
build
build-release # build distribution
build-tests # build test classes
test
test-sources # - requires only sources
test-harness-tests # run tests/{suite}.xml's
test-junit-modules # tests/junitModules.xml
test-install # - requires distribution
test-build-examples # install/docs/examples
test-ajc-aspectj # ajc compiles aspectj
Normally this builds with Java 1.3 and tests with both
Java 1.3 and 1.4, so define both as properties. You
can select any target (not prefixed "do-" or "init-").
The leaf targets will run with Java version set in
${java.home.file}
When running non-leaf targets, if you want to test
only in 1.3 or 1.4, set property "run.1[3|4].only".
Properties to consider setting on the command-line:
-- required
java13.home JAVA_HOME for latest J2SE 1.3
java14.home JAVA_HOME for latest J2SE 1.4
-- flags to control
run.13.only only use Java 1.3
run.14.only only use Java 1.4
skip.cvs no CVS checkout (true)
skip.build no build (done already)
skip.test no tests
skip.build.release no build of release
skip.build.tests no build of tests
version set if not DEVELOPMENT(?)
aspectj.build.props Ant props for ../build.xml
-- locations to re-use existing tree or install
aspectj.workspace location for new cvs tree
aspectj.modules.dir ... for existing cvs tree
aj.build.install.dir ... for installed dist
Example command lines for using this script:
- define variable for standard properties
sp="-Djava13.home=d:/j13 -Djava14.home=d:/j14"
sp="$${sp} -Daspectj.modules.dir=../.."
- clean first
cd build
ant clean
- test only sources in local tree
cd build/release
ant test-sources $${sp}
- build and install distribution:
cd build/release
ant install $${sp}
- test installation and sources in local tree:
cd build/release
ant test $${sp} -Dskip.build=true
- do everything but checkout from cvs:
cd build
ant clean
cd release
ant all $${sp}
</echo>
</target>
<target name="init-variables" >
<!-- re-enable when tested -->
<property name="skip.cvs" value="true"/>
<property name="aspectj.build.props" value=""/>
<property name="version" value="DEVELOPMENT"/>
<property name="ant.verbose" value=""/>
<property name="failonerror" value="true"/>
<property name="aspectj.workspace"
location="${basedir}/aspectj-workspace"/>
<property name="aspectj.modules.dir"
location="${aspectj.workspace}/org.aspectj/modules"/>
<property name="aspectj.build.dir"
location="${aspectj.modules.dir}/build"/>
<property name="aspectj.build.release.dir"
location="${aspectj.build.dir}/release"/>
<property name="aspectj.tests.dir"
location="${aspectj.modules.dir}/tests"/>
<property name="aspectj.lib.dir"
location="${aspectj.modules.dir}/lib"/>
<property name="aspectj.ant.home"
location="${aspectj.lib.dir}/ant"/>
<property name="aspectj.ant.lib.dir"
location="${aspectj.ant.home}/lib"/>
<property name="aj.build.dir"
location="${aspectj.modules.dir}/aj-build"/>
<property name="aj.build.jar.dir"
location="${aj.build.dir}/jars"/>
<property name="aj.build.dist.dir"
location="${aj.build.dir}/dist"/>
<property name="aj.build.jar.dir"
location="${aj.build.dir}/jars"/>
<property name="aj.build.install.dir"
location="${aj.build.dir}/install"/>
<property name="aj.build.log.dir"
location="${aj.build.dir}/logs"/>
<!-- todo: clean-up file created as side-effect -->
<property name="java.home.file"
location="${aspectj.build.release.dir}/javahome.props.tmp"/>
<property name="aspectj.jar"
location="${aj.build.dist.dir}/aspectj-${version}.jar"/>
<property name="harness.jar"
location="${aj.build.jar.dir}/testing-drivers-all.jar"/>
<property name="java13.command"
location="${java13.home}/bin/java"/>
<property name="java14.command"
location="${java14.home}/bin/java"/>
<mkdir dir="${aj.build.log.dir}"/>
<path id="lib.classpath">
<pathelement location="${aspectj.lib.dir}/eclipse2.0/jdtDepends.jar" />
<pathelement location="${aspectj.lib.dir}/bcel/bcel.jar" />
<pathelement location="${aspectj.lib.dir}/jdiff/jdiff.jar" />
<pathelement location="${aspectj.lib.dir}/commons/commons.jar" />
<pathelement location="${aspectj.lib.dir}/ant/lib/ant.jar" />
<pathelement location="${aspectj.lib.dir}/ant/lib/xml-apis.jar" />
<pathelement location="${aspectj.lib.dir}/ant/lib/xercesImpl.jar" />
<pathelement location="${aspectj.lib.dir}/junit/junit.jar" />
<pathelement location="${aspectj.modules.dir}/org.eclipse.jdt.core/jdtcore-for-aspectj.jar" />
</path>
<!-- requires normal build, i.e., with test classes -->
<path id="jar.classpath">
<pathelement location="${aj.build.jar.dir}/ajde.jar" />
<pathelement location="${aj.build.jar.dir}/ajbrowser.jar" />
<pathelement location="${aj.build.jar.dir}/asm.jar" />
<pathelement location="${aj.build.jar.dir}/bridge.jar" />
<pathelement location="${aj.build.jar.dir}/build.jar" />
<pathelement location="${aj.build.jar.dir}/org.aspectj.ajdt.core.jar" />
<pathelement location="${aj.build.jar.dir}/runtime.jar" />
<pathelement location="${aj.build.jar.dir}/taskdefs.jar" />
<pathelement location="${aj.build.jar.dir}/testing.jar" />
<pathelement location="${aj.build.jar.dir}/testing-client.jar" />
<pathelement location="${aj.build.jar.dir}/testing-drivers.jar" />
<pathelement location="${aj.build.jar.dir}/testing-util.jar" />
<pathelement location="${aj.build.jar.dir}/util.jar" />
<pathelement location="${aj.build.jar.dir}/weaver.jar" />
<path refid="lib.classpath"/>
</path>
<available property="jar.path.available"
file="${aj.build.jar.dir}/ajbrowser.jar" type="file"/>
</target>
<target name="init-sources-available" depends="init-variables"
unless="sources.available">
<available property="sources.available"
file="${aspectj.modules.dir}/build/build.xml"/>
<fail unless="sources.available" message="checkout first"/>
</target>
<target name="init-aspectj-available" depends="init-variables"
unless="aspectj.available">
<available property="aspectj.available"
file="${aj.build.install.dir}" type="dir"/>
<fail unless="aspectj.available"
message="install first in ${aj.build.install.dir}"/>
</target>
<target name="init-harness-available" depends="init-variables"
unless="harness.available">
<available property="harness.available"
classname="org.aspectj.testing.drivers.Harness"
classpath="${harness.jar}"/>
<fail unless="harness.available"
message="harness not found - first build-tests"/>
</target>
<target name="init-junitTests-available" depends="init-variables"
unless="tests.available">
<available property="tests.available"
classname="TestingDriversModuleTests">
<classpath>
<path refid="jar.classpath"/>
<path location="${aspectj.lib.dir}/junit/junit.jar"/>
</classpath>
</available>
<fail unless="tests.available"
message="test classes not found - first build-tests"/>
</target>
<!-- ========================================================================= -->
<target name="all">
<antcall target="install"/>
<antcall target="test"/>
</target>
<target name="build" unless="skip.build"
description="build an AspectJ release and tests">
<antcall target="build-release"/>
<antcall target="build-tests"/>
</target>
<target name="test" unless="skip.test"
description="test AspectJ source and distribution">
<antcall target="test-sources"/>
<antcall target="test-install"/>
</target>
<target name="install" depends="build,init-variables"
description="install AspectJ distribution using current java">
<fail unless="aspectj.jar" message="define aspectj.jar"/>
<fail unless="aj.build.install.dir" message="define aj.build.install.dir"/>
<mkdir dir="${aj.build.install.dir}"/>
<delete dir="${aj.build.install.dir}"/>
<mkdir dir="${aj.build.install.dir}"/>
<java fork="true" jar="${aspectj.jar}" failonerror="true">
<arg line="-to ${aj.build.install.dir}"/>
</java>
</target>
<target name="create-tree" depends="init-variables"
unless="skip.cvs"
description="create an AspectJ source tree">
<fail message="testing now - remove when validated"/>
<mkdir dir="${aspectj.workspace}"/>
<delete dir="${aspectj.workspace}"/>
<mkdir dir="${aspectj.workspace}"/>
<cvs cvsRoot=":pserver:anonymous@eclipse.org:/home/technology"
dest="${aspectj.workspace}"
package="org.aspectj/modules"
quiet="on"
failonerror="on"
command="checkout -P" />
</target>
<target name="build-release" depends="init-variables,create-tree"
description="build an AspectJ release under Java 1.3"
unless="skip.build.release">
<!-- release build destroys test build, but not vice-versa -->
<antcall target="do-aspectj-build">
<param name="do.ant.target" value="clean"/>
<param name="do.ant.props" value=""/>
</antcall>
<antcall target="do-aspectj-build">
<param name="do.ant.target" value="aspectj"/>
<param name="do.ant.props" value=""/>
</antcall>
</target>
<target name="build-tests" depends="init-variables,create-tree"
description="build AspectJ tests under Java 13"
unless="skip.build.tests">
<antcall target="do-aspectj-build">
<param name="do.ant.target" value="clean-jars"/>
<param name="do.ant.props" value=""/>
</antcall>
<antcall target="do-aspectj-build">
<param name="do.ant.target" value="build-testing-jars"/>
<param name="do.ant.props" value="-Dtrim.testing.default=false"/>
</antcall>
</target>
<!-- ==== install tests ==== -->
<target name="test-install">
<antcall target="do-13-target">
<param name="do.target" value="do-test-install-sequence"/>
</antcall>
<antcall target="do-14-target">
<param name="do.target" value="do-test-install-sequence"/>
</antcall>
</target>
<target name="do-test-install-sequence"
depends="init-variables,init-aspectj-available">
<antcall target="test-build-examples"/>
<antcall target="test-ajc-aspectj"/>
</target>
<target name="test-build-examples"
depends="init-variables,init-aspectj-available">
<antcall target="do-build-installed-example">
<param name="example.target" value="nonGui"/>
</antcall>
<antcall target="do-build-installed-example">
<param name="example.target" value="tracing-bc"/>
</antcall>
<echo message="Also setup and run compiler adapter example"/>
</target>
<target name="test-ajc-aspectj"
depends="init-variables,init-aspectj-available,init-sources-available">
<antcall target="do-run-ant">
<param name="ant.dir"
location="${aspectj.modules.dir}/tests/product/build-aspectj"/>
<param name="run.ant.file" value="build.xml"/>
<param name="ant.target" value=""/>
<param name="ant.output"
location="${aj.build.log.dir}/test-ajc-aspectj"/>
</antcall>
<delete quiet="on" dir="${aspectj.modules.dir}/tests/product/build-aspectj/output"/>
</target>
<!-- ==== source tests ==== -->
<target name="test-sources">
<antcall target="do-13-target">
<param name="do.target" value="do-test-sources-sequence"/>
</antcall>
<antcall target="do-14-target">
<param name="do.target" value="do-test-sources-sequence"/>
</antcall>
</target>
<target name="do-test-sources-sequence">
<antcall target="test-harness-tests"/>
<antcall target="test-junit-modules"/>
</target>
<target name="test-junit-modules"
depends="init-variables,init-junitTests-available">
<antcall target="do-run-ant">
<param name="run.ant.file" value="junitModules.xml"/>
<param name="ant.target" value=""/>
<param name="ant.dir"
location="${aspectj.modules.dir}/tests"/>
<param name="ant.output"
location="${aj.build.log.dir}/test-junitModules"/>
</antcall>
<property file="${java.home.file}"/>
<property name="tjm.copy.todir"
location="${aj.build.log.dir}/junitXmlOutput-${build.java.version}"/>
<mkdir dir="${tjm.copy.todir}"/>
<delete quiet="on">
<fileset dir="${tjm.copy.todir}" includes="**/*"/>
</delete>
<property name="xmlSrcDir"
location="${aspectj.tests.dir}/bin/junitXmlOutput"/>
<move todir="${tjm.copy.todir}" >
<fileset dir="${xmlSrcDir}" includes="**/*"/>
</move>
</target>
<target name="test-harness-tests" depends="init-harness-available">
<!-- we could use harness variants, e.g., "-emacssym-",
but separating runs puts each variant in a different
output file, which makes them easier to analyze.
-->
<antcall target="do-run-harness">
<param name="suite.filename" value="ajcHarnessTests"/>
<param name="harness.args" value="-ajctestSkipKeywords=expect-fail"/>
<param name="harness.suffix" value="-pass"/>
</antcall>
<antcall target="do-run-harness">
<param name="suite.filename" value="ajcTestsFailing"/>
<param name="harness.args" value=""/>
<param name="harness.suffix" value=""/>
</antcall>
<antcall target="do-run-harness">
<param name="suite.filename" value="ajcTestsFailing"/>
<param name="harness.args" value="-emacssym"/>
<param name="harness.suffix" value="-emacssym"/>
</antcall>
<antcall target="do-run-harness">
<param name="suite.filename" value="ajcTests"/>
<param name="harness.args" value=""/>
<param name="harness.suffix" value=""/>
</antcall>
<antcall target="do-run-harness">
<param name="suite.filename" value="ajcTests"/>
<param name="harness.args" value="-emacssym"/>
<param name="harness.suffix" value="-emacssym"/>
</antcall>
<antcall target="do-run-harness">
<param name="suite.filename" value="ajcTests"/>
<param name="harness.args" value="-ajctaskCompiler -ajctestSkipKeywords=knownLimitation-ajctaskCompiler"/>
<param name="harness.suffix" value="-ajctaskCompiler"/>
</antcall>
<!-- examples tested only from command-line, eclipse -->
<antcall target="do-run-harness">
<param name="suite.filename" value="ajcTestsExamples"/>
<param name="harness.args" value=""/>
<param name="harness.suffix" value=""/>
</antcall>
<antcall target="do-run-harness">
<param name="suite.filename" value="ajcTestsExamples"/>
<param name="harness.args" value="-ajctaskCompiler"/>
<param name="harness.suffix" value="-ajctaskCompiler"/>
</antcall>
<!-- skip examples -emacssym - avoid littering docs tree -->
<!-- AJDE compiler hangs when done - unclose swing thread?
<antcall target="do-run-harness">
<param name="suite.filename" value="ajcTests"/>
<param name="harness.args" value="-ajdeCompiler -ajctestSkipKeywords=knownLimitations-ajdeCompiler"/>
<param name="harness.suffix" value="-ajdeCompiler"/>
</antcall>
-->
</target>
<!-- ======= do-{...} tasks are called only by other tasks ======== -->
<target name="do-run-harness"
depends="init-variables,init-harness-available">
<fail unless="suite.filename"
message="define suite.filename"/>
<fail unless="harness.args"
message="define harness.args"/>
<fail unless="harness.suffix"
message="define harness.suffix"/>
<property name="drho.default.options"
value="-release -logFail -killTemp"/>
<property file="${java.home.file}"/>
<fail unless="build.java.home"
message="failed to read ${build.java.home} from ${java.home.file}"/>
<fail unless="build.java.version"
message="failed to read ${build.java.version} from ${java.home.file}"/>
<property name="harness.output.file"
location="${aj.build.log.dir}/test-${suite.filename}${harness.suffix}-${build.java.version}.txt"/>
<echo>
do-run-harness ${suite.filename}.xml
with options ${drho.default.options} ${harness.args}
to ${harness.output.file}
</echo>
<java
fork="true"
dir="${aspectj.tests.dir}"
jar="${harness.jar}"
jvm="${build.java.command}"
maxmemory="250m"
output="${harness.output.file}">
<arg value="${suite.filename}.xml"/>
<arg line="${drho.default.options} ${harness.args}"/>
</java>
</target>
<target name="do-build-installed-example" depends="init-variables">
<antcall target="do-run-ant">
<param name="ant.dir"
location="${aj.build.install.dir}/doc/examples"/>
<param name="run.ant.file" value="build.xml"/>
<param name="ant.target" value="${example.target}"/>
<param name="ant.output"
location="${aj.build.log.dir}/test-example-${example.target}"/>
<param name="ant.properties" value=""/>
<!-- XXX getting OOMemory - permit and investigate -->
<param name="failonerror" value="false"/>
</antcall>
</target>
<target name="do-aspectj-build" depends="init-variables"
description="build targets in ../build.xml using Java 1.3">
<fail unless="do.ant.target" message="caller sets do.ant.target"/>
<fail unless="do.ant.props" message="caller sets do.ant.props"/>
<antcall target="do-java13-setup"/>
<antcall target="do-run-ant">
<param name="ant.dir" location="${aspectj.build.dir}"/>
<param name="run.ant.file" value="build.xml"/>
<param name="ant.target" value="${do.ant.target}"/>
<param name="ant.output"
location="${aj.build.log.dir}/build-${do.ant.target}"/>
<param name="ant.properties" value="${do.ant.props} ${aspectj.build.props}"/>
</antcall>
</target>
<target name="do-run-ant" depends="init-variables"
description="the ant we use to build">
<!-- we could use normal ant, but we enforce using
our ant libraries and the specified java runtime
-->
<fail unless="ant.target" message="define ant.target"/>
<fail unless="run.ant.file" message="define run.ant.file"/>
<!-- don't fail - set if not defined -->
<property name="ant.properties" value=""/>
<property file="${java.home.file}"/>
<fail unless="build.java.home"
message="failed to read ${build.java.home} from ${java.home.file}"/>
<fail unless="build.java.version"
message="failed to read ${build.java.version} from ${java.home.file}"/>
<property name="ant.output.file"
location="${ant.output}-${build.java.version}.txt"/>
<echo>
do-run-ant dir ${ant.dir}
file/target -f ${run.ant.file} ${ant.target}
options ${ant.verbose} ${ant.properties}
output ${ant.output.file}
</echo>
<java
fork="true"
dir="${ant.dir}"
jvm="${build.java.command}"
classname="org.apache.tools.ant.Main"
maxmemory="350m"
failonerror="${failonerror}"
newenvironment="true"
output="${ant.output.file}">
<classpath>
<fileset dir="${aspectj.ant.lib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${aspectj.lib.dir}/junit/junit.jar"/>
<pathelement location="${build.java.home}/lib/tools.jar"/>
</classpath>
<!-- urk - all properties for any client -->
<!-- for any build -->
<sysproperty key="JAVA_HOME" path="${build.java.home}"/>
<sysproperty key="ANT_HOME"
path="${aspectj.ant.home}"/>
<!-- for tests/junitModules.xml -->
<sysproperty key="aspectjrt.path"
file="${aj.build.install.dir}/lib/aspectjrt.jar"/>
<sysproperty key="test.classpath"
value="jar.classpath"/>
<!-- for tests/product/build-aspectj/build.xml -->
<sysproperty key="ASPECTJ_MODULES"
file="${aspectj.modules.dir}"/>
<sysproperty key="ASPECTJ_HOME"
file="${aj.build.install.dir}"/>
<arg line="-f ${run.ant.file} ${ant.target} ${ant.verbose} ${ant.properties}"/>
</java>
</target>
<target name="do-13-target" unless="run.14.only">
<antcall target="do-java13-setup"/>
<antcall target="${do.target}"/>
</target>
<target name="do-14-target" unless="run.13.only">
<antcall target="do-java14-setup"/>
<antcall target="${do.target}"/>
</target>
<target name="do-java14-setup">
<antcall target="do-write-javahome-file">
<param name="build.java.version" value="14"/>
<param name="build.java.home" value="${java14.home}"/>
</antcall>
</target>
<target name="do-java13-setup">
<antcall target="do-write-javahome-file">
<param name="build.java.version" value="13"/>
<param name="build.java.home" value="${java13.home}"/>
</antcall>
</target>
<target name="do-write-javahome-file" depends="init-variables"
description="save global build.java.[version,command,home]">
<fail unless="build.java.version"/>
<fail unless="build.java.home"/>
<property name="wjf.bjh" location="${build.java.home}"/>
<property name="wjf.cmd" location="${wjf.bjh}/bin/java"/>
<propertyfile file="${java.home.file}">
<entry key="build.java.version" value="${build.java.version}"/>
<entry key="build.java.home" value="${wjf.bjh}"/>
<entry key="build.java.command" value="${wjf.cmd}"/>
</propertyfile>
</target>
</project>
|