summaryrefslogtreecommitdiffstats
path: root/tests/product/ant-example.xml
blob: 1dda5c94482fba8c5b8b9ff5cada31fc97af3978 (plain)
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
<!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-     -->
<!--                                                                                -->
<!-- This file is part of the compiler and core tools for the AspectJ(tm)           -->
<!-- programming language; see http://aspectj.org                                   -->
<!--                                                                                -->
<!-- The contents of this file are subject to the Mozilla Public License            -->
<!-- Version 1.1 (the "License"); you may not use this file except in               -->
<!-- compliance with the License. You may obtain a copy of the License at           -->
<!-- either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.                 -->
<!--                                                                                -->
<!-- Software distributed under the License is distributed on an "AS IS" basis,     -->
<!-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License       -->
<!-- for the specific language governing rights and limitations under the           -->
<!-- License.                                                                       -->
<!--                                                                                -->
<!-- The Original Code is AspectJ.                                                  -->
<!--                                                                                -->
<!-- The Initial Developer of the Original Code is Xerox Corporation. Portions      -->
<!-- created by Xerox Corporation are Copyright (C) 1999, 2000 Xerox Corporation.   -->
<!-- All Rights Reserved.                                                           -->

<!-- todo: non-distribution license?? -->

<!DOCTYPE build SYSTEM "build.dtd">

