source: trunk/abcl/build.xml @ 14907

Last change on this file since 14907 was 14907, checked in by Mark Evenson, 6 years ago

'abcl-aio.jar' all-in-one jar target creates dist/abcl-aio.jar (Alan Ruttenberg)

Corresponds to <https://github.com/armedbear/abcl/pull/7>.

Combines usual abcl.jar contents + contribs + lisp and java source.
Fixes find-system-jar accepts abcl-aio as well, so you can use this
single jar in your lib vs. abcl.jar + abcl-contrib.jar + sources
somewhere.

Combined with recent Slime enhancements in
<https://github.com/slime/slime/commit/30566b174be3186fde1ac224d4fffd3def0f4d9e>
ff., this will allow edit definition to find source for abcl-defined
functions and java primitives without extra configuration.

  • Property svn:eol-style set to LF
File size: 42.3 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,abcl-contrib.jar"/>
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.aio.jar.path"
44              value="${dist.dir}/abcl-aio.jar"/>
45    <property name="abcl.ext.dir"
46              value="${basedir}/ext"/>
47
48    <property name="abcl.runtime.jar.path"
49              value="${abcl.jar.path}"/>
50
51    <fail message="Please build using Ant 1.7.1 or higher.">
52        <condition>
53            <not>
54                <antversion atleast="1.7.1"/>
55            </not>
56        </condition>
57    </fail>
58
59    <!-- Checks if JSR-223 support is available - thanks to Mark Evenson -->
60    <available property="abcl.jsr-223.p"
61               classname="javax.script.ScriptEngine"/>
62
63    <patternset id="abcl.source.java">
64      <include name="org/armedbear/lisp/*.java"/>
65      <include name="org/armedbear/lisp/util/*.java"/>
66      <include name="org/armedbear/lisp/protocol/*.java"/>
67      <include name="org/armedbear/lisp/java/**/*.java"/>
68      <include name="org/armedbear/lisp/scripting/*.java" if="abcl.jsr-223.p"/>
69      <include name="org/armedbear/lisp/scripting/util/*.java" if="abcl.jsr-223.p"/>
70      <include name="org/armedbear/Main.java"/>
71    </patternset>
72
73    <patternset id="abcl.source.lisp">
74      <include name="org/armedbear/lisp/*.lisp"/>
75      <include name="org/armedbear/lisp/java/**/*.lisp"/>
76      <include name="org/armedbear/lisp/tests/*.lisp"/>
77      <exclude name="org/armedbear/lisp/j.lisp"/>
78      <include name="org/armedbear/lisp/scripting/lisp/*.lisp" if="abcl.jsr-223.p"/>
79    </patternset>
80
81    <!-- Lisp files required at runtime -->
82    <patternset id="abcl.source.lisp.dist">
83      <include name="org/armedbear/lisp/boot.lisp"/>
84      <include name="org/armedbear/lisp/scripting/lisp/*.lisp" if="abcl.jsr-223.p"/>
85      <include name="**/*.lisp" if="abcl.compile.lisp.skip"/>
86    </patternset>
87
88    <patternset id="abcl.objects">
89      <!-- "system.lisp" is dynamically created by COMPILE-fSYSTEM -->
90      <include name="org/armedbear/lisp/system.lisp"/> 
91      <include name="org/armedbear/lisp/**/*.class"/>
92      <include name="org/armedbear/lisp/**/*.cls"/> 
93      <include name="org/armedbear/lisp/**/*.abcl"/>
94      <include name="org/armedbear/lisp/version"/>
95      <include name="org/armedbear/lisp/scripting/*.class" if="abcl.jsr-223.p"/>
96      <include name="org/armedbear/lisp/scripting/util/*.class" if="abcl.jsr-223.p"/>
97      <patternset refid="abcl.source.lisp.dist"/>
98      <include name="abcl.rdf"/>
99    </patternset>
100   
101    <path id="abcl.classpath.dist">
102      <pathelement location="${abcl.jar.path}"/>
103    </path>
104   
105    <path id="abcl.classpath.build">
106      <pathelement location="${build.classes.dir}"/>
107    </path>
108
109    <target name="abcl.compile" depends="abcl.clean.maybe,abcl.compile.lisp">
110      <echo>Compiled ABCL with Java version: ${java.version}</echo>
111    </target>
112
113    <target name="abcl.clean.maybe" unless="abcl.build.incremental">
114      <echo>Cleaning all intermediate compilation artifacts.</echo>
115      <echo>Setting 'abcl.build.incremental' enables incremental compilation.</echo>
116      <antcall target="abcl.clean"/>
117    </target>
118     
119
120    <target name="abcl.init">
121      <tstamp>
122        <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
123      </tstamp>
124
125      <tstamp>
126        <format property="build.stamp" pattern="yyyymmdd-HHmm"/>
127      </tstamp>
128
129      <property name="abcl.test.log.file"
130                value="abcl-test-${build.stamp}.log"/>
131
132      <property name="java.path"
133                value="${java.home}/bin/java"/>
134
135      <!-- Deprecated. Two main types of build environents: 'unix' or 'windows'. -->
136      <condition property="unix"> 
137        <or>
138          <os family="unix"/>
139          <os family="mac"/>
140        </or>
141      </condition>
142      <condition property="windows"> 
143        <os family="windows"/>
144      </condition>
145
146      <!-- Deprecated. -->
147      <available file="${src.dir}org/armedbear/lisp/Interpreter.java" 
148                 property="abcl.lisp.p"/>
149
150      <echo>java.version: ${java.version}</echo>
151      <condition property="abcl.java.version.p">
152        <or>
153          <matches string="${java.version}" 
154                   pattern="1\.5"/>
155          <!-- Don't use 1.6.0_09 or earlier. -->
156          <matches string="${java.version}" 
157                   pattern="1\.6\.0_[1-9][0-9]"/>
158          <!-- 1.7.0_04 works much better. -->
159          <matches string="${java.version}" 
160                   pattern="1\.7\.0_(0[4-9])|([1-9][0-9])"/>
161          <matches string="${java.version}" 
162                   pattern="1\.8\.0"/>
163        </or> 
164      </condition>
165
166    </target>
167   
168    <target name="abcl.java.warning" 
169            depends="abcl.init"
170            unless="abcl.java.version.p">
171      <echo>WARNING: Use of Java version ${java.version} not recommended.</echo>
172    </target>
173       
174    <target name="abcl.jsr-223.notice"
175            depends="abcl.init"
176            unless="abcl.jsr-223.p">
177      <echo>
178        Notice: JSR-223 support won't be built since it is not
179                supported, neither natively by your JVM nor by
180                libraries in the CLASSPATH.
181      </echo>
182    </target>
183
184    <target name="abcl.compile.java" 
185            depends="abcl.init,abcl.java.warning,abcl.jsr-223.notice">
186      <mkdir dir="${build.dir}"/>
187      <mkdir dir="${build.classes.dir}"/>
188      <!-- Stock build for Java 1.5 (aka Java 2) container -->
189      <javac destdir="${build.classes.dir}"
190             debug="true"
191             target="1.5"
192             source="1.5"
193             includeantruntime="false"
194             failonerror="true">
195        <src path="${src.dir}"/>
196        <patternset refid="abcl.source.java"/>
197      </javac>
198      <echo message="${build}" 
199            file="${build.classes.dir}/org/armedbear/lisp/build"/>
200    </target>
201
202    <!-- Additional artifacts to stage relative to Ant ${basedir} -->
203    <patternset id="abcl.stage">
204      <include name="abcl.rdf"/>
205    </patternset>
206
207    <target name="abcl.stage"
208      depends="abcl.copy.lisp">
209      <copy todir="${build.classes.dir}" preservelastmodified="yes">
210  <fileset dir="${basedir}/">
211    <patternset refid="abcl.stage"/>
212  </fileset>
213      </copy>
214    </target>
215   
216    <target name="abcl.copy.lisp">
217      <copy todir="${build.classes.dir}" preservelastmodified="yes">
218        <fileset dir="${src.dir}">
219          <patternset refid="abcl.source.lisp.dist"/>
220        </fileset>
221      </copy>
222    </target>
223
224    <!-- Adjust the patternset for ABCL source to use the much faster
225         Ant 'uptodate' task to check if we need to compile the system
226         fasls.  Highly inter-dependent with the behavior specified in
227         'compile-system.lisp', i.e. files not listed in
228         there should NOT occur here. -->
229    <patternset id="abcl.source.lisp.fasls">
230      <patternset refid="abcl.source.lisp"/>
231      <exclude name="org/armedbear/lisp/scripting/**/*.lisp"/>
232      <exclude name="org/armedbear/lisp/boot.lisp"/>
233      <exclude name="org/armedbear/lisp/emacs.lisp"/>
234      <exclude name="org/armedbear/lisp/run-benchmarks.lisp"/>
235    </patternset>
236
237    <target name="abcl.fasls.uptodate">
238      <uptodate property="abcl.fasls.uptodate.p" value="true">
239        <srcfiles dir="${src.dir}">
240          <patternset refid="abcl.source.lisp.fasls"/>
241        </srcfiles>
242        <mapper type="glob" from="*.lisp" to="${build.classes.dir}/*.abcl"/>
243      </uptodate>
244    </target>
245
246    <path id="abcl.home.dir.path">
247        <path location="${src.dir}/org/armedbear/lisp/"/>
248    </path>         
249    <pathconvert property="abcl.home.dir" refid="abcl.home.dir.path"/>
250
251    <path id="abcl.lisp.output.path"
252          location="${build.classes.dir}/org/armedbear/lisp/"/>
253    <pathconvert dirsep="/" property="abcl.lisp.output" refid="abcl.lisp.output.path"/>
254
255    <property name="system.lisp.file" 
256              value="${build.classes.dir}/org/armedbear/lisp/system.lisp"/>
257
258    <target name="abcl.compile.lisp" 
259            depends="abcl.stage,abcl.compile.java,abcl.system.update.maybe,abcl.fasls.uptodate"
260            unless="abcl.fasls.uptodate.p">
261      <abcl.compile.lisp/>
262    </target>
263
264    <macrodef name="abcl.compile.lisp">
265      <element name="additional.jvmarg" optional="true"/>
266      <sequential>
267        <echo>
268Compiling Lisp system
269from ${abcl.home.dir}
270 to  ${abcl.lisp.output}</echo>
271 
272     <!-- Not good if ${abcl.home.dir} == ${abcl.lisp.output} -->
273     <delete>
274       <fileset dir="${abcl.home.dir}" includes="**/*.abcl **/*.cls **/*._"/>
275     </delete>
276     <java classpath="${build.classes.dir}" 
277            fork="true"
278            failonerror="true"
279            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))))"
280            classname="org.armedbear.lisp.Main">
281        <jvmarg value="-Dabcl.home=${abcl.home.dir}${file.separator}"/>
282        <jvmarg value="-Dabcl.autoload.verbose=Y"/>
283        <additional.jvmarg/>
284        <arg value="--noinit"/>
285        <arg value="--nosystem"/>
286        <arg value="--eval"/>
287        <arg value="(setf *load-verbose* t)"/>
288      </java>
289      <concat destfile="${system.lisp.file}" append="true">
290        <fileset file="${abcl.startup.file}"/>
291      </concat>
292        </sequential>
293    </macrodef>
294
295    <property name="abcl.compile.lisp.debug.jvmarg"
296              value="-agentlib:jdwp=transport=dt_socket,server=y,address=6789,suspend=y"/>
297    <target name="abcl.compile.lisp.debug" 
298            depends="abcl.stage,abcl.compile.java,abcl.system.update.maybe,abcl.fasls.uptodate"
299            unless="abcl.fasls.uptodate.p">
300      <echo>Debugging with jvmarg ${abcl.compile.lisp.debug.jvmarg}</echo>
301      <abcl.compile.lisp> 
302          <additional.jvmarg>
303            <jvmarg value="${abcl.compile.lisp.debug.jvmarg}"/>
304          </additional.jvmarg>
305      </abcl.compile.lisp>
306    </target>
307
308    <property name="abcl.build.path"
309              value="${build.classes.dir}/org/armedbear/lisp/build"/>
310    <target name="abcl.stamp" 
311            depends="abcl.compile,abcl.stamp.version,abcl.stamp.hostname">
312      <mkdir dir="${abcl.build.path}/.."/>
313      <loadfile property="abcl.version"
314                srcFile="${abcl.version.path}"/>
315      <echo message="${build}" file="${abcl.build.path}"/>   
316    </target>
317
318
319    <!-- Environment variables may be accessed as ${env.NAME} -->
320    <property environment="env"/>
321
322    <!-- Can we derive an SVN version from the current build tree? -->
323    <condition property="abcl.version.svn.p">
324      <and>
325        <available
326            file="${basedir}/.svn"
327            type="dir"/>
328        <or>
329            <available
330                file="svnversion.exe"
331                filepath="${env.Path}"/>
332            <available
333                file="svnversion.exe"
334                filepath="${env.PATH}"/>
335             <available
336                file="svnversion"
337                filepath="${env.Path}"/>
338            <available
339                file="svnversion"
340                filepath="${env.PATH}"/>
341        </or>
342      </and>
343    </condition>
344
345    <target name="abcl.version.src" depends="abcl.version.src.3"/>
346
347    <target name="abcl.version.src.0" if="windows">
348      <exec
349          executable="svnversion.exe"
350          outputproperty="abcl.version.svn.raw"
351          failifexecutionfails="false"
352          searchpath="true" />
353    </target>
354
355    <target name="abcl.version.src.1" depends="abcl.version.src.0">
356      <exec 
357          executable="svnversion"
358          outputproperty="abcl.version.svn.raw"
359          failifexecutionfails="false"
360          searchpath="true" />
361    </target>
362
363    <target name="abcl.version.src.2" 
364            depends="abcl.version.src.1"
365            if="abcl.version.svn.p">
366
367      <!-- Transform all occurances of ":" ==> "-" in the version string -->
368      <tempfile property="version-tmp.path"/>
369      <echo message="${abcl.version.svn.raw}"
370            file="${version-tmp.path}"/>
371      <replace file="${version-tmp.path}"
372               token=":" value="-"/>
373      <loadfile property="abcl.version.svn" srcFile="${version-tmp.path}"/>
374      <delete file="${version-tmp.path}"/>
375
376      <echo>abcl.version.svn: ${abcl.version.svn}</echo>
377      <property name="abcl.version.src"
378                value="svn-${abcl.version.svn}"/>
379    </target>
380
381    <target name="abcl.version.src.3"
382            depends="abcl.version.src.2"
383            unless="abcl.version.svn.p">
384      <property name="abcl.version.src"
385                value=""/>
386    </target>
387
388    <property name="abcl.home.dir"
389              value="${src.dir}/org/armedbear/lisp/"/>
390    <property name="abcl.version.path"
391              value="${build.classes.dir}/org/armedbear/lisp/version"/>
392
393    <target name="abcl.clean.version">
394      <delete file="${abcl.version.path}"/>
395    </target>
396
397    <target name="abcl.stamp.version.uptodate">
398      <uptodate property="abcl.stamp.version.uptodate.p" 
399                targetfile="${abcl.version.path}"
400                srcfile="${build.classes.dir}/org/armedbear/lisp/Version.class"/>
401    </target>
402
403    <target name="abcl.stamp.version" 
404            depends="abcl.version.src,abcl.stamp.version.1,abcl.stamp.version.2"
405            unless="abcl.stamp.version.uptodate.p">
406      <mkdir dir="${abcl.version.path}/.."/>
407      <echo>ABCL implementation version: ${abcl.implementation.version}</echo>
408      <echo file="${abcl.version.path}">${abcl.implementation.version}</echo>
409    </target>
410   
411    <target name="abcl.stamp.version.generate" 
412            depends="abcl.compile.java"
413            unless="abcl.stamp.version.uptodate.p">
414      <java fork="true"
415            classpath="${build.classes.dir}"
416            outputproperty="abcl.version"
417            classname="org.armedbear.lisp.Version"
418            logerror="yes"/> <!-- Don't catch stderr output -->
419    </target>
420
421    <target name="abcl.stamp.version.0" 
422            depends="abcl.stamp.version.uptodate,abcl.stamp.version.generate">
423    </target>
424
425    <target name="abcl.stamp.version.1"
426            depends="abcl.stamp.version.0"
427            unless="abcl.version.svn.p">
428      <property name="abcl.implementation.version"
429                value="${abcl.version}"/>
430    </target>
431
432    <target name="abcl.stamp.version.2" 
433            depends="abcl.stamp.version.0"
434            if="abcl.version.svn.p">
435      <property name="abcl.implementation.version"
436                value="${abcl.version}-${abcl.version.src}"/>
437    </target>
438
439    <target name="abcl.stamp.hostname" if="unix">
440      <exec executable="hostname" outputproperty="abcl.hostname"/>
441      <echo>abcl.hostname: ${abcl.hostname}</echo>
442    </target>
443
444    <target name="abcl.system.uptodate">
445      <condition property="abcl.system.needs-update.p">
446        <and>
447          <available file="${system.lisp.file}"/>
448          <available file="${abcl.startup.file}"/>
449          <uptodate
450                srcfile="${system.lisp.file}"
451                targetfile="${abcl.startup.file}"/>
452        </and>
453      </condition>
454    </target>
455   
456    <target name="abcl.system.update.maybe" depends="abcl.system.uptodate" 
457            if="abcl.system.needs-update.p">
458      <touch file="${src.dir}/org/armedbear/lisp/compile-system.lisp"/>
459    </target>
460
461    <target name="abcl.jar.uptodate" depends="abcl.compile,abcl.stamp">
462      <uptodate property="abcl.jar.uptodate.p" targetfile="${abcl.jar.path}">
463        <srcfiles dir="${build.classes.dir}">
464          <patternset refid="abcl.objects"/>
465        </srcfiles>
466      </uptodate>
467    </target>
468
469    <target name="abcl.jar" depends="abcl.jar.uptodate,abcl-contrib.jar"
470            unless="abcl.jar.uptodate.p">
471      <mkdir dir="${dist.dir}"/>
472      <jar destfile="${abcl.jar.path}"
473           compress="true"
474           update="true"
475           basedir="${build.classes.dir}">
476        <patternset refid="abcl.objects"/>
477        <manifest>
478          <attribute name="Main-Class" value="org.armedbear.lisp.Main"/>
479          <section name="org/armedbear/lisp">
480            <attribute name="Implementation-Title" 
481                       value="ABCL"/>
482            <attribute name="Implementation-Version" 
483                       value="${abcl.implementation.version}"/>
484            <attribute name="Implementation-Build" 
485                       value="${build}"/>
486          </section>
487        </manifest>
488        <metainf dir="${src.dir}/META-INF"> 
489          <exclude name="services/javax.script.ScriptEngineFactory"
490                   unless="abcl.jsr-223.p"/>
491        </metainf>
492      </jar>
493    </target>
494
495    <target name="abcl.aio" depends="abcl.compile,abcl.stamp">
496      <mkdir dir="${dist.dir}"/>
497      <jar destfile="${abcl.aio.jar.path}"
498           compress="true"
499           update="true"
500           basedir="${build.classes.dir}">
501  <fileset dir="${src.dir}">
502          <patternset refid="abcl.objects"/>
503    <patternset refid="abcl.source.java"/>
504    <patternset refid="abcl.source.lisp"/>
505  </fileset>
506  <fileset dir="${basedir}">
507    <patternset refid="abcl.contrib.source"/>
508  </fileset>
509        <manifest>
510          <attribute name="Main-Class" value="org.armedbear.lisp.Main"/>
511          <section name="org/armedbear/lisp">
512            <attribute name="Implementation-Title" 
513                       value="ABCL"/>
514            <attribute name="Implementation-Version" 
515                       value="${abcl.implementation.version}"/>
516            <attribute name="Implementation-Build" 
517                       value="${build}"/>
518          </section>
519        </manifest>
520        <metainf dir="${src.dir}/META-INF"> 
521          <exclude name="services/javax.script.ScriptEngineFactory"
522                   unless="abcl.jsr-223.p"/>
523        </metainf>
524      </jar>
525    </target>
526
527   
528    <target name="abcl.wrapper" 
529            depends="abcl.jar,abcl.contrib,abcl.wrapper.unix,abcl.wrapper.windows">
530      <description>
531        Creates in-place executable shell wrapper in '${abcl.wrapper.file}'
532      </description>
533      <!-- Set from commandline or in 'build.properties' -->
534      <property name="additional.jars" value=""/>
535      <path id="abcl.runtime.classpath">
536        <pathelement location="${abcl.runtime.jar.path}"/>
537        <pathelement path="${additional.jars}"/>
538      </path>
539      <!-- set via '-Djava.options=JAVA_OPTIONS' or in 'build.properties -->
540      <property name="java.options" value=""/>
541
542      <copy file="${abcl.wrapper.in.file}" toFile="${abcl.wrapper.file}" overwrite="yes">
543        <filterset>
544          <filter token="JAVA" 
545                  value="${java.path}"/>
546          <filter token="ABCL_JAVA_OPTIONS" 
547                  value="${java.options}"/>
548          <filter token="ABCL_CLASSPATH"
549                  value="${toString:abcl.runtime.classpath}"/>
550        </filterset>
551      </copy>
552      <chmod file="${abcl.wrapper.file}" perm="a+x"/>
553
554      <echo>Created executable ABCL wrapper in '${abcl.wrapper.file}'</echo>
555      <echo>N.B. This wrapper requires '${abcl.jar.path}' not be moved.</echo>
556    </target>
557
558    <target name="abcl.wrapper.unix" if="unix">
559      <property name="abcl.wrapper.file" value="abcl"/>
560      <property name="abcl.wrapper.in.file" value="abcl.in"/>
561    </target>
562
563    <target name="abcl.wrapper.windows" if="windows">
564      <property name="abcl.wrapper.file" value="abcl.bat"/>
565      <property name="abcl.wrapper.in.file" value="abcl.bat.in"/>
566    </target>
567
568    <patternset id="abcl.contrib.source">
569          <include name="**/*.asd"/>
570          <include name="**/*.lisp"/>
571          <include name="**/README.markdown"/>
572    </patternset>
573
574    <patternset id="abcl.contrib.docs">
575          <include name="**/README.markdown"/>
576    </patternset>
577
578    <property name="abcl-contrib.jar"
579              value="${dist.dir}/abcl-contrib.jar"/>
580    <condition property="abcl.contrib.uptodate.p">
581      <uptodate targetfile="${abcl-contrib.jar}">
582        <srcfiles dir="contrib">
583          <patternset refid="abcl.contrib.source"/>
584        </srcfiles>
585      </uptodate>
586    </condition>
587
588    <target name="abcl-contrib.jar" depends="abcl.contrib"/>
589    <target name="abcl.contrib" unless="abcl.contrib.uptodate.p">
590      <jar destfile="${abcl-contrib.jar}"
591           compress="true"
592           basedir="contrib">
593        <patternset refid="abcl.contrib.source"/>
594      </jar>
595      <echo>
596Packaged contribs in ${abcl-contrib.jar}. To use contribs, ensure that
597this file is in the same directory as 'abcl.jar', and then
598
599  CL-USER> (require 'abcl-contrib)
600
601will place all the contribs in the ASDF registry.
602
603To load a contrib, something like
604
605  CL-USER> (require 'jss)
606
607will compile (if necessary) and load JSS.
608</echo>
609    </target>
610
611    <target name="abcl.contrib.javadoc.jar">
612      <mkdir dir="${dist.dir}"/>
613      <jar destfile="${dist.dir}/abcl-contrib-javadoc.jar" basedir="contrib">
614        <patternset refid="abcl.contrib.docs" />
615      </jar>
616    </target>
617
618    <target name="abcl.contrib.source.jar">
619      <mkdir dir="${dist.dir}"/>
620      <jar destfile="${dist.dir}/abcl-contrib-sources.jar" basedir="contrib">
621        <patternset refid="abcl.contrib.source" />
622      </jar>
623    </target>
624
625    <target name="abcl.debug.jpda" depends="abcl.jar">
626      <description>Invoke ABCL with JPDA listener on port 6789</description>
627      <java fork="true"
628            classpathref="abcl.classpath.dist"
629            classname="org.armedbear.lisp.Main">
630        <jvmarg 
631            value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
632      </java>
633      <echo>JPDA listening on localhost:6789</echo>
634    </target>
635
636    <target name="abcl.build.debug.jpda" depends="abcl.compile.java">
637      <description>Invoke ABCL with JPDA listener on port 6789</description>
638      <java fork="true"
639            classpathref="abcl.classpath.build"
640            classname="org.armedbear.lisp.Main">
641        <jvmarg
642            value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
643        <jvmarg value="-Dabcl.home=${abcl.home.dir}${file.separator}"/>
644      </java>
645      <echo>JPDA listening on localhost:6789</echo>
646    </target>
647
648    <target name="abcl.run" depends="abcl.jar">
649      <java fork="true"
650            classpathref="abcl.classpath.dist"
651            classname="org.armedbear.lisp.Main">
652      </java>
653    </target>
654
655    <target name="abcl.clean">
656      <delete dir="${build.dir}"/>
657      <delete file="${abcl.jar.path}"/>
658      <delete file="abcl"/>
659      <delete file="abcl.bat"/>
660    </target>
661
662    <property name="slime.fasls" 
663              value="${user.home}/.slime/"/>
664    <property name="quicklisp.common-lisp.fasls"
665              value="${user.home}/.cache/common-lisp/"/>
666    <target name="abcl.clean.application.fasls">
667      <echo>WARNING:  This target is removing local application inter-Lisp fasls, forcing recompilation.
668      </echo>
669      <echo>Deleting local SLIME fasls under ${slime.fasls}</echo>
670      <delete dir="${slime.fasls}"/>
671      <echo>Deleting local Quicklisp fasls under ${quicklisp.common-lisp.fasls}</echo>
672      <delete dir="${quicklisp.common-lisp.fasls}"/>
673    </target>
674
675    <target name="abcl.dist" depends="abcl.jar">
676      <copy file="${abcl.jar.path}"
677            toFile="${dist.dir}/abcl-${abcl.version}.jar"/>
678    </target>
679
680    <target name="abcl.distclean" depends="abcl.clean">
681      <delete dir="${dist.dir}"/>
682      <delete file="abcl"/>
683      <delete file="abcl.bat"/>
684    </target>
685
686    <target name="TAGS">
687      <delete file="TAGS"/>
688      <apply executable="etags" parallel="true" verbose="true" maxparallel="300">
689        <arg value="--append"/>
690        <arg value="--regex=|[ \t]+//[ \t]+###[ \t]+\([^ \t]+\)|\1|"/>
691        <arg value='--regex=|[ \t]*@DocString([ \n\r\t]*name=\"\([^\"]*\)|\1|m'/>
692        <fileset dir="${src.dir}">
693          <patternset refid="abcl.source.java"/>
694          <patternset refid="abcl.source.lisp"/>
695        </fileset>
696      </apply>
697    </target>
698
699    <patternset id="abcl.dist.misc"
700                description="Additional includes in the source distributions relative to basedir">
701      <include name="abcl.rdf"/>
702      <include name="build.xml"/>
703      <include name="abcl.properties.in"/>
704      <include name="COPYING"/>
705      <include name="README"/>
706      <include name="CHANGES"/>
707      <include name="abcl.in"/>
708      <include name="abcl.bat.in"/>
709
710      <include name="abcl.asd"/>
711     
712      <include name="examples/**"/>
713
714      <include name="contrib/**"/>
715     
716      <include name="test/**"/>
717
718      <include name="build-from-lisp.bash"/>
719     
720      <!-- The remainder of these files are used by the Lisp hosted
721           build in 'build-abcl.lisp' but not used by Ant, so include
722           them in the source distribution. -->
723      <include name="make-jar.in"/>
724      <include name="make-jar.bat.in"/>
725
726      <include name="build-abcl.lisp"/>
727      <include name="customizations.lisp.in"/>
728
729    </patternset>
730
731    <patternset 
732        id="abcl.source.misc"
733        description="Additional includes in the source distribution relative to source root">
734      <include name="org/armedbear/lisp/LICENSE"/>
735      <include name="manifest-abcl"/>
736      <include name="META-INF/services/javax.script.ScriptEngineFactory"/>
737    </patternset>
738
739    <target name="abcl.source.prepare" depends="abcl.stamp.version">
740      <property name="abcl.build.src.dir"
741                value="${build.dir}/abcl-src-${abcl.version}"/>
742      <mkdir dir="${abcl.build.src.dir}/src"/>
743      <copy todir="${abcl.build.src.dir}/src"
744            preservelastmodified="true">
745        <fileset dir="${src.dir}"
746                 id="abcl.source.src">
747            <patternset refid="abcl.source.java"/>
748            <patternset refid="abcl.source.lisp"/>
749            <patternset refid="abcl.source.misc"/>
750        </fileset>
751      </copy>
752      <copy todir="${abcl.build.src.dir}"
753            preservelastmodified="true">
754        <fileset dir="${basedir}">
755            <patternset refid="abcl.dist.misc"/>
756        </fileset>
757      </copy>
758    </target>
759
760    <!--  Files in source distribution that always get LF EOL (aka
761         'unix') -->   
762    <patternset id="abcl.dist.lf">
763      <include name="abcl.in"/>
764    </patternset>
765
766    <!--  Files in source distribution that always get CRLF EOL (aka
767         'dos') -->   
768    <patternset id="abcl.dist.crlf">
769      <include name="abcl.bat.in"/>
770    </patternset>
771
772    <target name="abcl.source.unix" depends="abcl.source.prepare">
773      <fixcrlf srcdir="${abcl.build.src.dir}"
774               preservelastmodified="true"
775               eol="lf">
776      </fixcrlf>
777
778      <fixcrlf srcdir="${abcl.build.src.dir}"
779               preservelastmodified="true"
780               eol="crlf">
781          <patternset refid="abcl.dist.crlf"/>
782      </fixcrlf>
783
784      <fixcrlf srcdir="${abcl.build.src.dir}"
785               preservelastmodified="true"
786               eol="lf">
787          <patternset refid="abcl.dist.lf"/>
788      </fixcrlf>
789    </target>
790
791    <target name="abcl.source.tar" depends="abcl.source.unix">
792      <mkdir dir="${dist.dir}"/>
793      <tar destfile="${dist.dir}/abcl-src-${abcl.version}.tar.gz"
794           compression="gzip">
795        <tarfileset dir="${build.dir}">
796          <include name="abcl-src-${abcl.version}/**"/>
797        </tarfileset>
798      </tar>
799    </target>
800
801    <target name="abcl.source.windows" depends="abcl.source.prepare">
802      <fixcrlf srcdir="${abcl.build.src.dir}"
803               preservelastmodified="true"
804               eol="crlf">
805      </fixcrlf>
806
807      <fixcrlf srcdir="${abcl.build.src.dir}"
808               preservelastmodified="true"
809               eol="crlf">
810          <patternset refid="abcl.dist.crlf"/>
811      </fixcrlf>
812
813      <fixcrlf srcdir="${abcl.build.src.dir}"
814               preservelastmodified="true"
815               eol="lf">
816          <patternset refid="abcl.dist.lf"/>
817      </fixcrlf>
818    </target>
819
820    <target name="abcl.source.zip" depends="abcl.stamp,abcl.source.windows">
821      <mkdir dir="${dist.dir}"/>
822      <zip destfile="${dist.dir}/abcl-src-${abcl.version}.zip"
823           compress="true">
824        <zipfileset dir="${abcl.build.src.dir}" prefix="abcl-src-${abcl.version}"/>
825      </zip>
826    </target>
827
828    <target name="abcl.source.jar" depends="abcl.stamp,abcl.source.unix">
829      <mkdir dir="${dist.dir}"/>
830      <jar destfile="${dist.dir}/abcl-${abcl.version}-sources.jar">
831        <metainf dir="${abcl.build.src.dir}">
832          <include name="COPYING"/>
833        </metainf>
834        <fileset dir="${abcl.build.src.dir}/src">
835          <include name="**/*.java"/>
836          <include name="**/*.lisp"/>
837        </fileset>
838      </jar>
839    </target>
840
841    <property name="abcl.javadoc.dir" value="${build.dir}/javadoc"/>
842
843    <target name="abcl.javadoc" depends="abcl.stamp">
844      <mkdir dir="${abcl.javadoc.dir}"/>
845      <javadoc destdir="${abcl.javadoc.dir}"
846               sourcepath="${src.dir}"/>
847    </target>
848   
849    <target name="abcl.javadoc.jar" depends="abcl.stamp.version,abcl.javadoc">
850      <mkdir dir="${dist.dir}"/>
851      <jar destfile="${dist.dir}/abcl-${abcl.version}-javadoc.jar">
852        <fileset dir="${abcl.javadoc.dir}"/>
853      </jar>
854    </target>
855
856    <target name="abcl.binary.prepare" depends="abcl.jar,abcl.contrib,abcl.documentation,abcl.stamp.version">
857      <property name="abcl.build.binary.dir"
858                value="${build.dir}/abcl-bin-${abcl.version}"/>
859      <mkdir dir="${abcl.build.binary.dir}"/>
860      <copy todir="${abcl.build.binary.dir}"
861            preservelastmodified="true">
862        <fileset dir="${basedir}/dist">
863          <patternset>
864            <include name="abcl.jar"/>
865            <include name="abcl-contrib.jar"/>
866            <include name="*.pdf"/>
867          </patternset>
868        </fileset>
869        <fileset dir="${basedir}">
870          <patternset>
871            <include name="README"/>
872            <include name="CHANGES"/>
873          </patternset>
874        </fileset>
875      </copy>
876    </target>
877
878    <target name="abcl.binary.tar" depends="abcl.binary.prepare">
879      <tar destfile="${dist.dir}/abcl-bin-${abcl.version}.tar.gz"
880           compression="gzip">
881        <tarfileset dir="${build.dir}">
882          <include name="abcl-bin-${abcl.version}/**"/>
883          </tarfileset>
884      </tar>
885    </target>
886
887    <target name="abcl.binary.zip" depends="abcl.binary.prepare">
888      <zip destfile="${dist.dir}/abcl-bin-${abcl.version}.zip"
889           compress="true">
890        <zipfileset dir="${abcl.build.binary.dir}" prefix="abcl-bin-${abcl.version}"/>
891      </zip>
892    </target>
893
894    <target name="help.test">
895      <echo>
896The following Ant targets run various test suites:
897 
898  abcl.test
899    --  Run all available tests.
900  abcl.test.java
901    --  Run the ABCL junit Java tests under ${basedir}/test/src/
902  abcl.test.lisp
903    --  Run the 'test.ansi.compiled', 'test.abcl', 'test.cl-bench' targets
904  test.ansi.compiled
905    --  Run the compiled version of the ANSI test suite
906  test.abcl
907    --  Run the Lisp RT tests collected in ${basedir}/test/lisp/abcl/
908  test.cl-bench
909    --  Run the cl-bench test suite.
910
911The ANSI tests require that the [ansi-tests][1] be manually installed in
912${basedir}/../ansi-tests.
913
914[1]: git+https://gitlab.common-lisp.net/ansi-test/ansi-test.git
915
916The CL-BENCH tests require that [cl-bench][2] be manually installed in
917${basedir}/../cl-bench
918
919[2]: http://www.chez.com/emarsden/downloads/cl-bench.tar.gz
920      </echo>
921    </target>
922
923    <property name="abcl.test.classes.dir"
924              value="${build.dir}/classes-test"/>
925
926    <property name="abcl.test.src.dir"
927              value="${basedir}/test/src"/>
928
929    <patternset id="abcl.test.source.java">
930      <include name="org/armedbear/lisp/**/*.java"/>
931    </patternset>
932
933    <property name="junit.path"
934              value="${abcl.ext.dir}/junit-4.8.1.jar"/>
935
936
937    <path id="abcl.test.compile.classpath">
938      <pathelement location="${junit.path}"/>
939      <pathelement location="${build.classes.dir}"/>
940    </path>
941
942    <target name="abcl.test.pre-compile" depends="abcl.ext"/>
943
944    <target name="abcl.ext.p">
945      <!--XXX generalize over enumeration of all contributions to
946           abcl.ext if we get more of them.  -->
947      <available file="${junit.path}" property="abcl.ext.p"/>
948    </target>
949    <target name="abcl.ext" depends="abcl.ext.p" unless="abcl.ext.p">
950
951      <mkdir dir="${abcl.ext.dir}"/>
952      <get 
953          src="http://cloud.github.com/downloads/KentBeck/junit/junit-4.8.1.jar"
954          usetimestamp="true"
955          dest="${junit.path}"/>
956    </target>
957       
958    <target name="abcl.test.compile" 
959            depends="abcl.test.pre-compile">
960      <mkdir dir="${abcl.test.classes.dir}"/>
961      <javac destdir="${abcl.test.classes.dir}"
962             classpathref="abcl.test.compile.classpath"
963             debug="true"
964             target="1.5">
965        <src path="${abcl.test.src.dir}"/>
966        <patternset refid="abcl.test.source.java"/>
967      </javac>
968    </target>
969
970    <path id="abcl.test.run.classpath">
971      <path refid="abcl.test.compile.classpath"/>
972      <pathelement location="${abcl.test.classes.dir}"/>
973    </path>
974
975    <target name="abcl.test" 
976            depends="abcl.test.java,abcl.test.lisp"/>
977       
978    <target name="abcl.test.java" depends="abcl.test.compile">
979      <java fork="true"
980            classpathref="abcl.test.run.classpath"
981            classname="org.junit.runner.JUnitCore">
982        <arg value="org.armedbear.lisp.PathnameTest"/>
983        <arg value="org.armedbear.lisp.StreamTest"/>
984        <arg value="org.armedbear.lisp.SeekableStringWriterTest"/>
985        <arg value="org.armedbear.lisp.UtilitiesTest"/>
986    <!-- currently hangs(!) the running process
987        <arg value="org.armedbear.lisp.util.HttpHeadTest"/>
988    -->
989      </java>
990    </target>
991
992    <target name="abcl.test.lisp" 
993            depends="test.ansi.compiled,test.abcl,test.cl-bench"/>
994
995    <target name="test.ansi.interpreted" depends="abcl.jar">
996      <echo>Recording test output in ${abcl.test.log.file}.</echo>
997      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
998      <java fork="true" dir="${basedir}"
999            classpathref="abcl.classpath.dist"
1000            classname="org.armedbear.lisp.Main">
1001        <arg value="--noinit"/> 
1002        <arg value="--eval"/><arg value="(require (quote asdf))"/>
1003        <arg value="--eval"/>
1004          <arg value="(asdf:initialize-source-registry `(:source-registry (:directory ,*default-pathname-defaults*) :inherit-configuration)))"/>
1005        <arg value="--eval"/><arg value="(asdf:load-system :abcl)"/>
1006        <arg value="--eval"/><arg value="(asdf:test-system :ansi-interpreted)"/>
1007        <arg value="--eval"/><arg value="(ext:exit)"/>
1008      </java>
1009      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
1010      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
1011    </target>
1012
1013    <target name="test.ansi.compiled" depends="abcl.jar">
1014      <echo>Recording test output in ${abcl.test.log.file}.</echo>
1015      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
1016      <java fork="true" dir="${basedir}"
1017            classpathref="abcl.classpath.dist"
1018            classname="org.armedbear.lisp.Main">
1019        <!-- Run in 64bit mode-->
1020        <jvmarg value="-d64"/> 
1021
1022        <!-- Enable JVM assertions -->
1023        <jvmarg value="-ea"/> 
1024       
1025        <!-- (Possibly) unload classes when reference count reaches zero -->
1026        <jvmarg value="-XX:+CMSClassUnloadingEnabled"/> 
1027
1028        <!-- Increase the size of the space used to store JVM class metadata. -->
1029        <jvmarg value="-XX:MaxPermSize=768m"/> 
1030
1031        <arg value="--noinit"/> 
1032        <arg value="--eval"/><arg value="(require (quote asdf))"/>
1033        <arg value="--eval"/>
1034          <arg value="(asdf:initialize-source-registry `(:source-registry (:directory ,*default-pathname-defaults*) :inherit-configuration)))"/>
1035        <arg value="--eval"/><arg value="(asdf:load-system :abcl)"/>
1036        <arg value="--eval"/><arg value="(asdf:test-system :ansi-compiled)"/>
1037        <arg value="--eval"/><arg value="(ext:exit)"/>
1038      </java>
1039      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
1040      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
1041    </target>
1042
1043    <target name="test.abcl" depends="abcl.jar">
1044      <echo>Recording test output in ${abcl.test.log.file}.</echo>
1045      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
1046      <java fork="true" dir="${basedir}"
1047            classpathref="abcl.classpath.dist"
1048            classname="org.armedbear.lisp.Main">
1049        <arg value="--noinit"/> 
1050        <arg value="--eval"/><arg value="(require (quote asdf))"/>
1051        <arg value="--eval"/>
1052          <arg value="(asdf:initialize-source-registry `(:source-registry (:directory ,*default-pathname-defaults*) :inherit-configuration)))"/>
1053        <arg value="--eval"/><arg value="(asdf:load-system :abcl)"/>
1054        <arg value="--eval"/><arg value="(asdf:test-system :abcl-test-lisp)"/>
1055        <arg value="--eval"/><arg value="(ext:exit)"/>
1056      </java>
1057      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
1058      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
1059    </target>
1060
1061    <target name="test.cl-bench" depends="abcl.jar">
1062      <echo>Recording test output in ${abcl.test.log.file}.</echo>
1063      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
1064      <java fork="true" dir="${basedir}"
1065            classpathref="abcl.classpath.dist"
1066            classname="org.armedbear.lisp.Main">
1067        <arg value="--noinit"/> 
1068        <arg value="--eval"/><arg value="(require (quote asdf))"/>
1069        <arg value="--eval"/>
1070          <arg value="(asdf:initialize-source-registry `(:source-registry (:directory ,*default-pathname-defaults*) :inherit-configuration)))"/>
1071        <arg value="--eval"/><arg value="(asdf:load-system :abcl)"/>
1072        <arg value="--eval"/><arg value="(asdf:test-system :cl-bench)"/>
1073        <arg value="--eval"/><arg value="(ext:exit)"/>
1074      </java>
1075      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
1076      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
1077    </target>
1078
1079
1080<target name="abcl.diagnostic" 
1081        description="Emit diagnostics describing available hosting JVM properties."
1082        depends="abcl.build.diagnostic"/>
1083<!--
1084
1085urn:org.abcl.build.ant.targets.diagnostic
1086
1087"Possible JVM values from"
1088
1089http://docs.oracle.com/javase/6/docs/api/java/lang/System.html#getProperties
1090
1091.
1092
1093
1094java.version  Java Runtime Environment version
1095java.vendor   Java Runtime Environment vendor
1096java.vendor.url   Java vendor URL
1097java.home   Java installation directory
1098java.vm.specification.version   Java Virtual Machine specification version
1099java.vm.specification.vendor  Java Virtual Machine specification vendor
1100java.vm.specification.name  Java Virtual Machine specification name
1101java.vm.version   Java Virtual Machine implementation version
1102java.vm.vendor  Java Virtual Machine implementation vendor
1103java.vm.name  Java Virtual Machine implementation name
1104java.specification.version  Java Runtime Environment specification version
1105java.specification.vendor   Java Runtime Environment specification vendor
1106java.specification.name   Java Runtime Environment specification name
1107java.class.version  Java class format version number
1108java.class.path   Java class path
1109java.library.path   List of paths to search when loading libraries
1110java.io.tmpdir  Default temp file path
1111java.compiler   Name of JIT compiler to use
1112java.ext.dirs   Path of extension directory or directories
1113os.name   Operating system name
1114os.arch   Operating system architecture
1115os.version  Operating system version
1116file.separator  File separator ("/" on UNIX)
1117path.separator  Path separator (":" on UNIX)
1118line.separator  Line separator ("\n" on UNIX)
1119user.name   User's account name
1120user.home   User's home directory
1121user.dir
1122
1123-->
1124
1125<target name="abcl.build.diagnostic" description="Emit diagnostics describing available hosting JVM properties.">
1126  <echo>:java.version    ${java.version}</echo>
1127  <echo>:java.vendor     ${java.vendor}</echo>
1128  <echo>:java.vm.vendor  ${java.vm.vendor}</echo>
1129  <echo>:java.vm.name    ${java.vm.name}</echo>
1130
1131  <echo>:os.name    ${os.name}</echo>
1132  <echo>:os.arch    ${os.arch}</echo>
1133  <echo>:os.version ${os.version}</echo>
1134 
1135  <echo>:java.specification.version       ${java.specification.version}</echo>
1136  <echo>:java.vm.specification.version    ${java.vm.specification.version}</echo>
1137</target>
1138
1139    <target name="abcl.release" 
1140            depends="abcl.clean,abcl.binary.tar,abcl.source.tar,abcl.binary.zip,abcl.source.zip">
1141      <copy file="${abcl.jar.path}"
1142            tofile="${dist.dir}/abcl-${abcl.version}.jar"/>
1143      <copy file="${abcl-contrib.jar}"
1144            tofile="${dist.dir}/abcl-contrib-${abcl.version}.jar"/>
1145    </target>
1146
1147    <target name="abcl.documentation"
1148            depends="abcl.documentation.manual,abcl.documentation.asdf"/>
1149    <target name="abcl.documentation.manual"
1150            depends="abcl.stamp.version">
1151      <echo>This target requires 'make' and a LaTeX installation to be on the PATH.</echo>
1152      <exec
1153          executable="make"
1154          dir="${basedir}/doc/manual"/>
1155      <copy file="doc/manual/abcl.pdf"
1156            tofile="${dist.dir}/abcl-${abcl.version}.pdf"/>
1157    </target>
1158    <target name="abcl.documentation.asdf">
1159      <echo>This target requires 'texi2pdf' to be on the PATH.</echo>
1160      <exec
1161          executable="texi2pdf"
1162          dir="${basedir}/doc/asdf">
1163        <arg value="asdf.texinfo"/>
1164      </exec>
1165      <copy file="doc/asdf/asdf.pdf"
1166            tofile="${dist.dir}/asdf.pdf"/>
1167    </target>
1168
1169    <import file="netbeans-build.xml" optional="true"/> 
1170<!--    <import file="j-build.xml" optional="true"/>  -->
1171    <import file="not.org-build.xml" optional="true"/> 
1172   
1173    <import file="build-snapshot.xml" optional="true"/>
1174
1175    <import file="build-maven.xml" optional="true"/>
1176</project>
1177
1178
1179
1180
Note: See TracBrowser for help on using the repository browser.