source: branches/0.14.x/abcl/build.xml

Last change on this file was 11741, checked in by ehuelsmann, 15 years ago

Backport r11740.

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