<project name="ant-example" default="test" basedir=".">

    <!-- define target init.product -->
    &aspectj_initProduct;

    <!-- ========================================================================== -->
    <!-- Init                                                                       -->
    <!-- ========================================================================== -->
    <target name="init" depends="init.product"
     description="caller must define jdk.tools.jar and product.dir or run from product.dir">
      <echo message="init ant-examples.xml"/> 
      <!-- directory produced during test install -->
      <property name="ajx.base.dir"
            location="${productTest.output.dir}/ajx-output"/>
      <property name="ajx.expect.dir"
            location="${productTest.expect.dir}/ajx"/>
      <property name="noclass"
               value="noclass"/>
      <property name="noclass.dir"
            location="${productTest.output.dir}/${noclass}"/>
      <property name="aj.public.taskdef.package"
               value="org.aspectj.tools.ant.taskdef"/>
      <property name="taskdef.classpath"
               value="${product.taskdefs.jar}${PS}${product.tools.jar}${PS}${jdk.tools.jar}"/>
    </target>

    <target name="init.taskdefs" depends="init,product.taskdefs.jar,product.tools.jar">
      <!-- define taskdefs used here - requires jars, etc. -->
      <taskdef name="ajc"
          classname="${aj.public.taskdef.package}.Ajc" >
       <classpath>
          <pathelement path="${product.taskdefs.jar}"/>
          <pathelement path="${product.tools.jar}"/>
          <pathelement path="${jdk.tools.jar}"/>
       </classpath>
      </taskdef>
      <taskdef name="ajdoc"
          classname="${aj.public.taskdef.package}.Ajdoc">
       <classpath>
          <pathelement path="${product.taskdefs.jar}"/>
          <pathelement path="${product.tools.jar}"/>
          <pathelement path="${jdk.tools.jar}"/>
       </classpath>
      </taskdef>
    </target>


    <!-- ========================================================================== -->
    <!-- Clean everything in created dirs                                           -->
    <!-- ========================================================================== -->

    <target name="clean" depends="init"
     description="clean output created by this script">
      <antcall target="mkdir"><param name="dir" value="${ajx.base.dir}"/>
      </antcall>
      <antcall target="mkdir"><param name="dir" value="${noclass.dir}"/>
      </antcall>
    </target>

    <target name="noclass.setup" depends="init"
     description="setup no-op dummy class to invoke when test class n/a or requires gui">
      <echo file="${noclass}.java">
        public class ${noclass} { public static void main(String[]args){}}
      </echo>
      <mkdir dir="${noclass.dir}"/>
      <delete dir="${noclass.dir}"/>
      <mkdir dir="${noclass.dir}"/>
      <javac srcdir="." 
           includes="${noclass}.java" 
            destdir="${noclass.dir}"
        failonerror="true"/>
      <delete file="${noclass}.java"/>
      <echo message=" todo check file: ${noclass}.java"/>
      <java classname="${noclass}"
          failonerror="true" 
          classpath="${noclass.dir}"/>
    </target>

    <!-- ========================================================================== -->
    <!-- Run        tests                                                          -->
    <!-- ========================================================================== -->
    <target name="Ajx" depends="init.taskdefs"
       description="for {example}, compile {list}, doc {list}, and run {class}">
       <echo message="##### START Ajx example=${example} list=${list} class=${class}" />
        <property name="exdir" 
                 value="${ajx.base.dir}/${example}"/>
        <property name="expect.exdir" value="${ajx.expect.dir}/${example}"/>
        <mkdir  dir="${exdir}/classes"/>
        <mkdir  dir="${exdir}/output"/>
        <mkdir  dir="${exdir}/docs"/>
        <delete dir="${exdir}/classes"/>
        <delete dir="${exdir}/output"/>
        <delete dir="${exdir}/docs"/>
        <mkdir  dir="${exdir}/classes"/>
        <mkdir  dir="${exdir}/output"/>
        <mkdir  dir="${exdir}/docs"/>

        <echo message="##################### Ajx ajc ${list}"/>
        <ajc 
            destdir="${exdir}/classes"
           argfile="${list}" 
        failonerror="false" >
          <classpath>
            <pathelement location="${product.rt.jar}" />
            <pathelement location="${jdk.tools.jar}" /> <!-- to compile ajdoc -->
          </classpath>
        </ajc>
        <!-- copying resources, etc. as javac does todo weak -->
        <copy todir="${exdir}/classes">
            <fileset dir="${srcDir}" 
                includes="**/*.properties,**/*.gif,**/*.jpg,**/*.props" />
        </copy>

        <echo message="##################### Ajx ajdoc ${list} "/>
        <ajdoc  fork="yes"
            private="yes"
            verbose="yes"
            sourcepath="${product.examples.dir}"
            destdir="${exdir}/docs"
           argfile="${list}" 
           classpath="${product.rt.jar}${PS}${jdk.tools.jar}"
        failonerror="false" >
         <!-- internalclasspath 
           internalclasspath="${taskdef.classpath}" 
         is required now - but still not producing docs
          <classpath>
            <pathelement location="${product.rt.jar}" />
          </classpath>
        -->
        </ajdoc>

        <echo message="##################### Ajx run ${class} START - output in ${exdir}/output/out.txt"/>
        <java classname="${class}"
                 output="${exdir}/output/out.txt"
                   fork="yes"  
            failonerror="false" >
            <!-- fork because ajc does a System.exit -->
          <classpath>
            <pathelement location="${exdir}/classes"/>
            <pathelement location="${product.rt.jar}"/>
            <pathelement location="${noclass.dir}"/>
            <pathelement location="${jdk.tools.jar}" /> <!-- to run ajdoc and old ajc -->
          </classpath>
        </java>
        <echo message="##################### Ajx run ${class} STOP"/>
        <echo message="##################### Ajx run ${class} check output START "/>
        <comparefiles rhsFile="${exdir}/output/out.txt"
                      lhsFile="${expect.exdir}/output/out.txt"/>
        <echo message="##################### Ajx run ${class} check output STOP "/>
       <echo message="##### FINISH Ajx example=${example} list=${list} class=${class}" />
    </target>

    <target name="test" depends="test.examples,test.sources"/>

    <target name="test.sources" depends="init,noclass.setup,productTest.expect.dir"
      description="compile, doc, and run the tools-source targets using taskdefs" >
      <property name="tools.src.dir"
            location="${product.source.tools.dir}/src"/>
      <antcall target="Ajx">
        <param name="list"    value="${tools.src.dir}/runtime.lst"/>
        <param name="example" value="source-tools-runtime"/>
        <param name="class"   value="${noclass}"/>
        <param name="srcDir"  value="${tools.src.dir}"/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="${tools.src.dir}/ajc.lst"/>
        <param name="example" value="source-tools-ajc"/>
        <param name="class"   value="org.aspectj.tools.ajc.Main"/>
        <param name="srcDir"  value="${tools.src.dir}"/>
        <!-- ajc does a System.exit -->
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="${tools.src.dir}/tools.lst"/>
        <param name="example" value="source-tools-all"/>
        <param name="class"   value="${noclass}"/>
        <param name="srcDir"  value="${tools.src.dir}"/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="${tools.src.dir}/ajbrowser.lst"/>
        <param name="example" value="source-tools-ajbrowser"/>
        <param name="class"   value="${noclass}"/>
        <param name="srcDir"  value="${tools.src.dir}"/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="${tools.src.dir}/ajdoc.lst"/>
        <param name="example" value="source-tools-ajdoc"/>
        <param name="class"   value="org.aspectj.tools.ajdoc.Main"/>
        <param name="srcDir"  value="${tools.src.dir}"/>
      </antcall>
    </target>

    <target name="test.examples" depends="init,noclass.setup,productTest.expect.dir"
      description="compile, doc, and run the valid examples using taskdefs" >
      <antcall target="Ajx">
        <param name="list"    value="bean/files.lst"/>
        <param name="example" value="bean"/>
        <param name="class"   value="bean.Demo"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="coordination/lib.lst"/>
        <param name="example" value="coordination"/>
        <param name="class"   value="${noclass}"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="introduction/files.lst"/>
        <param name="example" value="introduction-point"/>
        <param name="class"   value="introduction.Point"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="introduction/files.lst"/>
        <param name="example" value="introduction-cloneablepoint"/>
        <param name="class"   value="introduction.CloneablePoint"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="introduction/files.lst"/>
        <param name="example" value="introduction-comparablepoint"/>
        <param name="class"   value="introduction.ComparablePoint"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="introduction/files.lst"/>
        <param name="example" value="introduction-hashablepoint"/>
        <param name="class"   value="introduction.HashablePoint"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="observer/files.lst"/>
        <param name="example" value="observer"/>
        <param name="class"   value="${noclass}"/>
        <param name="srcDir"  value="."/>
        <!-- uses gui: param name="class"   value="observer.Demo" -->
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="spacewar/debug.lst"/>
        <param name="example" value="spacewar-debug"/>
        <param name="class"   value="${noclass}"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="spacewar/demo.lst"/>
        <param name="example" value="spacewar-demo"/>
        <param name="class"   value="${noclass}"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="telecom/basic.lst"/>
        <param name="example" value="telecom-basic"/>
        <param name="class"   value="telecom.BasicSimulation"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="telecom/billing.lst"/>
        <param name="example" value="telecom-billing"/>
        <param name="class"   value="telecom.BillingSimulation"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="telecom/timing.lst"/>
        <param name="example" value="telecom-timing"/>
        <param name="class"   value="telecom.TimingSimulation"/>
        <param name="srcDir"  value="."/>
      </antcall>
    <!-- timeserver not in product - todo check 
      <antcall target="Ajx">
        <param name="list"    value="timeserver/abort.lst"/>
        <param name="example" value="timeserver-abort"/>
        <param name="class"   value="${noclass}"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="timeserver/retry.lst"/>
        <param name="example" value="timeserver-retry"/>
        <param name="class"   value="${noclass}"/>
        <param name="srcDir"  value="."/>
      </antcall>
     -->
      <antcall target="Ajx">
        <param name="list"    value="tjp/files.lst"/>
        <param name="example" value="tjp"/>
        <param name="class"   value="tjp.Demo"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="tracing/notrace.lst"/>
        <param name="example" value="tracing-none"/>
        <param name="class"   value="tracing.ExampleMain"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="tracing/tracelib.lst"/>
        <param name="example" value="tracing-ExampleMain"/>
        <param name="class"   value="tracing.ExampleMain"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="tracing/tracev1.lst"/>
        <param name="example" value="tracing-v1"/>
        <param name="class"   value="tracing.ExampleMain"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="tracing/tracev2.lst"/>
        <param name="example" value="tracing-v2"/>
        <param name="class"   value="tracing.ExampleMain"/>
        <param name="srcDir"  value="."/>
      </antcall>
      <antcall target="Ajx">
        <param name="list"    value="tracing/tracev3.lst"/>
        <param name="example" value="tracing-v3"/>
        <param name="class"   value="tracing.ExampleMain"/>
        <param name="srcDir"  value="."/>
      </antcall>
    </target>
</project>