source: trunk/abcl/build.xml @ 11530

Last change on this file since 11530 was 11530, checked in by Mark Evenson, 14 years ago

'abcl.test' now invokes both Java and Lisp based tests.

First stab at a collected test infrastructure for ABCL using ASDF packaging.

Currently, only the GCL ANSI-TEST suite really works: create a sibling
directory to the 'abcl' top-level directory called 'ansi-tests' to get
them to run automagically.

  • Property svn:eol-style set to LF
File size: 15.7 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="antlib:org.apache.tools.ant"
3   name="abcl-master" default="help" basedir=".">
4    <description>Armed Bear Common Lisp</description>
5
6    <target name="abcl" depends="abcl.wrapper"/>
7
8    <property file="build.properties"/>
9
10    <property name="build.dir" 
11        value="${basedir}/build"/>
12    <property name="build.classes.dir" 
13        value="${build.dir}/classes"/>
14    <property name="src.dir" 
15        value="${basedir}/src"/>
16    <property name="dist.dir" 
17        value="${basedir}/dist"/>
18    <property name="abcl.jar.path"
19        value="${dist.dir}/abcl.jar"/>
20    <property name="abcl.ext.dir"
21        value="${basedir}/ext"/>
22
23
24    <target name="help">
25      <echo>Main Ant targets:
26 abcl.compile 
27   -- compile ABCL to ${build.classes.dir}.
28 abcl.jar     
29   -- create packaged ${abcl.jar.path}.
30 abcl.wrapper 
31   -- create executable wrapper for ABCL.
32 abcl.source.zip abcl.source.tar
33   -- create source distributions in ${dist.dir}.
34 acbl.test.java
35   -- Run junit tests under ${abcl.test.src.dir}.
36 abcl.clean
37   -- remove ABCL intermediate files</echo>
38      <echo>Corresponding targets for J have been removed.</echo>
39    </target>
40
41    <property name="abcl.version.path"
42        value="${build.classes.dir}/org/armedbear/lisp/version"/>
43    <property name="abcl.build.path"
44        value="${build.classes.dir}/org/armedbear/lisp/build"/>
45
46    <target name="abcl.stamp" depends="abcl.compile">
47      <tstamp>
48         <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
49      </tstamp>
50      <mkdir dir="${abcl.build.path}/.."/>
51      <echo message="${build}" file="${abcl.build.path}"/>   
52      <condition property="unix"> 
53  <or>
54    <os family="unix"/>
55    <os family="mac"/>
56  </or>
57      </condition>
58
59      <condition property="windows"> <os family="windows"/></condition>
60
61      <available file="${src.dir}org/armedbear/lisp/Interpreter.java" 
62     property="abcl.lisp.p"/>
63
64      <antcall target="abcl.stamp.version"/>
65      <antcall target="abcl.stamp.hostname"/>
66    </target>
67
68    <target name="abcl.stamp.version" depends="abcl.compile">
69      <java fork="true"
70      classpath="${build.classes.dir}"
71      outputproperty="abcl.version"
72      classname="org.armedbear.lisp.Main">
73  <arg value="--noinit"/>
74  <arg value="--noinform"/>
75  <arg value="--eval"/>
76  <arg value="(progn (format t (lisp-implementation-version)) (finish-output) (quit))"/>
77      </java>
78
79      <echo>Building ABCL version: ${abcl.version}</echo>
80      <mkdir dir="${abcl.version.path}/.."/>
81      <echo message="${abcl.version}" file="${abcl.version.path}"/> 
82
83      <!-- Set from commandline via -D or in 'build.properties' -->
84      <property name="build.version" value="abcl.svn"/>
85      <echo>Implementation-Source: ${version.src}</echo>
86    </target>
87
88    <target name="abcl.stamp.hostname">
89      <exec executable="hostname" outputproperty="abcl.hostname"/>
90      <echo>abcl.hostname: ${abcl.hostname}</echo>
91    </target>
92
93    <patternset id="abcl.source.java">
94      <include name="org/armedbear/lisp/*.java"/>
95      <include name="org/armedbear/lisp/util/*.java"/>
96    </patternset>
97
98    <patternset id="abcl.source.lisp">
99      <include name="org/armedbear/lisp/*.lisp"/>
100      <include name="org/armedbear/lisp/tests/*.lisp"/>
101    </patternset>
102
103    <patternset id="abcl.scripting.source.java">
104      <include name="org/armedbear/lisp/scripting/*.java"/>
105      <include name="org/armedbear/lisp/scripting/util/*.java"/>
106    </patternset>
107
108    <patternset id="abcl.scripting.source.lisp">
109      <include name="org/armedbear/lisp/scripting/lisp/*.lisp"/>
110    </patternset>
111
112    <!-- Lisp files required at runtime -->
113    <patternset id="abcl.source.lisp.dist">
114      <include name="org/armedbear/lisp/boot.lisp"/>
115    </patternset>
116
117    <patternset id="abcl.objects">
118      <include name="org/armedbear/lisp/*.class"/>
119      <include name="org/armedbear/lisp/util/*.class"/>
120      <include name="org/armedbear/lisp/*.cls"/> 
121      <include name="org/armedbear/lisp/*.abcl"/>
122      <patternset refid="abcl.source.lisp.dist"/>
123    </patternset>
124   
125    <path id="abcl.classpath.dist">
126      <pathelement location="${abcl.jar.path}"/>
127    </path>
128   
129    <path id="abcl.classpath.build">
130      <pathelement location="${build.classes.dir}"/>
131    </path>
132
133    <target name="abcl.compile" depends="abcl.pre-compile,abcl.compile.lisp">
134      <echo>Compiled ABCL with java version: ${java.version}</echo>
135    </target>
136
137    <target name="abcl.pre-compile">
138      <!--- antversion fails in ant 1.7.1 <antversion property="ant.version"
139                                                atleast="1.7"/> -->
140      <mkdir dir="${build.dir}"/>
141      <mkdir dir="${build.classes.dir}"/>
142
143      <property name="java.path"
144    value="${java.home}/bin/java"/>
145
146      <exec executable="hostname" os="unix" 
147      outputproperty="abcl.compile.hostname"/>
148      <exec executable="uname" os="unix" 
149      outputproperty="abcl.compile.uname">
150  <arg value="-a"/>
151      </exec>
152
153      <exec executable="hostname" os="Linux" outputproperty="hostname"/>
154
155      <condition property="abcl.java.version">
156  <or>
157    <matches string="${java.version}" pattern="1\.5"/>
158    <matches string="${java.version}" pattern="1\.6\.0_1[0-9]"/>
159  </or> 
160      </condition>
161      <echo>java.version: ${java.version}</echo>
162    </target>
163   
164    <target name="abcl.java.warning" 
165      depends="abcl.pre-compile"
166      unless="abcl.java.version">
167      <echo>WARNING: Java version ${java.version} not recommended.</echo>
168    </target>
169 
170    <target name="abcl.compile.java" 
171      depends="abcl.pre-compile,abcl.java.warning">
172      <tstamp>
173  <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
174      </tstamp>
175
176      <javac destdir="${build.classes.dir}"
177       debug="true"
178       target="1.5">
179  <src path="${src.dir}"/>
180  <patternset refid="abcl.source.java"/>
181      </javac>
182      <echo message="${build}" 
183      file="${build.classes.dir}/org/armedbear/lisp/build"/>
184    </target>
185
186    <target name="abcl.copy.lisp">
187      <copy todir="${build.classes.dir}" preservelastmodified="yes">
188  <fileset dir="${src.dir}">
189    <patternset refid="abcl.source.lisp"/>
190  </fileset>
191      </copy>
192    </target>
193
194    <!-- Adjust the patternset for ABCL source to use the much faster
195         Ant 'uptodate' task to check if we need to compile the system
196         fasls. -->
197    <patternset id="abcl.source.lisp.fasls">
198      <patternset refid="abcl.source.lisp"/>
199      <exclude name="org/armedbear/lisp/tests/*.lisp"/>
200      <exclude name="org/armedbear/lisp/boot.lisp"/>
201      <exclude name="org/armedbear/lisp/emacs.lisp"/>
202      <exclude name="org/armedbear/lisp/runtime-class.lisp"/>
203      <exclude name="org/armedbear/lisp/run-benchmarks.lisp"/>
204    </patternset>
205
206    <target name="abcl.fasls.uptodate">
207      <uptodate property="abcl.fasls.uptodate.p" value="true">
208  <srcfiles dir="${build.classes.dir}">
209    <patternset refid="abcl.source.lisp.fasls"/>
210  </srcfiles>
211  <mapper type="glob" from="*.lisp" to="*.abcl"/>
212      </uptodate>
213    </target>
214   
215    <target name="abcl.compile.lisp" 
216      depends="abcl.copy.lisp,abcl.compile.java,abcl.fasls.uptodate"
217      unless="abcl.fasls.uptodate.p">
218      <java classpath="${build.classes.dir}"
219      fork="true"
220      classname="org.armedbear.lisp.Main">
221  <arg value="--noinit"/>
222  <arg value="--eval"/>
223  <arg value="(compile-system :zip nil :quit t)"/>
224      </java>
225    </target>
226
227    <target name="abcl.jar" depends="abcl.compile,abcl.stamp">
228      <mkdir dir="${dist.dir}"/>
229      <loadfile property="abcl.version"
230      srcFile="${abcl.version.path}"/>
231      <jar destfile="${abcl.jar.path}"
232     compress="true"
233     basedir="${build.classes.dir}">
234  <patternset refid="abcl.objects"/>
235  <manifest>
236    <attribute name="Main-Class" value="org.armedbear.lisp.Main"/>
237    <section name="org/armedbear/lisp">
238      <attribute name="Implementation-Title" 
239           value="ABCL"/>
240      <attribute name="Implementation-Version" 
241           value="${abcl.version}"/>
242      <attribute name="Implementation-Build" 
243           value="${build}"/>
244      <attribute name="Build-Version" 
245           value="${version}"/>
246    </section>
247  </manifest>
248      </jar>
249    </target>
250   
251    <target name="abcl.debug.jpda" depends="abcl.jar">
252      <description>Invoke ABCL with JPDA listener on port 6789</description>
253      <java fork="true"
254      classpathref="abcl.classpath.dist"
255      classname="org.armedbear.lisp.Main">
256  <jvmarg 
257      value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
258      </java>
259    </target>
260
261    <target name="abcl.run" depends="abcl.jar">
262      <java fork="true"
263      classpathref="abcl.classpath.dist"
264      classname="org.armedbear.lisp.Main">
265      </java>
266    </target>
267
268    <target name="abcl.wrapper" 
269      depends="abcl.jar,abcl.wrapper.unix,abcl.wrapper.windows">
270      <description>
271  Creates in-place exectuable shell wrapper in '${abcl.wrapper.file}'
272      </description>
273      <!-- Set from commandline or in 'build.properties' -->
274      <property name="additional.jars" value=""/>
275      <path id="abcl.runtime.classpath">
276  <pathelement location="${abcl.jar.path}"/>
277  <pathelement path="${additional.jars}"/>
278      </path>
279      <!-- set via '-Djava.options=JAVA_OPTIONS' or in 'build.properties -->
280      <property name="java.options" value=""/>
281
282      <copy file="${abcl.wrapper.in.file}" toFile="${abcl.wrapper.file}" overwrite="yes">
283  <filterset>
284    <filter token="JAVA" 
285      value="${java.path}"/>
286    <filter token="ABCL_JAVA_OPTIONS" 
287      value= "${java.options}"/>
288    <filter token="ABCL_LIBPATH" 
289      value="${basedir}/src/org/armedbear/lisp/libabcl.so"/>
290    <filter token="ABCL_CLASSPATH" 
291      value="${toString:abcl.runtime.classpath}"/>
292  </filterset>
293      </copy>
294      <chmod file="${abcl.wrapper.file}" perm="a+x"/>
295      <echo>N.B. This wrapper requires '${abcl.jar.path}' not be moved.</echo>
296    </target>
297
298    <target name="abcl.wrapper.unix" if="unix">
299      <property name="abcl.wrapper.file" value="abcl"/>
300      <property name="abcl.wrapper.in.file" value="abcl.in"/>
301    </target>
302
303    <target name="abcl.wrapper.windows" if="windows">
304      <property name="abcl.wrapper.file" value="abcl.bat"/>
305      <property name="abcl.wrapper.in.file" value="abcl.bat.in"/>
306    </target>
307
308    <target name="abcl.clean">
309      <delete dir="${build.dir}"/>
310      <delete file="abcl"/>
311    </target>
312
313    <target name="abcl.dist" depends="abcl.jar">
314      <copy file="${abcl.jar.path}"
315      toFile="${dist.dir}/abcl-${abcl.version}.jar"/>
316    </target>
317
318    <target name="abcl.distclean" depends="abcl.clean">
319      <delete dir="${dist.dir}"/>
320      <delete file="abcl"/>
321      <delete file="j"/>
322    </target>
323
324    <target name="TAGS">
325      <apply executable="etags" parallel="true" verbose="true">
326  <fileset dir="${src.dir}">
327    <patternset refid="abcl.source.java"/>
328    <patternset refid="abcl.source.lisp"/>
329  </fileset>
330      </apply>
331    </target>
332
333    <patternset id="abcl.dist.misc"
334    description="Additional includes in the source distributions relative to basedir">
335      <include name="build.xml"/>
336      <include name="build.properties.in"/>
337      <include name="COPYING"/>
338      <include name="README"/>
339      <include name="abcl.in"/>
340      <include name="abcl.bat.in"/>
341     
342      <!-- The remainder of these files are used by BUILD-ABCL to
343           build ABCL from Lisp but not used by Ant, include them in
344           the source distribution. -->
345      <include name="make-jar.in"/>
346      <include name="make-jar.bat.in"/>
347
348      <include name="build-abcl.lisp"/>
349      <include name="customizations.lisp.in"/>
350
351      <include name="test-abcl.asd"/>
352      <include name="build-abcl.asd"/>
353    </patternset>
354
355    <patternset id="abcl.source.misc"
356    description="Additional includes in the source distribution relative to source root">
357      <include name="org/armedbear/lisp/LICENSE"/>
358      <include name="manifest-abcl"/>
359    </patternset>
360   
361    <target name="abcl.source.prepare" depends="abcl.stamp.version">
362      <property name="abcl.source.eol" value="asis"/>
363      <echo>Using '${abcl.source.eol}' to drive line-ending transformations.</echo>
364      <property name="abcl.build.src.dir"
365    value="${build.dir}/abcl-src-${abcl.version}"/>
366      <mkdir dir="${abcl.build.src.dir}/src"/>
367      <fixcrlf srcdir="${src.dir}" 
368         eol="${abcl.source.eol}"
369         destdir="${abcl.build.src.dir}/src"
370         preservelastmodified="true">
371  <patternset refid="abcl.source.java"/>
372  <patternset refid="abcl.source.lisp"/>
373  <patternset refid="abcl.source.misc"/>
374      </fixcrlf>
375      <fixcrlf srcdir="${basedir}" 
376         eol="${abcl.source.eol}"
377         destdir="${abcl.build.src.dir}"
378         preservelastmodified="true">
379  <patternset refid="abcl.dist.misc"/>
380      </fixcrlf>
381    </target>
382
383    <target name="abcl.source.tar" depends="abcl.source.prepare">
384      <mkdir dir="${dist.dir}"/>
385      <tar destfile="${dist.dir}/abcl-src-${abcl.version}.tar.gz"
386     compression="gzip">
387  <tarfileset dir="${build.dir}">
388    <include name="abcl-src-${abcl.version}/**"/>
389  </tarfileset>
390      </tar>
391    </target>
392
393    <target name="abcl.source.zip" depends="abcl.source.prepare">
394      <mkdir dir="${dist.dir}"/>
395      <zip destfile="${dist.dir}/abcl-src-${abcl.version}.zip"
396     compress="true">
397  <zipfileset dir="${abcl.build.src.dir}" prefix="abcl-src-${abcl.version}"/>
398      </zip>
399    </target>
400
401    <property name="abcl.test.classes.dir"
402        value="${build.dir}/classes-test"/>
403
404    <property name="abcl.test.src.dir"
405        value="${basedir}/test/src"/>
406
407    <patternset id="abcl.test.source.java">
408      <!-- For now, we list tests explicitly, because we have to
409           enumerate them later to the JUnit test runner. -->
410      <include name="org/armedbear/lisp/FastStringBufferTest.java"/>
411    </patternset>
412
413    <property name="junit-4.5.path"
414        value="${abcl.ext.dir}/junit-4.5.jar"/>
415
416    <path id="abcl.test.compile.classpath">
417      <pathelement location="${junit-4.5.path}"/>
418      <pathelement location="${build.classes.dir}"/>
419    </path>
420
421    <target name="abcl.test.pre-compile">
422      <mkdir dir="${abcl.ext.dir}"/>
423      <get src="http://downloads.sourceforge.net/junit/junit-4.5.jar?modtime=1218209625"
424     usetimestamp="true"
425    dest="${junit-4.5.path}"/>
426    </target>
427 
428    <target name="abcl.test.compile" depends="abcl.test.pre-compile,abcl.compile">
429      <mkdir dir="${abcl.test.classes.dir}"/>
430      <javac destdir="${abcl.test.classes.dir}"
431       classpathref="abcl.test.compile.classpath"
432       debug="true"
433       target="1.5">
434  <src path="${abcl.test.src.dir}"/>
435  <patternset refid="abcl.test.source.java"/>
436      </javac>
437    </target>
438
439    <path id="abcl.test.run.classpath">
440      <path refid="abcl.test.compile.classpath"/>
441      <pathelement location="${abcl.test.classes.dir}"/>
442    </path>
443
444    <target name="abcl.test" depends="abcl.test.java,abcl.test.lisp"/>
445 
446    <target name="abcl.test.java" depends="abcl.test.compile">
447      <java fork="true"
448      classpathref="abcl.test.run.classpath"
449      classname="org.junit.runner.JUnitCore">
450  <arg value="org.armedbear.lisp.FastStringBufferTest"/>
451      </java>
452    </target>
453
454    <target name="abcl.test.lisp" depends="abcl.test.lisp.asdf"/>
455
456    <target name="abcl.test.lisp.asdf" depends="abcl.jar">
457    </target>
458
459    <target name="abcl.test.ansi.interpreted">
460      <java fork="true"
461      classpathref="abcl.classpath.dist"
462      classname="org.armedbear.lisp.Main">
463  <arg value="--noinit"/>
464  <arg value="--load scripts/ansi-tests-interpreted.lisp "/>
465      </java>
466    </target>
467
468    <target name="abcl.test.ansi.interpreted">
469      <java fork="true"
470      classpathref="abcl.classpath.dist"
471      classname="org.armedbear.lisp.Main">
472  <arg value="--noinit"/>
473  <arg value="--load scripts/ansi-tests-compiled.lisp "/>
474      </java>
475    </target>
476
477
478    <import file="netbeans-build.xml" optional="true"/> 
479<!--    <import file="j-build.xml" optional="true"/>  -->
480    <import file="not.org-build.xml" optional="true"/> 
481</project>
482
Note: See TracBrowser for help on using the repository browser.