source: trunk/abcl/build.xml @ 11590

Last change on this file since 11590 was 11590, checked in by astalla, 13 years ago

Merged the scripting branch, providing JSR-223 support and other new
features. JSR-233 is only built if the necessary javax.script.* classes
are found in the CLASSPATH.

  • Property svn:eol-style set to LF
File size: 17.0 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 Everson -->
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      <!--- antversion fails in ant 1.7.1 <antversion property="ant.version"
102                                                atleast="1.7"/> -->
103      <property name="java.path"
104    value="${java.home}/bin/java"/>
105
106      <!-- Deprecated. Two main types of build environents: 'unix' or 'windows'. -->
107      <condition property="unix"> 
108  <or>
109    <os family="unix"/>
110    <os family="mac"/>
111  </or>
112      </condition>
113      <condition property="windows"> 
114  <os family="windows"/>
115      </condition>
116
117      <!-- Deprecated. -->
118      <available file="${src.dir}org/armedbear/lisp/Interpreter.java" 
119     property="abcl.lisp.p"/>
120
121      <echo>java.version: ${java.version}</echo>
122      <condition property="abcl.java.version.p">
123  <or>
124    <matches string="${java.version}" pattern="1\.5"/>
125    <matches string="${java.version}" pattern="1\.6\.0_1[0-9]"/>
126  </or> 
127      </condition>
128
129      <!-- Set from commandline via -D or in 'build.properties' -->
130      <property name="build.version" value="abcl.svn"/>
131      <echo>Implementation-Source: ${version.src}</echo>
132
133    </target>
134   
135    <target name="abcl.java.warning" 
136      depends="abcl.init"
137      unless="abcl.java.version.p">
138      <echo>WARNING: Use of Java version ${java.version} not recommended.</echo>
139    </target>
140 
141    <target name="abcl.jsr-223.notice"
142      depends="abcl.init"
143      unless="abcl.jsr-223.p">
144      <echo>Notice: JSR-223 support won't be built since it is not supported, neither natively by your JVM nor by libraries in the CLASSPATH.</echo>
145    </target>
146
147    <target name="abcl.compile.java" 
148      depends="abcl.init,abcl.java.warning,abcl.jsr-223.notice">
149      <mkdir dir="${build.dir}"/>
150      <mkdir dir="${build.classes.dir}"/>
151      <javac destdir="${build.classes.dir}"
152       debug="true"
153       target="1.5">
154  <src path="${src.dir}"/>
155  <patternset refid="abcl.source.java"/>
156      </javac>
157      <echo message="${build}" 
158      file="${build.classes.dir}/org/armedbear/lisp/build"/>
159    </target>
160
161    <target name="abcl.copy.lisp">
162      <copy todir="${build.classes.dir}" preservelastmodified="yes">
163  <fileset dir="${src.dir}">
164    <patternset refid="abcl.source.lisp"/>
165  </fileset>
166      </copy>
167    </target>
168
169    <!-- Adjust the patternset for ABCL source to use the much faster
170         Ant 'uptodate' task to check if we need to compile the system
171         fasls.  Highly inter-dependent with the behavior specified in
172         'compile-system.lisp'.-->
173    <patternset id="abcl.source.lisp.fasls">
174      <patternset refid="abcl.source.lisp"/>
175      <exclude name="org/armedbear/lisp/tests/*.lisp"/>
176      <exclude name="org/armedbear/lisp/boot.lisp"/>
177      <exclude name="org/armedbear/lisp/emacs.lisp"/>
178      <exclude name="org/armedbear/lisp/runtime-class.lisp"/>
179      <exclude name="org/armedbear/lisp/run-benchmarks.lisp"/>
180    </patternset>
181
182    <target name="abcl.fasls.uptodate">
183      <uptodate property="abcl.fasls.uptodate.p" value="true">
184  <srcfiles dir="${build.classes.dir}">
185    <patternset refid="abcl.source.lisp.fasls"/>
186  </srcfiles>
187  <mapper type="glob" from="*.lisp" to="*.abcl"/>
188      </uptodate>
189    </target>
190   
191    <target name="abcl.compile.lisp" 
192      depends="abcl.copy.lisp,abcl.compile.java,abcl.fasls.uptodate"
193      unless="abcl.fasls.uptodate.p">
194      <java classpath="${build.classes.dir}"
195      fork="true"
196      classname="org.armedbear.lisp.Main">
197  <arg value="--noinit"/>
198  <arg value="--eval"/>
199  <arg value="(compile-system :zip nil :quit t)"/>
200      </java>
201    </target>
202
203    <property name="abcl.build.path"
204        value="${build.classes.dir}/org/armedbear/lisp/build"/>
205    <target name="abcl.stamp" depends="abcl.compile,abcl.stamp.version,abcl.stamp.hostname">
206      <mkdir dir="${abcl.build.path}/.."/>
207      <echo message="${build}" file="${abcl.build.path}"/>   
208    </target>
209
210    <property name="abcl.version.path"
211        value="${build.classes.dir}/org/armedbear/lisp/version"/>
212    <target name="abcl.stamp.version" depends="abcl.compile">
213      <!-- Determine which ABCL version we have just built by parsing
214           the output of LISP-IMPLEMENTATION-VERSION. -->
215      <java fork="true"
216      classpath="${build.classes.dir}"
217      outputproperty="abcl.version"
218      classname="org.armedbear.lisp.Main">
219  <arg value="--noinit"/>
220  <arg value="--noinform"/>
221  <arg value="--eval"/>
222  <arg value="(progn (format t (lisp-implementation-version)) (finish-output) (quit))"/>
223      </java>
224
225      <echo>Built ABCL version: ${abcl.version}</echo>
226      <mkdir dir="${abcl.version.path}/.."/>
227      <echo message="${abcl.version}" file="${abcl.version.path}"/> 
228    </target>
229
230    <target name="abcl.stamp.hostname" if="unix">
231      <exec executable="hostname" outputproperty="abcl.hostname"/>
232      <echo>abcl.hostname: ${abcl.hostname}</echo>
233    </target>
234
235    <target name="abcl.jar" depends="abcl.stamp">
236      <mkdir dir="${dist.dir}"/>
237      <loadfile property="abcl.version"
238      srcFile="${abcl.version.path}"/>
239      <jar destfile="${abcl.jar.path}"
240     compress="true"
241     basedir="${build.classes.dir}">
242  <patternset refid="abcl.objects"/>
243  <manifest>
244    <attribute name="Main-Class" value="org.armedbear.lisp.Main"/>
245    <section name="org/armedbear/lisp">
246      <attribute name="Implementation-Title" 
247           value="ABCL"/>
248      <attribute name="Implementation-Version" 
249           value="${abcl.version}"/>
250      <attribute name="Implementation-Build" 
251           value="${build}"/>
252      <attribute name="Implementation-Source" 
253           value="${version.src}"/>
254    </section>
255  </manifest>
256        <metainf dir="${src.dir}/META-INF">
257        </metainf>
258      </jar>
259    </target>
260   
261    <target name="abcl.wrapper" 
262      depends="abcl.jar,abcl.wrapper.unix,abcl.wrapper.windows">
263      <description>
264  Creates in-place exectuable shell wrapper in '${abcl.wrapper.file}'
265      </description>
266      <!-- Set from commandline or in 'build.properties' -->
267      <property name="additional.jars" value=""/>
268      <path id="abcl.runtime.classpath">
269  <pathelement location="${abcl.jar.path}"/>
270  <pathelement path="${additional.jars}"/>
271      </path>
272      <!-- set via '-Djava.options=JAVA_OPTIONS' or in 'build.properties -->
273      <property name="java.options" value=""/>
274
275      <copy file="${abcl.wrapper.in.file}" toFile="${abcl.wrapper.file}" overwrite="yes">
276  <filterset>
277    <filter token="JAVA" 
278      value="${java.path}"/>
279    <filter token="ABCL_JAVA_OPTIONS" 
280      value= "${java.options}"/>
281    <filter token="ABCL_LIBPATH" 
282      value="${basedir}/src/org/armedbear/lisp/libabcl.so"/>
283    <filter token="ABCL_CLASSPATH" 
284      value="${toString:abcl.runtime.classpath}"/>
285  </filterset>
286      </copy>
287      <chmod file="${abcl.wrapper.file}" perm="a+x"/>
288
289      <echo>Created executable ABCL wrapper in '${abcl.wrapper.file}'</echo>
290      <echo>N.B. This wrapper requires '${abcl.jar.path}' not be moved.</echo>
291    </target>
292
293    <target name="abcl.wrapper.unix" if="unix">
294      <property name="abcl.wrapper.file" value="abcl"/>
295      <property name="abcl.wrapper.in.file" value="abcl.in"/>
296    </target>
297
298    <target name="abcl.wrapper.windows" if="windows">
299      <property name="abcl.wrapper.file" value="abcl.bat"/>
300      <property name="abcl.wrapper.in.file" value="abcl.bat.in"/>
301    </target>
302
303    <target name="abcl.debug.jpda" depends="abcl.jar">
304      <description>Invoke ABCL with JPDA listener on port 6789</description>
305      <java fork="true"
306      classpathref="abcl.classpath.dist"
307      classname="org.armedbear.lisp.Main">
308  <jvmarg 
309      value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
310      </java>
311    </target>
312
313    <target name="abcl.run" depends="abcl.jar">
314      <java fork="true"
315      classpathref="abcl.classpath.dist"
316      classname="org.armedbear.lisp.Main">
317      </java>
318    </target>
319
320    <target name="abcl.clean">
321      <delete dir="${build.dir}"/>
322      <delete file="${abcl.jar.path}"/>
323      <delete file="abcl"/>
324      <delete file="abcl.bat"/>
325    </target>
326
327    <target name="abcl.dist" depends="abcl.jar">
328      <copy file="${abcl.jar.path}"
329      toFile="${dist.dir}/abcl-${abcl.version}.jar"/>
330    </target>
331
332    <target name="abcl.distclean" depends="abcl.clean">
333      <delete dir="${dist.dir}"/>
334      <delete file="abcl"/>
335      <delete file="abcl.bat"/>
336    </target>
337
338    <target name="TAGS">
339      <apply executable="etags" parallel="true" verbose="true">
340  <fileset dir="${src.dir}">
341    <patternset refid="abcl.source.java"/>
342    <patternset refid="abcl.source.lisp"/>
343  </fileset>
344      </apply>
345    </target>
346
347    <patternset id="abcl.dist.misc"
348    description="Additional includes in the source distributions relative to basedir">
349      <include name="build.xml"/>
350      <include name="build.properties.in"/>
351      <include name="COPYING"/>
352      <include name="README"/>
353      <include name="abcl.in"/>
354      <include name="abcl.bat.in"/>
355     
356      <!-- The remainder of these files are used by the Lisp hosted
357           build in 'build-abcl.lisp' but not used by Ant, so include
358           them in the source distribution. -->
359      <include name="make-jar.in"/>
360      <include name="make-jar.bat.in"/>
361
362      <include name="build-abcl.lisp"/>
363      <include name="customizations.lisp.in"/>
364
365      <include name="test-abcl.asd"/>
366      <include name="build-abcl.asd"/>
367    </patternset>
368
369    <patternset id="abcl.source.misc"
370    description="Additional includes in the source distribution relative to source root">
371      <include name="org/armedbear/lisp/LICENSE"/>
372      <include name="manifest-abcl"/>
373    </patternset>
374   
375    <target name="abcl.source.prepare" depends="abcl.stamp.version">
376      <property name="abcl.source.eol" value="asis"/>
377      <echo>Using abcl.source.eol='${abcl.source.eol}' to drive
378      source code line-ending transformations.</echo>
379      <property name="abcl.build.src.dir"
380    value="${build.dir}/abcl-src-${abcl.version}"/>
381      <mkdir dir="${abcl.build.src.dir}/src"/>
382      <fixcrlf srcdir="${src.dir}" 
383         eol="${abcl.source.eol}"
384         destdir="${abcl.build.src.dir}/src"
385         preservelastmodified="true">
386  <patternset refid="abcl.source.java"/>
387  <patternset refid="abcl.source.lisp"/>
388  <patternset refid="abcl.source.misc"/>
389      </fixcrlf>
390      <fixcrlf srcdir="${basedir}" 
391         eol="${abcl.source.eol}"
392         destdir="${abcl.build.src.dir}"
393         preservelastmodified="true">
394  <patternset refid="abcl.dist.misc"/>
395      </fixcrlf>
396    </target>
397
398    <target name="abcl.source.tar" depends="abcl.source.prepare">
399      <mkdir dir="${dist.dir}"/>
400      <tar destfile="${dist.dir}/abcl-src-${abcl.version}.tar.gz"
401     compression="gzip">
402  <tarfileset dir="${build.dir}">
403    <include name="abcl-src-${abcl.version}/**"/>
404  </tarfileset>
405      </tar>
406    </target>
407
408    <target name="abcl.source.zip" depends="abcl.source.prepare">
409      <mkdir dir="${dist.dir}"/>
410      <zip destfile="${dist.dir}/abcl-src-${abcl.version}.zip"
411     compress="true">
412  <zipfileset dir="${abcl.build.src.dir}" prefix="abcl-src-${abcl.version}"/>
413      </zip>
414    </target>
415
416    <property name="abcl.test.classes.dir"
417        value="${build.dir}/classes-test"/>
418
419    <property name="abcl.test.src.dir"
420        value="${basedir}/test/src"/>
421
422    <patternset id="abcl.test.source.java">
423      <!-- For now, we list tests explicitly, because we have to
424           enumerate them later to the JUnit test runner. -->
425      <include name="org/armedbear/lisp/FastStringBufferTest.java"/>
426    </patternset>
427
428    <property name="junit-4.5.path"
429        value="${abcl.ext.dir}/junit-4.5.jar"/>
430
431    <path id="abcl.test.compile.classpath">
432      <pathelement location="${junit-4.5.path}"/>
433      <pathelement location="${build.classes.dir}"/>
434    </path>
435
436    <target name="abcl.test.pre-compile">
437      <mkdir dir="${abcl.ext.dir}"/>
438      <get src="http://downloads.sourceforge.net/junit/junit-4.5.jar?modtime=1218209625"
439     usetimestamp="true"
440    dest="${junit-4.5.path}"/>
441    </target>
442 
443    <target name="abcl.test.compile" depends="abcl.test.pre-compile,abcl.compile">
444      <mkdir dir="${abcl.test.classes.dir}"/>
445      <javac destdir="${abcl.test.classes.dir}"
446       classpathref="abcl.test.compile.classpath"
447       debug="true"
448       target="1.5">
449  <src path="${abcl.test.src.dir}"/>
450  <patternset refid="abcl.test.source.java"/>
451      </javac>
452    </target>
453
454    <path id="abcl.test.run.classpath">
455      <path refid="abcl.test.compile.classpath"/>
456      <pathelement location="${abcl.test.classes.dir}"/>
457    </path>
458
459    <target name="abcl.test" depends="abcl.test.java,abcl.test.lisp"/>
460 
461    <target name="abcl.test.java" depends="abcl.test.compile">
462      <java fork="true"
463      classpathref="abcl.test.run.classpath"
464      classname="org.junit.runner.JUnitCore">
465  <arg value="org.armedbear.lisp.FastStringBufferTest"/>
466      </java>
467    </target>
468
469    <target name="abcl.test.lisp" depends="abcl.test.lisp.asdf"/>
470
471    <target name="abcl.test.lisp.asdf" depends="abcl.jar,abcl.test.ansi.interpreted">
472    </target>
473
474    <target name="abcl.test.ansi.interpreted">
475      <java fork="true" dir="${basedir}"
476      classpathref="abcl.classpath.dist"
477      classname="org.armedbear.lisp.Main">
478  <arg value="--noinit"/> 
479  <arg value="--load"/>
480  <arg line="${basedir}/scripts/ansi-tests-interpreted.lisp"/>
481      </java>
482    </target>
483
484    <target name="abcl.test.ansi.compiled">
485      <java fork="true" dir="${basedir}"
486      classpathref="abcl.classpath.dist"
487      classname="org.armedbear.lisp.Main">
488  <arg value="--noinit"/> 
489  <arg value="--load"/>
490  <arg line="${basedir}/scripts/ansi-tests-compiled.lisp "/> 
491      </java>
492    </target>
493
494
495    <import file="netbeans-build.xml" optional="true"/> 
496<!--    <import file="j-build.xml" optional="true"/>  -->
497    <import file="not.org-build.xml" optional="true"/> 
498</project>
499
Note: See TracBrowser for help on using the repository browser.