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
|
<!-- ========================================================================= -->
<!-- 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="test" basedir=".">
<!-- ========================================================================= -->
<target name="info">
<echo>
This downloads and builds the AspectJ source tree:
- checkout entire tree
- build distribution
- install distribution
- test
- ajcTests.xml ajc/harness tests in the build
- junitModules.xml junit tests in the build
- build installed examples
... and more
Targets of note:
install checkout, build, and install AspectJ
test (default) test AspectJ sources and installation
Properties of note (flags and default values):
-- flags to control
skip.cvs no CVS checkout (done already)
skip.build no build (done already)
skip.build.release no build of release
skip.build.tests no build of tests
version set if not DEVELOPMENT
-- locations to re-use existing tree or install
aspectj.workspace location for new cvs tree
aspectj.modules.dir location for existing cvs tree
aj.build.install.dir location for installed distribution
Trails
- clean first
cd build
ant clean
- test only sources in local tree (junit and harness tests):
cd build/release
ant test-sources \
-Dskip.cvs=true \
-Daspectj.modules.dir=../..
- build local tree and install distribution:
cd build/release
ant install \
-Dskip.cvs=true \
-Daspectj.modules.dir=../..
- test installation and sources in local tree:
cd build/release
ant test \
-Dskip.cvs=true \
-Daspectj.modules.dir=../.. \
-Dskip.build=true
- do everything but checkout from cvs:
cd build
ant clean
cd release
ant all \
-Dskip.cvs=true \
-Daspectj.modules.dir=../..
</echo>
</target>
<target name="init-variables">
<property name="version" value="DEVELOPMENT"/>
<property name="ant.verbose" value=""/>
<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.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"/>
<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="java.command"
location="${java.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="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="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="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="tests-available" depends="init-variables"
unless="tests.available">
<available property="tests.available"
classname="AjbrowserModuleTests">
<classpath>
<path refid="jar.classpath"/>
<path location="${aspectj.lib.dir}/junit/junit.jar"/>
</classpath>
</available>
<fail unless="tests.available"
message="test classe not found - first build-tests"/>
</target>
<!-- ========================================================================= -->
<target name="install" depends="build,init-variables"
description="create an AspectJ source tree">
<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="build" depends="init-variables"
description="build an AspectJ release and tests"
unless="skip.build">
<antcall target="build-release"/>
<antcall target="build-tests"/>
</target>
<target name="build-release" depends="init-variables,create-tree"
description="build an AspectJ release"
unless="skip.build.release">
<antcall target="run-ant">
<param name="ant.dir" location="${aspectj.build.dir}"/>
<param name="run.ant.file" value="build.xml"/>
<param name="ant.target" value="clean"/>
<param name="ant.output"
location="${aj.build.log.dir}/build-clean.txt"/>
</antcall>
<!-- product built without testing classes -->
<antcall target="run-ant">
<param name="ant.dir" location="${aspectj.build.dir}"/>
<param name="run.ant.file" value="build.xml"/>
<param name="ant.target" value="aspectj"/>
<param name="ant.output"
location="${aj.build.log.dir}/build-aspectj.txt"/>
</antcall>
</target>
<target name="build-tests" depends="init-variables,create-tree"
description="build AspectJ tests"
unless="skip.build.tests">
<!-- now build with testing classes in jars -->
<antcall target="run-ant">
<param name="ant.dir" location="${aspectj.build.dir}"/>
<param name="run.ant.file" value="build.xml"/>
<param name="ant.target" value="clean-jars"/>
<param name="ant.output"
location="${aj.build.log.dir}/build-clean-jars.txt"/>
</antcall>
<antcall target="run-ant">
<param name="ant.dir" location="${aspectj.build.dir}"/>
<param name="run.ant.file" value="build.xml"/>
<param name="ant.target" value="build-testing-jars"/>
<param name="ant.output"
location="${aj.build.log.dir}/build-testing-jars.txt"/>
<param name="ant.properties"
value="-Dtrim.testing.default=false"/>
</antcall>
</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="all">
<antcall target="install"/>
<antcall target="test"/>
</target>
<target name="test" depends="test-sources,test-install"/>
<target name="test-sources"
depends="init-variables,tests-available">
<!-- these require only sources and built tree -->
<antcall target="junit-module-tests"/>
<antcall target="run-harness-tests"/>
</target>
<target name="test-install"
depends="init-variables,aspectj-available">
<antcall target="compile-aspectj-using-aspectj"/>
<antcall target="build-examples"/>
</target>
<target name="junit-module-tests"
depends="init-variables,aspectj-available">
<echo message="need to build all with -Dtrim.testing.default=false"/>
<antcall target="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}/build-junitModules.txt"/>
</antcall>
<mkdir dir="${aj.build.log.dir}/junitXmlOutput"/>
<delete quiet="on">
<fileset dir="${aj.build.log.dir}/junitXmlOutput"
includes="*"/>
</delete>
<property name="xmlSrcDir"
location="${aspectj.tests.dir}/bin/junitXmlOutput"/>
<copy todir="${aj.build.log.dir}/junitXmlOutput"
filtering="off">
<fileset dir="${xmlSrcDir}" includes="**/*"/>
</copy>
</target>
<target name="build-examples"
depends="init-variables,aspectj-available">
<antcall target="build-one-example">
<param name="example.target" value="nonGui"/>
</antcall>
<antcall target="build-one-example">
<param name="example.target" value="tracing-bc"/>
</antcall>
<echo message="Also setup and run compiler adapter example"/>
</target>
<target name="build-one-example" depends="init-variables">
<ant dir="${aj.build.install.dir}/doc/examples"
inheritAll="false"
target="${example.target}"
output="${aj.build.log.dir}/example-${example.target}.txt"
/>
</target>
<target name="compile-aspectj-using-aspectj"
depends="init-variables,sources-available">
<echo message="WARNING: output dir created in tests/product/build-aspectj"/>
<antcall target="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}/build-aspectj-using-aspectj.txt"/>
</antcall>
</target>
<target name="run-harness-tests" depends="aspectj-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="run-harness-once">
<param name="suite.filename" value="ajcHarnessTests"/>
<param name="harness.args" value=""/>
<param name="harness.suffix" value=""/>
</antcall>
<antcall target="run-harness-once">
<param name="suite.filename" value="ajcTestsFailing"/>
<param name="harness.args" value=""/>
<param name="harness.suffix" value=""/>
</antcall>
<antcall target="run-harness-once">
<param name="suite.filename" value="ajcTestsFailing"/>
<param name="harness.args" value="-emacssym"/>
<param name="harness.suffix" value="-emacssym"/>
</antcall>
<antcall target="run-harness-once">
<param name="suite.filename" value="ajcTests"/>
<param name="harness.args" value=""/>
<param name="harness.suffix" value=""/>
</antcall>
<antcall target="run-harness-once">
<param name="suite.filename" value="ajcTests"/>
<param name="harness.args" value="-emacssym"/>
<param name="harness.suffix" value="-emacssym"/>
</antcall>
<antcall target="run-harness-once">
<param name="suite.filename" value="ajcTests"/>
<param name="harness.args" value="-ajctaskCompiler -ajctestSkipKeywords=knownLimitations-ajctaskCompiler"/>
<param name="harness.suffix" value="-ajctaskCompiler"/>
</antcall>
</target>
<!-- move when tested -->
<target name="run-harness-ajctaskCompiler"
depends="init-variables">
<antcall target="run-harness-once">
<param name="suite.filename" value="ajcTests"/>
<param name="harness.args" value="-ajctaskCompiler -ajctestSkipKeywords=knownLimitation-ajctaskCompiler"/>
<param name="harness.suffix" value="-ajctaskCompiler"/>
</antcall>
</target>
<target name="run-harness-once"
depends="init-variables,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="rho.default.options"
value="-release -logFail -killTemp"/>
<property name="harness.output.file"
location="${aj.build.log.dir}/${suite.filename}${harness.suffix}.txt"/>
<echo>
run-harness-once ${suite.filename}.xml
with options ${rho.default.options} ${harness.args}
to ${harness.output.file}
</echo>
<java
fork="true"
dir="${aspectj.tests.dir}"
jar="${harness.jar}"
maxmemory="250m"
output="${harness.output.file}">
<arg value="${suite.filename}.xml"/>
<arg line="${rho.default.options} ${harness.args}"/>
</java>
</target>
<target name="run-ant" depends="init-variables"
description="the ant we use to build">
<!-- we could use normal ant, but we enforce using ours
<ant dir="${aspectj.build.dir}"
target="clean"
inheritAll="false"/>
-->
<fail unless="ant.target" message="define ant.target"/>
<fail unless="run.ant.file" message="define run.ant.file"/>
<!-- fail unless="ant.properties" message="define ant.properties"/-->
<!-- set if not defined -->
<property name="ant.properties" value=""/>
<echo message="ant output for ${run.ant.file} ${ant.target} goes to ${ant.output}"/>
<java
fork="true"
dir="${ant.dir}"
jvm="${java.command}"
classname="org.apache.tools.ant.Main"
maxmemory="350m"
failonerror="true"
newenvironment="true"
output="${ant.output}">
<classpath>
<fileset dir="${aspectj.ant.lib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${aspectj.lib.dir}/junit/junit.jar"/>
<pathelement path="${java.home}/lib/tools.jar"/>
<pathelement path="${java.home}/../lib/tools.jar"/>
</classpath>
<!-- urk - all properties for any client -->
<!-- for any build -->
<sysproperty key="JAVA_HOME" path="${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>
</project>
|