source: trunk/abcl/build.xml @ 13439

Last change on this file since 13439 was 13439, checked in by Mark Evenson, 12 years ago

Fix #131: Don't include ':' in the version string.

  • Property svn:eol-style set to LF
File size: 33.8 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="antlib:org.apache.tools.ant"
3         name="abcl-master" default="abcl.wrapper" basedir=".">
4    <description>Compiling, testing, and packaging Armed Bear Common Lisp</description>
5
6    <target name="abcl" depends="abcl.wrapper"/>
7       
8    <target name="help">
9      <echo>
10Main Ant targets:
11
12 abcl.wrapper
13   -- [default] create executable wrapper for ABCL.
14 abcl.compile 
15   -- compile ABCL to ${build.classes.dir}.
16 abcl.jar     
17   -- create packaged ${abcl.jar.path}.
18 abcl.source.zip abcl.source.tar
19   -- create source distributions in ${dist.dir}.
20 abcl.clean
21   -- remove ABCL intermediate files
22      </echo>
23
24      <echo>
25For help on the automatic tests available, use the Ant target 'help.test'.
26      </echo>
27    </target>
28
29    <!-- Behavior of the build system can be customized via setting
30         properties in the 'abcl.properties' file. -->
31    <property file="abcl.properties"/>
32
33    <property name="build.dir" 
34              value="${basedir}/build"/>
35    <property name="build.classes.dir" 
36              value="${build.dir}/classes"/>
37    <property name="src.dir" 
38              value="${basedir}/src"/>
39    <property name="dist.dir" 
40              value="${basedir}/dist"/>
41    <property name="abcl.jar.path"
42              value="${dist.dir}/abcl.jar"/>
43    <property name="abcl.ext.dir"
44              value="${basedir}/ext"/>
45
46    <fail message="Please build using Ant 1.7.1 or higher.">
47        <condition>
48            <not>
49                <antversion atleast="1.7.1"/>
50            </not>
51        </condition>
52    </fail>
53
54    <!-- Checks if JSR-223 support is available - thanks to Mark Evenson -->
55    <available property="abcl.jsr-223.p"
56               classname="javax.script.ScriptEngine"/>
57
58    <patternset id="abcl.source.java">
59      <include name="org/armedbear/lisp/*.java"/>
60      <include name="org/armedbear/lisp/util/*.java"/>
61      <include name="org/armedbear/lisp/protocol/*.java"/>
62      <include name="org/armedbear/lisp/java/**/*.java"/>
63      <include name="org/armedbear/lisp/scripting/*.java" if="abcl.jsr-223.p"/>
64      <include name="org/armedbear/lisp/scripting/util/*.java" if="abcl.jsr-223.p"/>
65      <include name="org/armedbear/Main.java"/>
66    </patternset>
67
68    <patternset id="abcl.source.lisp">
69      <include name="org/armedbear/lisp/*.lisp"/>
70      <include name="org/armedbear/lisp/java/**/*.lisp"/>
71      <include name="org/armedbear/lisp/tests/*.lisp"/>
72      <exclude name="org/armedbear/lisp/j.lisp"/>
73      <include name="org/armedbear/lisp/scripting/lisp/*.lisp" if="abcl.jsr-223.p"/>
74    </patternset>
75
76    <!-- Lisp files required at runtime -->
77    <patternset id="abcl.source.lisp.dist">
78      <include name="org/armedbear/lisp/boot.lisp"/>
79      <include name="org/armedbear/lisp/scripting/lisp/*.lisp" if="abcl.jsr-223.p"/>
80      <include name="**/*.lisp" if="abcl.compile.lisp.skip"/>
81    </patternset>
82
83    <patternset id="abcl.objects">
84      <!-- "system.lisp" is dynamically created by COMPILE-SYSTEM -->
85      <include name="org/armedbear/lisp/system.lisp"/> 
86      <include name="org/armedbear/lisp/**/*.class"/>
87      <include name="org/armedbear/lisp/**/*.cls"/> 
88      <include name="org/armedbear/lisp/**/*.abcl"/>
89      <include name="org/armedbear/lisp/version"/>
90      <include name="org/armedbear/lisp/scripting/*.class" if="abcl.jsr-223.p"/>
91      <include name="org/armedbear/lisp/scripting/util/*.class" if="abcl.jsr-223.p"/>
92      <patternset refid="abcl.source.lisp.dist"/>
93    </patternset>
94   
95    <path id="abcl.classpath.dist">
96      <pathelement location="${abcl.jar.path}"/>
97    </path>
98   
99    <path id="abcl.classpath.build">
100      <pathelement location="${build.classes.dir}"/>
101    </path>
102
103    <target name="abcl.compile" depends="abcl.clean.maybe,abcl.compile.lisp">
104      <echo>Compiled ABCL with Java version: ${java.version}</echo>
105    </target>
106
107    <target name="abcl.clean.maybe" unless="abcl.build.incremental">
108      <echo>Cleaning all intermediate compilation artifacts.</echo>
109      <echo>Setting 'abcl.build.incremental' enables incremental compilation.</echo>
110      <antcall target="abcl.clean"/>
111    </target>
112     
113
114    <target name="abcl.init">
115      <tstamp>
116        <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
117      </tstamp>
118
119      <tstamp>
120        <format property="build.stamp" pattern="yyyymmdd-HHmm"/>
121      </tstamp>
122
123      <property name="abcl.test.log.file"
124                value="abcl-test-${build.stamp}.log"/>
125
126      <property name="java.path"
127                value="${java.home}/bin/java"/>
128
129      <!-- Deprecated. Two main types of build environents: 'unix' or 'windows'. -->
130      <condition property="unix"> 
131        <or>
132          <os family="unix"/>
133          <os family="mac"/>
134        </or>
135      </condition>
136      <condition property="windows"> 
137        <os family="windows"/>
138      </condition>
139
140      <!-- Deprecated. -->
141      <available file="${src.dir}org/armedbear/lisp/Interpreter.java" 
142                 property="abcl.lisp.p"/>
143
144      <echo>java.version: ${java.version}</echo>
145      <condition property="abcl.java.version.p">
146        <or>
147          <matches string="${java.version}" pattern="1\.5"/>
148          <matches string="${java.version}" pattern="1\.6\.0_[12][0-9]"/>
149        </or> 
150      </condition>
151
152    </target>
153   
154    <target name="abcl.java.warning" 
155            depends="abcl.init"
156            unless="abcl.java.version.p">
157      <echo>WARNING: Use of Java version ${java.version} not recommended.</echo>
158    </target>
159       
160    <target name="abcl.jsr-223.notice"
161            depends="abcl.init"
162            unless="abcl.jsr-223.p">
163      <echo>
164        Notice: JSR-223 support won't be built since it is not
165                supported, neither natively by your JVM nor by
166                libraries in the CLASSPATH.
167      </echo>
168    </target>
169
170    <target name="abcl.compile.java" 
171            depends="abcl.init,abcl.java.warning,abcl.jsr-223.notice">
172      <mkdir dir="${build.dir}"/>
173      <mkdir dir="${build.classes.dir}"/>
174      <javac destdir="${build.classes.dir}"
175             debug="true"
176             target="1.5"
177             source="1.5"
178             includeantruntime="false"
179             failonerror="true">
180        <src path="${src.dir}"/>
181        <patternset refid="abcl.source.java"/>
182      </javac>
183      <echo message="${build}" 
184            file="${build.classes.dir}/org/armedbear/lisp/build"/>
185    </target>
186
187    <target name="abcl.copy.lisp">
188      <copy todir="${build.classes.dir}" preservelastmodified="yes">
189        <fileset dir="${src.dir}">
190          <patternset refid="abcl.source.lisp.dist"/>
191        </fileset>
192      </copy>
193    </target>
194
195    <!-- Adjust the patternset for ABCL source to use the much faster
196         Ant 'uptodate' task to check if we need to compile the system
197         fasls.  Highly inter-dependent with the behavior specified in
198         'compile-system.lisp', i.e. files not listed in
199         there should NOT occur here. -->
200    <patternset id="abcl.source.lisp.fasls">
201      <patternset refid="abcl.source.lisp"/>
202      <exclude name="org/armedbear/lisp/scripting/**/*.lisp"/>
203      <exclude name="org/armedbear/lisp/boot.lisp"/>
204      <exclude name="org/armedbear/lisp/emacs.lisp"/>
205      <exclude name="org/armedbear/lisp/runtime-class.lisp"/>
206      <exclude name="org/armedbear/lisp/run-benchmarks.lisp"/>
207    </patternset>
208
209    <target name="abcl.fasls.uptodate">
210      <uptodate property="abcl.fasls.uptodate.p" value="true">
211        <srcfiles dir="${src.dir}">
212          <patternset refid="abcl.source.lisp.fasls"/>
213        </srcfiles>
214        <mapper type="glob" from="*.lisp" to="${build.classes.dir}/*.abcl"/>
215      </uptodate>
216    </target>
217
218    <path id="abcl.home.dir.path">
219        <path location="${src.dir}/org/armedbear/lisp/"/>
220    </path>         
221    <pathconvert property="abcl.home.dir" refid="abcl.home.dir.path"/>
222
223    <path id="abcl.lisp.output.path"
224          location="${build.classes.dir}/org/armedbear/lisp/"/>
225    <pathconvert dirsep="/" property="abcl.lisp.output" refid="abcl.lisp.output.path"/>
226
227    <property name="system.lisp.file" 
228              value="${build.classes.dir}/org/armedbear/lisp/system.lisp"/>
229   
230    <target name="abcl.compile.lisp" 
231            depends="abcl.copy.lisp,abcl.compile.java,abcl.system.update.maybe,abcl.fasls.uptodate"
232            unless="abcl.fasls.uptodate.p">
233      <echo>
234Compiling Lisp system
235from ${abcl.home.dir}
236 to  ${abcl.lisp.output}</echo>
237 
238     <!-- Not good if ${abcl.home.dir} == ${abcl.lisp.output} -->
239     <delete>
240       <fileset dir="${abcl.home.dir}" includes="**/*.abcl **/*.cls **/*._"/>
241     </delete>
242     <java classpath="${build.classes.dir}" 
243            fork="true"
244            failonerror="true"
245            inputstring="(handler-case (compile-system :zip nil :quit t :output-path &quot;${abcl.lisp.output}/&quot;) (t (x) (progn (format t &quot;~A: ~A~%&quot; (type-of x) x) (exit :status -1))))"
246            classname="org.armedbear.lisp.Main">
247        <jvmarg value="-Dabcl.home=${abcl.home.dir}${file.separator}"/>
248        <arg value="--noinit"/>
249        <arg value="--nosystem"/>
250        <arg value="--eval"/>
251        <arg value="(setf *load-verbose* t)"/>
252      </java>
253      <concat destfile="${system.lisp.file}" append="true">
254        <fileset file="${abcl.startup.file}"/>
255      </concat>
256    </target>
257
258    <property name="abcl.build.path"
259              value="${build.classes.dir}/org/armedbear/lisp/build"/>
260    <target name="abcl.stamp" 
261            depends="abcl.compile,abcl.stamp.version,abcl.stamp.hostname">
262      <mkdir dir="${abcl.build.path}/.."/>
263      <loadfile property="abcl.version"
264                srcFile="${abcl.version.path}"/>
265      <echo message="${build}" file="${abcl.build.path}"/>   
266    </target>
267
268
269    <!-- Environment variables may be accessed as ${env.NAME} -->
270    <property environment="env"/>
271
272    <!-- Can we derive an SVN version from the current build tree? -->
273    <condition property="abcl.version.svn.p">
274      <and>
275        <available
276            file="${basedir}/.svn"
277            type="dir"/>
278        <or>
279            <available
280                file="svnversion.exe"
281                filepath="${env.Path}"/>
282            <available
283                file="svnversion.exe"
284                filepath="${env.PATH}"/>
285             <available
286                file="svnversion"
287                filepath="${env.Path}"/>
288            <available
289                file="svnversion"
290                filepath="${env.PATH}"/>
291        </or>
292      </and>
293    </condition>
294
295    <target name="abcl.version.src" depends="abcl.version.src.3"/>
296
297    <target name="abcl.version.src.0" if="windows">
298      <exec
299          executable="svnversion.exe"
300          outputproperty="abcl.version.svn.raw"
301          failifexecutionfails="false"
302          searchpath="true" />
303    </target>
304
305    <target name="abcl.version.src.1" depends="abcl.version.src.0">
306      <exec 
307          executable="svnversion"
308          outputproperty="abcl.version.svn.raw"
309          failifexecutionfails="false"
310          searchpath="true" />
311    </target>
312
313    <target name="abcl.version.src.2" 
314            depends="abcl.version.src.1"
315            if="abcl.version.svn.p">
316
317      <!-- Transform all occurances of ":" ==> "-" in the version string -->
318      <tempfile property="version-tmp.path"/>
319      <echo message="${abcl.version.svn.raw}"
320            file="${version-tmp.path}"/>
321      <replace file="${version-tmp.path}"
322               token=":" value="-"/>
323      <loadfile property="abcl.version.svn" srcFile="${version-tmp.path}"/>
324      <delete file="${version-tmp.path}"/>
325
326      <echo>abcl.version.svn: ${abcl.version.svn}</echo>
327      <property name="abcl.version.src"
328                value="svn-${abcl.version.svn}"/>
329    </target>
330
331    <target name="abcl.version.src.3"
332            depends="abcl.version.src.2"
333            unless="abcl.version.svn.p">
334      <property name="abcl.version.src"
335                value=""/>
336    </target>
337
338    <property name="abcl.home.dir"
339              value="${src.dir}/org/armedbear/lisp/"/>
340    <property name="abcl.version.path"
341              value="${build.classes.dir}/org/armedbear/lisp/version"/>
342
343    <target name="abcl.clean.version">
344      <delete file="${abcl.version.path}"/>
345    </target>
346
347    <target name="abcl.stamp.version.uptodate">
348      <uptodate property="abcl.stamp.version.uptodate.p" 
349                targetfile="${abcl.version.path}"
350                srcfile="${build.classes.dir}/org/armedbear/lisp/Version.class"/>
351    </target>
352
353    <target name="abcl.stamp.version" 
354            depends="abcl.version.src,abcl.stamp.version.1,abcl.stamp.version.2"
355            unless="abcl.stamp.version.uptodate.p">
356      <mkdir dir="${abcl.version.path}/.."/>
357      <echo>ABCL implementation version: ${abcl.implementation.version}</echo>
358      <echo file="${abcl.version.path}">${abcl.implementation.version}</echo>
359    </target>
360   
361    <target name="abcl.stamp.version.generate" 
362            depends="abcl.compile.java"
363            unless="abcl.stamp.version.uptodate.p">
364      <java fork="true"
365            classpath="${build.classes.dir}"
366            outputproperty="abcl.version"
367            classname="org.armedbear.lisp.Version"
368            logerror="yes"/> <!-- Don't catch stderr output -->
369    </target>
370
371    <target name="abcl.stamp.version.0" 
372            depends="abcl.stamp.version.uptodate,abcl.stamp.version.generate">
373    </target>
374
375    <target name="abcl.stamp.version.1"
376            depends="abcl.stamp.version.0"
377            unless="abcl.version.svn.p">
378      <property name="abcl.implementation.version"
379                value="${abcl.version}"/>
380    </target>
381
382    <target name="abcl.stamp.version.2" 
383            depends="abcl.stamp.version.0"
384            if="abcl.version.svn.p">
385      <property name="abcl.implementation.version"
386                value="${abcl.version}-${abcl.version.src}"/>
387    </target>
388
389    <target name="abcl.stamp.hostname" if="unix">
390      <exec executable="hostname" outputproperty="abcl.hostname"/>
391      <echo>abcl.hostname: ${abcl.hostname}</echo>
392    </target>
393
394    <target name="abcl.system.uptodate">
395      <condition property="abcl.system.needs-update.p">
396        <and>
397          <available file="${system.lisp.file}"/>
398          <available file="${abcl.startup.file}"/>
399          <uptodate
400                srcfile="${system.lisp.file}"
401                targetfile="${abcl.startup.file}"/>
402        </and>
403      </condition>
404    </target>
405   
406    <target name="abcl.system.update.maybe" depends="abcl.system.uptodate" 
407            if="abcl.system.needs-update.p">
408      <touch file="${src.dir}/org/armedbear/lisp/compile-system.lisp"/>
409    </target>
410
411    <target name="abcl.jar.uptodate" depends="abcl.compile,abcl.stamp">
412      <uptodate property="abcl.jar.uptodate.p" targetfile="${abcl.jar.path}">
413        <srcfiles dir="${build.classes.dir}">
414          <patternset refid="abcl.objects"/>
415        </srcfiles>
416      </uptodate>
417    </target>
418
419    <target name="abcl.jar" depends="abcl.jar.uptodate"
420            unless="abcl.jar.uptodate.p">
421      <mkdir dir="${dist.dir}"/>
422      <jar destfile="${abcl.jar.path}"
423           compress="true"
424           update="true"
425           basedir="${build.classes.dir}">
426        <patternset refid="abcl.objects"/>
427        <manifest>
428          <attribute name="Main-Class" value="org.armedbear.lisp.Main"/>
429          <section name="org/armedbear/lisp">
430            <attribute name="Implementation-Title" 
431                       value="ABCL"/>
432            <attribute name="Implementation-Version" 
433                       value="${abcl.implementation.version}"/>
434            <attribute name="Implementation-Build" 
435                       value="${build}"/>
436          </section>
437        </manifest>
438        <metainf dir="${src.dir}/META-INF"> 
439          <exclude name="services/javax.script.ScriptEngineFactory"
440                   unless="abcl.jsr-223.p"/>
441        </metainf>
442      </jar>
443    </target>
444   
445    <target name="abcl.wrapper" 
446            depends="abcl.jar,abcl.contrib,abcl.wrapper.unix,abcl.wrapper.windows">
447      <description>
448        Creates in-place exectuable shell wrapper in '${abcl.wrapper.file}'
449      </description>
450      <!-- Set from commandline or in 'build.properties' -->
451      <property name="additional.jars" value=""/>
452      <path id="abcl.runtime.classpath">
453        <pathelement location="${abcl.jar.path}"/>
454        <pathelement path="${additional.jars}"/>
455      </path>
456      <!-- set via '-Djava.options=JAVA_OPTIONS' or in 'build.properties -->
457      <property name="java.options" value=""/>
458
459      <copy file="${abcl.wrapper.in.file}" toFile="${abcl.wrapper.file}" overwrite="yes">
460        <filterset>
461          <filter token="JAVA" 
462                  value="${java.path}"/>
463          <filter token="ABCL_JAVA_OPTIONS" 
464                  value="${java.options}"/>
465          <filter token="ABCL_CLASSPATH"
466                  value="${toString:abcl.runtime.classpath}"/>
467        </filterset>
468      </copy>
469      <chmod file="${abcl.wrapper.file}" perm="a+x"/>
470
471      <echo>Created executable ABCL wrapper in '${abcl.wrapper.file}'</echo>
472      <echo>N.B. This wrapper requires '${abcl.jar.path}' not be moved.</echo>
473    </target>
474
475    <target name="abcl.wrapper.unix" if="unix">
476      <property name="abcl.wrapper.file" value="abcl"/>
477      <property name="abcl.wrapper.in.file" value="abcl.in"/>
478    </target>
479
480    <target name="abcl.wrapper.windows" if="windows">
481      <property name="abcl.wrapper.file" value="abcl.bat"/>
482      <property name="abcl.wrapper.in.file" value="abcl.bat.in"/>
483    </target>
484
485    <patternset id="abcl.contrib.source">
486          <include name="**/*.asd"/>
487          <include name="**/*.lisp"/>
488          <include name="**/README.markdown"/>
489    </patternset>
490
491    <property name="abcl-contrib.jar"
492              value="${dist.dir}/abcl-contrib.jar"/>
493    <condition property="abcl.contrib.uptodate.p">
494      <uptodate targetfile="${abcl-contrib.jar}">
495        <srcfiles dir="contrib">
496          <patternset refid="abcl.contrib.source"/>
497        </srcfiles>
498      </uptodate>
499    </condition>
500
501    <target name="abcl.contrib" unless="abcl.contrib.uptodate.p">
502      <jar destfile="${abcl-contrib.jar}"
503           compress="true"
504           basedir="contrib">
505        <patternset refid="abcl.contrib.source"/>
506      </jar>
507      <echo>
508Packaged contribs in ${abcl-contrib.jar}. To use contribs, ensure that
509this file is in the same directory as 'abcl.jar', and then
510
511  CL-USER> (require 'abcl-contrib)
512
513will place all the contribs in the ASDF registry.
514
515To load a contrib, something like
516
517  CL-USER> (require 'jss)
518
519will compile (if necessary) and load JSS.
520</echo>
521    </target>
522
523    <target name="abcl.debug.jpda" depends="abcl.jar">
524      <description>Invoke ABCL with JPDA listener on port 6789</description>
525      <java fork="true"
526            classpathref="abcl.classpath.dist"
527            classname="org.armedbear.lisp.Main">
528        <jvmarg 
529            value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
530      </java>
531      <echo>JPDA listening on localhost:6789</echo>
532    </target>
533
534    <target name="abcl.build.debug.jpda" depends="abcl.compile.java">
535      <description>Invoke ABCL with JPDA listener on port 6789</description>
536      <java fork="true"
537            classpathref="abcl.classpath.build"
538            classname="org.armedbear.lisp.Main">
539        <jvmarg
540            value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
541        <jvmarg value="-Dabcl.home=${abcl.home.dir}${file.separator}"/>
542      </java>
543      <echo>JPDA listening on localhost:6789</echo>
544    </target>
545
546    <target name="abcl.run" depends="abcl.jar">
547      <java fork="true"
548            classpathref="abcl.classpath.dist"
549            classname="org.armedbear.lisp.Main">
550      </java>
551    </target>
552
553    <target name="abcl.clean">
554      <delete dir="${build.dir}"/>
555      <delete file="${abcl.jar.path}"/>
556      <delete file="abcl"/>
557      <delete file="abcl.bat"/>
558    </target>
559
560    <target name="abcl.dist" depends="abcl.jar">
561      <copy file="${abcl.jar.path}"
562            toFile="${dist.dir}/abcl-${abcl.version}.jar"/>
563    </target>
564
565    <target name="abcl.distclean" depends="abcl.clean">
566      <delete dir="${dist.dir}"/>
567      <delete file="abcl"/>
568      <delete file="abcl.bat"/>
569    </target>
570
571    <target name="TAGS">
572      <delete file="TAGS"/>
573      <apply executable="etags" parallel="true" verbose="true" maxparallel="300">
574        <arg value="--append"/>
575        <arg value="--regex=|[ \t]+//[ \t]+###[ \t]+\([^ \t]+\)|\1|"/>
576        <arg value='--regex=|[ \t]*@DocString([ \t]*name=\"\([^\"]*\)|\1|'/>
577        <fileset dir="${src.dir}">
578          <patternset refid="abcl.source.java"/>
579          <patternset refid="abcl.source.lisp"/>
580        </fileset>
581      </apply>
582    </target>
583
584    <patternset id="abcl.dist.misc"
585                description="Additional includes in the source distributions relative to basedir">
586      <include name="build.xml"/>
587      <include name="abcl.properties.in"/>
588      <include name="COPYING"/>
589      <include name="README"/>
590      <include name="CHANGES"/>
591      <include name="abcl.in"/>
592      <include name="abcl.bat.in"/>
593     
594      <include name="examples/**"/>
595
596      <include name="contrib/**"/>
597
598      <include name="build-from-lisp.sh"/>
599     
600      <!-- The remainder of these files are used by the Lisp hosted
601           build in 'build-abcl.lisp' but not used by Ant, so include
602           them in the source distribution. -->
603      <include name="make-jar.in"/>
604      <include name="make-jar.bat.in"/>
605
606
607
608      <include name="build-abcl.lisp"/>
609      <include name="customizations.lisp.in"/>
610
611    </patternset>
612
613    <patternset 
614        id="abcl.source.misc"
615        description="Additional includes in the source distribution relative to source root">
616      <include name="org/armedbear/lisp/LICENSE"/>
617      <include name="manifest-abcl"/>
618      <include name="META-INF/services/javax.script.ScriptEngineFactory"/>
619    </patternset>
620
621    <target name="abcl.source.prepare" depends="abcl.stamp.version">
622      <property name="abcl.build.src.dir"
623                value="${build.dir}/abcl-src-${abcl.version}"/>
624      <mkdir dir="${abcl.build.src.dir}/src"/>
625      <copy todir="${abcl.build.src.dir}/src"
626            preservelastmodified="true">
627        <fileset dir="${src.dir}"
628                 id="abcl.source.src">
629            <patternset refid="abcl.source.java"/>
630            <patternset refid="abcl.source.lisp"/>
631            <patternset refid="abcl.source.misc"/>
632        </fileset>
633      </copy>
634      <copy todir="${abcl.build.src.dir}"
635            preservelastmodified="true">
636        <fileset dir="${basedir}">
637            <patternset refid="abcl.dist.misc"/>
638        </fileset>
639      </copy>
640    </target>
641
642    <!--  Files in source distribution that always get LF EOL (aka
643         'unix') -->   
644    <patternset id="abcl.dist.lf">
645      <include name="abcl.in"/>
646    </patternset>
647
648    <!--  Files in source distribution that always get CRLF EOL (aka
649         'dos') -->   
650    <patternset id="abcl.dist.crlf">
651      <include name="abcl.bat.in"/>
652    </patternset>
653
654    <target name="abcl.source.unix" depends="abcl.source.prepare">
655      <fixcrlf srcdir="${abcl.build.src.dir}"
656               preservelastmodified="true"
657               eol="lf">
658      </fixcrlf>
659
660      <fixcrlf srcdir="${abcl.build.src.dir}"
661               preservelastmodified="true"
662               eol="crlf">
663          <patternset refid="abcl.dist.crlf"/>
664      </fixcrlf>
665
666      <fixcrlf srcdir="${abcl.build.src.dir}"
667               preservelastmodified="true"
668               eol="lf">
669          <patternset refid="abcl.dist.lf"/>
670      </fixcrlf>
671    </target>
672
673    <target name="abcl.source.tar" depends="abcl.source.unix">
674      <mkdir dir="${dist.dir}"/>
675      <tar destfile="${dist.dir}/abcl-src-${abcl.version}.tar.gz"
676           compression="gzip">
677        <tarfileset dir="${build.dir}">
678          <include name="abcl-src-${abcl.version}/**"/>
679        </tarfileset>
680      </tar>
681    </target>
682
683    <target name="abcl.source.windows" depends="abcl.source.prepare">
684      <fixcrlf srcdir="${abcl.build.src.dir}"
685               preservelastmodified="true"
686               eol="crlf">
687      </fixcrlf>
688
689      <fixcrlf srcdir="${abcl.build.src.dir}"
690               preservelastmodified="true"
691               eol="crlf">
692          <patternset refid="abcl.dist.crlf"/>
693      </fixcrlf>
694
695      <fixcrlf srcdir="${abcl.build.src.dir}"
696               preservelastmodified="true"
697               eol="lf">
698          <patternset refid="abcl.dist.lf"/>
699      </fixcrlf>
700    </target>
701
702    <target name="abcl.source.zip" depends="abcl.source.windows">
703      <mkdir dir="${dist.dir}"/>
704      <zip destfile="${dist.dir}/abcl-src-${abcl.version}.zip"
705           compress="true">
706        <zipfileset dir="${abcl.build.src.dir}" prefix="abcl-src-${abcl.version}"/>
707      </zip>
708    </target>
709
710    <target name="abcl.source.jar" depends="abcl.source.unix">
711      <mkdir dir="${dist.dir}"/>
712      <jar destfile="${dist.dir}/abcl-${abcl.version}-sources.jar">
713        <metainf dir="${abcl.build.src.dir}">
714          <include name="COPYING"/>
715        </metainf>
716        <fileset dir="${abcl.build.src.dir}/src">
717          <include name="**/*.java"/>
718          <include name="**/*.lisp"/>
719        </fileset>
720      </jar>
721    </target>
722
723    <property name="abcl.javadoc.dir" value="${build.dir}/javadoc"/>
724
725    <target name="abcl.javadoc">
726      <mkdir dir="${abcl.javadoc.dir}"/>
727      <javadoc destdir="${abcl.javadoc.dir}"
728               sourcepath="${src.dir}"/>
729    </target>
730   
731    <target name="abcl.javadoc.jar" depends="abcl.stamp.version,abcl.javadoc">
732      <mkdir dir="${dist.dir}"/>
733      <jar destfile="${dist.dir}/abcl-${abcl.version}-javadoc.jar">
734        <fileset dir="${abcl.javadoc.dir}"/>
735      </jar>
736    </target>
737
738    <target name="abcl.binary.prepare" depends="abcl.jar,abcl.contrib,abcl.stamp.version">
739      <property name="abcl.build.binary.dir"
740                value="${build.dir}/abcl-bin-${abcl.version}"/>
741      <mkdir dir="${abcl.build.binary.dir}"/>
742      <copy todir="${abcl.build.binary.dir}"
743            preservelastmodified="true">
744        <fileset dir="${basedir}/dist">
745          <patternset>
746            <include name="abcl.jar"/>
747            <include name="abcl-contrib.jar"/>
748          </patternset>
749        </fileset>
750        <fileset dir="${basedir}">
751          <patternset>
752            <include name="README"/>
753            <include name="CHANGES"/>
754          </patternset>
755        </fileset>
756      </copy>
757    </target>
758
759    <target name="abcl.binary.tar" depends="abcl.binary.prepare">
760      <tar destfile="${dist.dir}/abcl-bin-${abcl.version}.tar.gz"
761           compression="gzip">
762        <tarfileset dir="${build.dir}">
763          <include name="abcl-bin-${abcl.version}/**"/>
764          </tarfileset>
765      </tar>
766    </target>
767
768    <target name="abcl.binary.zip" depends="abcl.binary.prepare">
769      <zip destfile="${dist.dir}/abcl-bin-${abcl.version}.zip"
770           compress="true">
771        <zipfileset dir="${abcl.build.binary.dir}" prefix="abcl-bin-${abcl.version}"/>
772      </zip>
773    </target>
774
775    <target name="help.test">
776      <echo>
777The following Ant targets run various test suites:
778 
779  abcl.test
780    --  Run all available tests.
781  abcl.test.java
782    --  Run the ABCL junit Java tests under ${basedir}/test/src
783  abcl.test.lisp
784    --  Run the 'test.ansi.compiled', 'test.abcl', 'test.cl-bench' targets
785  test.ansi.compiled
786    --  Run the compiled version of the ANSI test suite
787  test.abcl
788    --  Run the Lisp RT tests collected in ${basedir}/test/lisp/abcl
789  test.cl-bench
790    --  Run the cl-bench test suite.
791
792The ANSI tests require that the [ansi-tests][1] be manually installed in
793${basedir}/../ansi-tests.
794
795[1]: svn://common-lisp.net/project/ansi-test/svn/trunk/ansi-tests
796
797The CL-BENCH tests require that [cl-bench][2] be manually installed in
798${basedir}/../cl-bench
799
800[2]: http://www.chez.com/emarsden/downloads/cl-bench.tar.gz
801      </echo>
802    </target>
803
804    <property name="abcl.test.classes.dir"
805              value="${build.dir}/classes-test"/>
806
807    <property name="abcl.test.src.dir"
808              value="${basedir}/test/src"/>
809
810    <patternset id="abcl.test.source.java">
811      <!-- For now, we list tests explicitly, because we have to
812           enumerate them later to the JUnit test runner. -->
813      <include name="org/armedbear/lisp/*.java"/>
814    </patternset>
815
816    <property name="junit.path"
817              value="${abcl.ext.dir}/junit-4.8.1.jar"/>
818
819
820    <path id="abcl.test.compile.classpath">
821      <pathelement location="${junit.path}"/>
822      <pathelement location="${build.classes.dir}"/>
823    </path>
824
825    <target name="abcl.test.pre-compile" depends="abcl.ext"/>
826
827    <target name="abcl.ext.p">
828      <!--XXX generalize over enumeration of all contributions to
829           abcl.ext if we get more of them.  -->
830      <available file="${junit.path}" property="abcl.ext.p"/>
831    </target>
832    <target name="abcl.ext" depends="abcl.ext.p" unless="abcl.ext.p">
833
834      <mkdir dir="${abcl.ext.dir}"/>
835      <get 
836          src="http://cloud.github.com/downloads/KentBeck/junit/junit-4.8.1.jar"
837          usetimestamp="true"
838          dest="${junit.path}"/>
839    </target>
840       
841    <target name="abcl.test.compile" 
842            depends="abcl.test.pre-compile">
843      <mkdir dir="${abcl.test.classes.dir}"/>
844      <javac destdir="${abcl.test.classes.dir}"
845             classpathref="abcl.test.compile.classpath"
846             debug="true"
847             target="1.5">
848        <src path="${abcl.test.src.dir}"/>
849        <patternset refid="abcl.test.source.java"/>
850      </javac>
851    </target>
852
853    <path id="abcl.test.run.classpath">
854      <path refid="abcl.test.compile.classpath"/>
855      <pathelement location="${abcl.test.classes.dir}"/>
856    </path>
857
858    <target name="abcl.test" 
859            depends="abcl.test.java,abcl.test.lisp"/>
860       
861    <target name="abcl.test.java" depends="abcl.test.compile">
862      <java fork="true"
863            classpathref="abcl.test.run.classpath"
864            classname="org.junit.runner.JUnitCore">
865        <arg value="org.armedbear.lisp.PathnameTest"/>
866        <arg value="org.armedbear.lisp.StreamTest"/>
867        <arg value="org.armedbear.lisp.UtilitiesTest"/>
868      </java>
869    </target>
870
871    <target name="abcl.test.lisp" 
872            depends="test.ansi.compiled,test.abcl,test.cl-bench"/>
873
874    <target name="test.ansi.interpreted" depends="abcl.jar">
875      <echo>Recording test output in ${abcl.test.log.file}.</echo>
876      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
877      <java fork="true" dir="${basedir}"
878            classpathref="abcl.classpath.dist"
879            classname="org.armedbear.lisp.Main">
880        <arg value="--noinit"/> 
881        <arg value="--eval"/><arg value="(require (quote asdf))"/>
882        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:load-op) :abcl)"/>
883        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:test-op) :ansi-interpreted)"/>
884        <arg value="--eval"/><arg value="(ext:exit)"/>
885      </java>
886      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
887      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
888    </target>
889
890    <target name="test.ansi.compiled" depends="abcl.jar">
891      <echo>Recording test output in ${abcl.test.log.file}.</echo>
892      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
893      <java fork="true" dir="${basedir}"
894            classpathref="abcl.classpath.dist"
895            classname="org.armedbear.lisp.Main">
896        <arg value="--noinit"/> 
897        <arg value="--eval"/><arg value="(require (quote asdf))"/>
898        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:load-op) :abcl)"/>
899        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:test-op) :ansi-compiled)"/>
900        <arg value="--eval"/><arg value="(ext:exit)"/>
901      </java>
902      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
903      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
904    </target>
905
906    <target name="test.abcl" depends="abcl.jar">
907      <echo>Recording test output in ${abcl.test.log.file}.</echo>
908      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
909      <java fork="true" dir="${basedir}"
910            classpathref="abcl.classpath.dist"
911            classname="org.armedbear.lisp.Main">
912        <arg value="--noinit"/> 
913        <arg value="--eval"/><arg value="(require (quote asdf))"/>
914        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:load-op) :abcl)"/>
915        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:test-op) :abcl-test-lisp)"/>
916        <arg value="--eval"/><arg value="(ext:exit)"/>
917      </java>
918      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
919      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
920    </target>
921
922    <target name="test.cl-bench" depends="abcl.jar">
923      <echo>Recording test output in ${abcl.test.log.file}.</echo>
924      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
925      <java fork="true" dir="${basedir}"
926            classpathref="abcl.classpath.dist"
927            classname="org.armedbear.lisp.Main">
928        <arg value="--noinit"/> 
929        <arg value="--eval"/><arg value="(require (quote asdf))"/>
930        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:load-op) :abcl)"/>
931        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:test-op) :cl-bench)"/>
932        <arg value="--eval"/><arg value="(ext:exit)"/>
933      </java>
934      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
935      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
936    </target>
937   
938    <target name="abcl.release" 
939            depends="abcl.binary.tar,abcl.source.tar,abcl.binary.zip,abcl.source.zip">
940      <copy file="${abcl.jar.path}"
941            tofile="${dist.dir}/abcl-${abcl.version}.jar"/>
942      <copy file="${abcl-contrib.jar}"
943            tofile="${dist.dir}/abcl-contrib-${abcl.version}.jar"/>
944    </target>
945
946    <import file="netbeans-build.xml" optional="true"/> 
947<!--    <import file="j-build.xml" optional="true"/>  -->
948    <import file="not.org-build.xml" optional="true"/> 
949</project>
950
951
952
953
Note: See TracBrowser for help on using the repository browser.