root/trunk/ProjectFortress/build.xml @ 3244

Revision 3244, 44.4 KB (checked in by EricAllen, 11 months ago)

Implemented autogeneration of extractor objects for Scala code.
Threaded recording of operator methods with parametric names through static environments.
Cleaned up formatting of some code.

Line 
1<?xml version="1.0" ?>
2
3<!--
4Copyright 2008 Sun Microsystems, Inc.,
54150 Network Circle, Santa Clara, California 95054, U.S.A.
6All rights reserved.
7
8U.S. Government Rights - Commercial software.
9Government users are subject to the Sun Microsystems, Inc. standard
10license agreement and applicable provisions of the FAR and its supplements.
11
12Use is subject to license terms.
13
14This distribution may include materials developed by third parties.
15
16Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
17trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
18-->
19
20<!--
21This is the main Ant build file for the Fortress reference
22implementation. Declarations are separated by type (e.g., taskdefs,
23properties, targets, etc.). To add a new declaration, please find the
24appropriate place in the file. For the sake of readability, please
25maintain proper indentation.
26-->
27
28<project name="Fortress" default="help">
29  <description>
30    A reference implementation of the Fortress programming language.
31  </description>
32
33
34  <!--
35       Properties
36  -->
37
38  <!-- Global properties for this build. -->
39  <property name="packagePrefix" value="com/sun/fortress"/>
40  <property name="package.prefix" value="com.sun.fortress"/>
41  <property name="interpreterPrefix" value="com/sun/fortress/interpreter"/>
42  <property name="interpreter.prefix" value="com.sun.fortress.interpreter"/>
43  <property name="blahblahblah" value="com/sun/fortress"/>
44
45  <!-- Directories in the ${basedir} directory -->
46  <property name="cache0" location="${basedir}/../default_repository/caches"/>
47  <property name="cache1" location="${basedir}/../.fortress_cache"/>
48  <property name="cache2" location="${basedir}/../.interpreter_cache"/>
49  <property name="cache3" location="${basedir}/.interpreter_cache"/>
50  <property name="cache4" location="${basedir}/../.syntax_cache"/>
51  <property name="cache5" location="${basedir}/.syntax_cache"/>
52  <property name="cache6" location="${basedir}/../.analyzed_cache"/>
53  <property name="cache7" location="${basedir}/.analyzed_cache"/>
54  <property name="cache8" location="${basedir}/../.presyntax_cache"/>
55  <property name="cache9" location="${basedir}/.presyntax_cache"/>
56  <property name="cache10" location="${basedir}/../.bytecode_cache"/>
57  <property name="cache11" location="${basedir}/.bytecode_cache"/>
58  <property name="cache12" location="${basedir}/../local_repository/caches"/>
59  <property name="astgen.src" location="${basedir}/astgen"/>
60  <property name="build" location="${basedir}/build"/>
61  <property name="docs" location="${basedir}/docs"/>
62  <property name="src" location="${basedir}/src"/>
63  <property name="library" location="${basedir}/../Library"/>
64  <property name="astgen.generators.src"
65            location="${src}/${packagePrefix}/astgen"/>
66
67  <!-- Third party jar files -->
68  <property name="asm" location="${basedir}/third_party/asm"/>
69  <property name="astgen.third" location="${basedir}/third_party/astgen"/>
70  <property name="jsr166y" location="${basedir}/third_party/jsr166y"/>
71  <property name="junit" location="${basedir}/third_party/junit"/>
72  <property name="plt" location="${basedir}/third_party/plt"/>
73  <property name="unicode.third" location="${basedir}/third_party/unicode"/>
74  <property name="xtc" location="${basedir}/third_party/xtc"/>
75  <property name="unsigned" location="${basedir}/third_party/unsigned"/>
76
77  <!-- Scala jar files -->
78  <property name="scala-compiler.jar"
79            value="${basedir}/third_party/scala/scala-compiler-2.7.1.jar"/>
80  <property name="scala-library.jar"
81            value="${basedir}/third_party/scala/scala-library-2.7.1.jar"/>
82
83  <!-- ASTGen -->
84  <property name="generate-sourcefile" value="${astgen.src}/Fortress.ast" />
85
86  <!-- Package nodes -->
87  <property name="nodesPackage" value="${packagePrefix}/nodes"/>
88  <property name="scala.nodes.package" value="${packagePrefix}/scala_src/nodes"/>
89  <property name="nodes"  location="${src}/${nodesPackage}"/>
90  <property name="scala.nodes"  location="${src}/${scala.nodes.package}"/>
91  <property name="nodesBuild" location="${build}/${nodesPackage}"/>
92
93  <!-- Package nodes_util -->
94  <property name="nodesUtil"  location="${src}/${packagePrefix}/nodes_util"/>
95
96  <!-- Parser packages -->
97  <property name="parser"  location="${src}/${packagePrefix}/parser"/>
98  <property name="preparser" location="${src}/${packagePrefix}/parser/preparser"/>
99  <property name="templateparser"
100            location="${src}/${packagePrefix}/parser/templateparser"/>
101  <property name="parserUtil"  location="${src}/${packagePrefix}/parser_util"/>
102  <property name="precedence" location="${parserUtil}/precedence"/>
103  <property name="precedenceResolver"
104            location="${parserUtil}/precedence_resolver"/>
105
106  <!-- Unicode packages -->
107  <property name="unicodePackage" value="${packagePrefix}/unicode"/>
108  <property name="unicode" location="${src}/${packagePrefix}/unicode"/>
109  <property name="unicodeBuild" location="${build}/${unicodePackage}"/>
110
111  <!-- Package useful -->
112  <property name="usefulPackage" value="${packagePrefix}/useful"/>
113
114  <!-- For fortress installation -->
115  <property name="testFortress" location=".TEST_FORTRESS"/>
116  <property name="installerDir" location=".installer"/>
117  <property name="protofortress" location="${basedir}/fortress/FORTRESS"/>
118  <property name="protofortress.lib" location="${protofortress}/lib"/>
119
120  <!-- Instrumentation -->
121  <property name="instrumentation.package"
122            value="${package.prefix}.parser_util.instrumentation"/>
123  <property name="instrumentationPackage"
124            value="${packagePrefix}/parser_util/instrumentation"/>
125  <property name="instrumentation.outfile"
126            location="${parserUtil}/instrumentation/coverage-report.txt"/>
127  <property name="instrumentation.transient"
128            location="${parserUtil}/instrumentation/transient.txt"/>
129
130  <!-- For tests -->
131  <property name="test.results" location="${basedir}/TEST-RESULTS"/>
132
133  <!-- Other settings -->
134  <property name="junitMem" value="768m"/>
135  <property name="junit.dir" value="junit-results"/>
136  <property environment="env"/>
137  <condition property="correct.environment">
138    <and>
139      <equals arg1="${ant.java.version}" arg2="1.5"/>
140      <equals arg1="${env.ANT_CALLED_FROM_SCRIPT}" arg2='yes'/>
141    </and>
142  </condition>
143
144
145  <!--
146       Paths
147  -->
148  <path id="scala.classpath">
149    <pathelement location="${scala-compiler.jar}"/>
150    <pathelement location="${scala-library.jar}"/>
151  </path>
152
153  <path id="astgen.path">
154    <path refid="scala.classpath"/>
155    <pathelement location="${astgen.third}/astgen.jar" />
156    <pathelement location="${build}" />
157  </path>
158
159  <path id="astgen.classpath">
160    <path refid="scala.classpath"/>
161    <pathelement location="${build}"/>
162    <pathelement location="${astgen.third}/astgen.jar"/>
163  </path>
164
165  <path id="instrumentedparser.classpath">
166    <path refid="scala.classpath"/>
167    <pathelement location="${build}"/>
168    <pathelement location="${xtc}/xtc.jar"/>
169    <pathelement location="${plt}/plt.jar"/>
170  </path>
171
172  <path id="compile.classpath">
173    <path refid="scala.classpath"/>
174    <pathelement location="${build}"/>
175    <pathelement location="${asm}/asm-3.1.jar"/>
176    <pathelement location="${xtc}/xtc.jar"/>
177    <pathelement location ="${unsigned}/unsigned.jar"/>
178    <pathelement location="${jsr166y}/jsr166y.jar"/>
179    <pathelement location="${plt}/plt.jar"/>
180    <pathelement location="${astgen.third}/astgen.jar" />
181    <pathelement location="${junit}/junit.jar"/>
182    <pathelement location="${ant.home}/lib/ant.jar"/>
183    <pathelement location="${java.home}/../lib/tools.jar"/>
184  </path>
185
186  <!--
187       Taskdefs
188  -->
189  <taskdef resource="scala/tools/ant/antlib.xml">
190    <classpath refid="scala.classpath"/>
191  </taskdef>
192
193
194  <!--
195       Targets
196  -->
197  <target name="help">
198    <echo message="ant checkEnv, checkNodesUptodate, checkOperatorsUptodate,
199                   checkParserUptodate, clean, cleanCache, compile,
200                   compileCommon, compileCommonLint, compileLint, doc,
201                   grammarCoverage, help, init, interpreter-jar,
202                   makeAST, operatorsGen, fortressparser, preparser,
203                   parser, reportNotPassing, systemProperties, test,
204                   testAll, testDemos, testSystem, testOnly
205                   -DtestPattern='some pattern', testCruiseControl"/>
206    <echo message="If you are building Fortress, you want ant compile or ant test."/>
207  </target>
208
209  <target name="systemProperties">
210    <echo message="Environment variables set correctly? ${correct.environment}"/>
211    <echo message="basedir: ${basedir}"/>
212    <echo message="Ant Java version: ${ant.java.version}"/>
213    <echo message="Ant called from script? ${env.ANT_CALLED_FROM_SCRIPT}"/>
214    <echo message="ANT_ARGS: ${env.ANT_ARGS}"/>
215    <echo message="ANT_OPTS: ${env.ANT_OPTS}"/>
216    <echo message="Java Runtime Environment
217                   version: ${java.version}"/>
218    <echo message="Java Runtime Environment
219                   vendor: ${java.vendor}"/>
220    <echo message="Java Runtime Environment
221                   vendor URL: ${java.vendor.url}"/>
222    <echo message="Java installation
223                   directory: ${java.home}"/>
224    <echo message="Java Virtual Machine
225                   specification version:
226                   ${java.vm.specification.version}"/>
227    <echo message="Java Virtual Machine
228                   specification vendor:
229                   ${java.vm.specification.vendor}"/>
230    <echo message="Java Virtual Machine
231                   specification name:
232                   ${java.vm.specification.name}"/>
233    <echo message="Java Virtual Machine
234                   implementation version:
235                   ${java.vm.version}"/>
236    <echo message="Java Virtual Machine
237                   implementation vendor:
238                   ${java.vm.vendor}"/>
239    <echo message="Java Virtual Machine
240                   implementation name: ${java.vm.name}"/>
241    <echo message="Java Runtime Environment
242                   specification version:
243                   ${java.specification.version}"/>
244    <echo message="Java Runtime Environment
245                   specification vendor:
246                   ${java.specification.vendor}"/>
247    <echo message="Java Runtime Environment
248                   specification name:
249                   ${java.specification.name}"/>
250    <echo message="Java class format version
251                   number: ${java.class.version}"/>
252    <echo message="Java class path:
253                   ${java.class.path}"/>
254    <echo message="List of paths to search when
255                   loading libraries: ${java.library.path}"/>
256    <echo message="Path of extension directory
257                   or directories: ${java.ext.dirs}"/>
258    <echo message="Default temp file path:
259                   ${java.io.tmpdir}"/>
260    <echo message="Operating system name:
261                   ${os.name}"/>
262    <echo message="Operating system
263                   architecture: ${os.arch}"/>
264    <echo message="Operating system version:
265                   ${os.version}"/>
266  </target>
267
268  <target name="checkEnv">
269    <echo message="Environment variables set correctly? ${correct.environment}"/>
270    <fail unless="correct.environment"
271          message="ERROR: This build script requires specific command-line arguments to Ant. Please call it using the script provided at ${basedir}/ant."/>
272  </target>
273
274  <target name="init">
275    <echo message="basedir: ${basedir}"/>
276    <!-- Create the time stamp. -->
277    <tstamp/>
278    <!-- Create the build directory structure used by compile. -->
279    <mkdir dir="${build}"/>
280    <mkdir dir="${junit.dir}"/>
281  </target>
282
283  <target name="clean" depends="cleanCache"
284          description="Delete the ${build} directory tree and generated files.">
285    <delete dir="${build}"/>
286    <delete dir="${nodes}"/>
287    <delete dir="${junit.dir}"/>
288
289    <!-- No longer needed, but eases the upgrade-->
290    <delete file="${nodesUtil}/BaseNodeMaker.java"/>
291    <!-- No longer needed, but eases the upgrade-->
292    <delete file="${nodesUtil}/InterfaceMaker.java"/>
293    <delete file="${parser}/Fortress.java"/>
294    <delete file="${parser}/FortressInstrumented.java"/>
295    <delete file="${preparser}/PreFortress.java"/>
296    <delete file="${templateparser}/TemplateParser.java"/>
297    <delete file="${precedenceResolver}/Operators.java"/>
298    <!-- No longer needed, but eases the upgrade-->
299    <delete file="${src}/com/sun/fortress/parser/precedence/resolver/Operators.java"/>
300    <delete file="${instrumentation.outfile}"/>
301    <delete file="${library}/FortressAst.fsi" />
302    <delete file="${library}/FortressAst.fss" />
303    <delete file="${astgen.src}/FortressAst.scala" />
304    <delete file="FortressLibrary.ast"/>
305    <delete file="FortressLibrary.tfs"/>
306    <delete file="${basedir}/tests/printing/test_output.txt" />
307    <delete file="testFile.txt"/>
308    <delete file="${src}/com/sun/fortress/scala_src/nodes/FortressAst.scala" />
309    <delete dir="${src}/com/sun/fortress/scalasrc" />
310    <delete dir="${basedir}/test-tmp" />
311    <delete>
312      <fileset dir="src" includes="**/*.class" />
313    </delete>
314  </target>
315
316  <target name="cleanCache"
317          description="Delete any cached Fortress ASTs in the development tree">
318    <delete dir="${cache0}"/>
319    <delete dir="${cache1}"/>
320    <delete dir="${cache2}"/>
321    <delete dir="${cache3}"/>
322    <delete dir="${cache4}"/>
323    <delete dir="${cache5}"/>
324    <delete dir="${cache6}"/>
325    <delete dir="${cache7}"/>
326    <delete dir="${cache8}"/>
327    <delete dir="${cache9}"/>
328    <delete dir="${cache10}"/>
329    <delete dir="${cache11}"/>
330    <delete dir="${cache12}"/>
331  </target>
332
333  <!-- Generation of Operators.java depends only on the files listed below.
334       Note that there are class files it depends on; if these class files are
335       not up to date with respect to their sources, they are themselves
336       recompiled by the compileCommon target.-->
337  <target name="checkOperatorsUptodate" depends="init, compileCommon">
338    <condition property="operators.uptodate">
339      <and>
340        <uptodate srcfile="${unicode.third}/UnicodeData.500.txt"
341                  targetfile="${precedenceResolver}/Operators.java"/>
342        <uptodate srcfile="${precedenceResolver}/operators.txt"
343                  targetfile="${precedenceResolver}/Operators.java"/>
344        <uptodate srcfile="${unicodeBuild}/OperatorStuffGenerator.class"
345                  targetfile="${precedenceResolver}/Operators.java"/>
346        <uptodate srcfile="${unicodeBuild}/Element.class"
347                  targetfile="${precedenceResolver}/Operators.java"/>
348      </and>
349    </condition>
350    <echo message="Operators up to date? ${operators.uptodate}"/>
351  </target>
352
353  <target name="operatorsGen"  unless="operators.uptodate"
354          depends="init, compileCommon, checkOperatorsUptodate"
355          description="Automatically generate visitors for AST nodes.">
356    <echo message="Regenerating operators"/>
357    <java classname="${package.prefix}.unicode.OperatorStuffGenerator"
358          fork="true">
359      <classpath>
360        <pathelement location="${build}"/>
361        <pathelement location="${basedir}/third_party/plt/plt.jar"/>
362      </classpath>
363    </java>
364  </target>
365
366  <target name="DumpProperties"
367          description="Dump properties as seen by a Java program.">
368    <java classname="${package.prefix}.repository.DumpProperties"
369          fork="true">
370      <sysproperty key="DEBUG" value="true"/>
371      <classpath>
372        <pathelement location="${build}"/>
373      </classpath>
374    </java>
375  </target>
376
377  <target name="checkAstgen">
378    <condition property="astgenerators.uptodate">
379      <uptodate targetfile="${basedir}/build/com/sun/fortress/astgen/FortressAstGenerator.class">
380        <srcfiles dir="${basedir}/src/com/sun/fortress/astgen/" includes="*.java"/>
381      </uptodate>
382    </condition>
383  </target>
384
385  <target name="astGenerators"
386          unless="astgenerators.uptodate"
387          depends="init,checkAstgen"
388          description="Compile all ASTGen custom generators.">
389    <depend srcdir="${astgen.generators.src}"
390            destdir="${build}"
391            closure="yes"
392            cache="${basedir}/.dependencies"/>
393    <javac
394        srcdir="${astgen.generators.src}"
395        destdir="${build}"
396        source="1.5"
397        debug="true"
398        includeantruntime="false"
399        fork="true"
400        memorymaximumsize="${junitMem}">
401      <!-- Uncomment the following line to print unchecked warnings
402           (here and in the 'compileCommon' target. -->
403      <!-- <compilerarg value="-Xlint:unchecked"/> -->
404      <classpath refid="astgen.classpath"/>
405      <include name="**/*.java"/>
406      <exclude name="${usefulPackage}/*.java"/>
407      <exclude name="${unicodePackage}/*.java"/>
408    </javac>
409    <scalac
410        srcdir="${astgen.generators.src}"
411        destdir="${build}"
412        classpathref="astgen.classpath"
413        addparams="">
414      <include name="**/*.scala"/>
415      <exclude name="${usefulPackage}/*.scala"/>
416      <exclude name="${unicodePackage}/*.scala"/>
417    </scalac>
418  </target>
419
420  <target name="checkNodesUptodate" depends="astGenerators">
421    <condition property="nodes.uptodate">
422      <and>
423        <available file="${nodes}/AbstractNode.java"/>
424        <uptodate srcfile="${astgen.src}/Fortress.ast"
425                  targetfile="${nodes}/AbstractNode.java"/>
426        <available file="${library}/FortressAst.fsi" />
427        <uptodate srcfile="${astgen.src}/Fortress.ast"
428                  targetfile="${library}/FortressAst.fsi" />
429        <available file="${library}/FortressAst.fss" />
430        <uptodate srcfile="${astgen.src}/Fortress.ast"
431                  targetfile="${library}/FortressAst.fss" />
432        <uptodate targetfile="${library}/FortressAst.fsi">
433          <srcfiles dir="${basedir}/src/com/sun/fortress/astgen/" includes="**/*.java"/>
434        </uptodate>
435      </and>
436    </condition>
437    <echo message="Nodes up to date? ${nodes.uptodate}"/>
438  </target>
439
440  <taskdef name="astgen" classpath="${astgen.third}/astgen.jar;${build}"
441           classname="edu.rice.cs.astgen.AntTask"/>
442
443  <target name="makeAST" unless="nodes.uptodate" depends="checkNodesUptodate"
444          description="Automatically generate AST nodes.">
445    <echo message="Processing ${generate-sourcefile}" />
446    <astgen file="${generate-sourcefile}" />
447    <move todir="${nodes}">
448      <fileset dir="${astgen.src}">
449        <include name="**/*.java"/>
450        <exclude name="**/Fortress.ast"/>
451      </fileset>
452    </move>
453    <move todir="${library}">
454      <fileset dir="${astgen.src}">
455        <include name="FortressAst.fss" />
456        <include name="FortressAst.fsi" />
457      </fileset>
458    </move>
459    <move todir="${scala.nodes}">
460      <fileset dir="${astgen.src}">
461        <include name="FortressAst.scala" />
462      </fileset>
463    </move>
464  </target>
465
466  <target name="compile" depends="compileCommon, makeAST, parser, operatorsGen"
467          description="Compile all Fortress code written in Java (Scala code is ignored).">
468    <depend srcdir="${src}"
469            destdir="${build}"
470            closure="yes"
471            cache="${basedir}/.dependencies"/>
472    <javac
473        srcdir="${src}"
474        destdir="${build}"
475        source="1.5"
476        debug="true"
477        includeantruntime="false"
478        fork="true"
479        memorymaximumsize="${junitMem}">
480      <!-- Uncomment the following line to print unchecked warnings
481           (here and in the 'compileCommon' target. -->
482      <!-- <compilerarg value="-Xlint:unchecked"/> -->
483      <classpath refid="compile.classpath"/>
484      <include name="**/*.java"/>
485      <exclude name="${usefulPackage}/*.java"/>
486      <exclude name="${unicodePackage}/*.java"/>
487    </javac>
488  </target>
489
490  <target name="compileAll" depends="compile"
491          description="Compile all Fortress code.">
492    <scalac
493        srcdir="${src}"
494        destdir="${build}"
495        classpathref="compile.classpath"
496        addparams="">
497      <include name="**/*.scala"/>
498    </scalac>
499  </target>
500
501  <target name="check.blas" depends="init">
502    <javac destdir="${build}" srcdir="${src}/com/sun/fortress/numerics">
503      <classpath refid="compile.classpath"/>
504    </javac>
505
506    <java failonerror="true"
507          classname="com.sun.fortress.numerics.CheckBlasEnvironment">
508      <classpath refid="compile.classpath"/>
509    </java>
510  </target>
511
512  <target name="check.linux">
513    <condition property="blas.islinux">
514      <equals arg1="${os.name}" arg2="Linux" />
515    </condition>
516  </target>
517
518  <target name="blas.linux" depends="check.linux" if="blas.islinux">
519    <echo message="Generating C header and stub files." />
520    <javah class="com.sun.fortress.numerics.Blas"
521           destdir="c"
522           classpath="build"
523           />
524    <echo message="Now compiling C stubs for blas on arch linux."/>
525    <exec executable="gcc" failonerror="true">
526      <arg value="-fPIC" />
527      <arg value="-Ic" />
528      <arg value="-I${env.BLAS_INCLUDE}" />
529      <arg value="-L${env.BLAS_LIB}" />
530      <arg value="-I${env.JAVA_HOME}/include" />
531      <arg value="-I${env.JAVA_HOME}/include/linux" />
532      <arg value="c/blas.c" />
533      <arg value="-lcblas" />
534      <arg value="-lblas" />
535      <arg value="-shared" />
536      <arg value="-olibblas.so" />
537    </exec>
538  </target>
539
540  <target name="check.osx">
541    <condition property="blas.is.osx">
542      <equals arg1="${os.name}" arg2="Mac OS X" />
543    </condition>
544  </target>
545
546  <target name="blas.osx" depends="check.osx" if="blas.is.osx">
547    <echo message="Generating C header and stub files." />
548    <javah class="com.sun.fortress.numerics.Blas"
549           destdir="c"
550           classpath="build"
551           />
552    <echo message="Now compiling C stubs for blas on arch OS X."/>
553    <exec executable="gcc" failonerror="true">
554      <arg line="-D OSX" />
555      <arg value="-fPIC" />
556      <arg value="-Ic" />
557      <arg line="-framework Accelerate" />
558      <arg value="-I${env.JAVA_LIB}/Headers" />
559      <arg value="c/blas.c" />
560      <arg value="-lcblas" />
561      <arg value="-lblas" />
562      <arg value="-shared" />
563      <arg value="-bundle" />
564      <arg line="-o libblas.dylib" />
565    </exec>
566  </target>
567
568  <target name="check.sunos">
569    <condition property="blas.is.sunos">
570      <equals arg1="${os.name}" arg2="SunOS" />
571    </condition>
572  </target>
573
574  <target name="blas.sunos" depends="check.sunos" if="blas.is.sunos">
575    <echo message="Generating C header and stub files." />
576    <javah class="com.sun.fortress.numerics.Blas"
577           destdir="c"
578           classpath="build"
579           />
580    <echo message="Now compiling C stubs for blas on arch SunOS."/>
581    <exec executable="cc" failonerror="true">
582      <arg line="-D SUNOS" />
583      <arg value="-fPIC" />
584      <arg value="-Ic" />
585      <arg value="-I${env.JAVA_HOME}/include" />
586      <arg value="-I${env.JAVA_HOME}/include/solaris" />
587      <arg value="c/sunperf_blas.c" />
588      <arg value="-shared" />
589      <arg value="-dalign" />
590      <arg value="-xlic_lib=sunperf" />
591      <arg value="-olibblas.so" />
592    </exec>
593  </target>
594
595  <target name="blas" depends="check.blas,blas.linux,blas.osx,blas.sunos"></target>
596
597  <target name="compileLint"
598          depends="compileCommonLint, makeAST, parser, operatorsGen"
599          description="Compile all interpreter code.">
600    <depend srcdir="${src}"
601            destdir="${build}"
602            closure="yes"
603            cache="${basedir}/.dependencies"/>
604    <javac
605        srcdir="${src}"
606        destdir="${build}"
607        source="1.5"
608        debug="true"
609        includeantruntime="false"
610        fork="true"
611        memorymaximumsize="${junitMem}">
612      <!-- Uncomment the following line to print unchecked warnings. -->
613      <classpath refid="compile.classpath"/>
614      <compilerarg value="-Xlint:unchecked"/>
615      <include name="**/*.java"/>
616      <exclude name="${usefulPackage}/*.java"/>
617      <exclude name="${unicodePackage}/*.java"/>
618    </javac>
619  </target>
620
621  <target name="compileCommon" depends="init"
622          description="Compile interpreter-indepedent code.">
623    <depend srcdir="${src}"
624            destdir="${build}"
625            closure="yes"
626            cache="${basedir}/.dependencies"/>
627    <javac
628        srcdir="${src}"
629        destdir="${build}"
630        source="1.5"
631        debug="true"
632        includeantruntime="false"
633        fork="true">
634      <!-- Uncomment the following line to print unchecked warnings. -->
635      <!-- <compilerarg value="-Xlint:unchecked"/>  -->
636      <classpath refid="compile.classpath"/>
637      <include name="${blahblahblah}/useful/*.java"/>
638      <include name="${blahblahblah}/unicode/*.java"/>
639    </javac>
640  </target>
641
642  <target name="compileCommonLint" depends="init"
643          description="Compile interpreter-indepedent code.">
644    <depend srcdir="${src}"
645            destdir="${build}"
646            closure="yes"
647            cache="${basedir}/.dependencies"/>
648    <javac
649        srcdir="${src}"
650        destdir="${build}"
651        source="1.5"
652        debug="true"
653        includeantruntime="false"
654        fork="true">
655      <classpath refid="compile.classpath"/>
656      <!-- Uncomment the following line to print unchecked warnings. -->
657      <compilerarg value="-Xlint:unchecked"/>
658      <include name="${usefulPackage}/*.java"/>
659      <include name="${unicodePackage}/*.java"/>
660    </javac>
661  </target>
662
663
664  <target name="interpreter-jar" depends="compile"
665          description="Package up the interpreter in a jar.">
666    <jar
667        destfile="../bin/interpreter.jar"
668        basedir="${build}"
669        includes="**/*"/>
670  </target>
671
672  <target name="testOnly" depends="compile"
673          description="Run specific tests (use -DtestPattern=...).">
674    <mkdir dir="${test.results}"/>
675    <mkdir dir="${basedir}/test-tmp" />
676    <junit printsummary="off"
677           haltonerror="off"
678           haltonfailure="off"
679           showoutput="yes"
680           fork="true"
681           maxmemory="${junitMem}"
682           errorProperty="tests.failed"
683           failureProperty="tests.failed">
684      <classpath refid="compile.classpath"/>
685      <jvmarg value="-Djava.io.tmpdir=${basedir}/test-tmp" />
686      <formatter type="plain" usefile="false"/>
687      <syspropertyset>
688        <propertyref prefix="plt." />
689      </syspropertyset>
690      <batchtest fork="true" todir="${test.results}">
691        <fileset dir="${build}">
692          <and>
693            <filename name="**/*${testPattern}*/**" />
694            <or>
695              <filename name="**/*JUTest.class" />
696              <filename name="**/*JxTest.class" />
697            </or>
698          </and>
699          <exclude name="**/*$*.class"/>
700        </fileset>
701      </batchtest>
702    </junit>
703    <delete dir="${basedir}/test-tmp" />
704    <fail message="Tests expected to pass are failing!" if="tests.failed"/>
705  </target>
706
707  <target name="test" depends="compileAll, testFast"
708          description="Clean, compile everything, and run all unit and system tests.">
709  </target>
710
711  <target name="testFast"
712          description="Run all unit and system tests expected to pass.">
713    <mkdir dir="${test.results}"/>
714    <mkdir dir="${basedir}/test-tmp" />
715    <junit printsummary="on"
716           haltonerror="off"
717           haltonfailure="off"
718           showoutput="yes"
719           fork="true"
720           maxmemory="${junitMem}"
721           errorProperty="tests.failed"
722           failureProperty="tests.failed">
723      <classpath refid="compile.classpath"/>
724      <jvmarg value="-Djava.io.tmpdir=${basedir}/test-tmp" />
725      <formatter type="plain" usefile="true"/>
726      <batchtest fork="true" todir="${test.results}">
727        <fileset dir="${build}">
728          <include name="**/*JUTest.class"/>
729          <include name="**/*JUTests.class"/>
730          <exclude name="**/*$*.class"/>
731          <exclude name="**/SyntaxAbstractionJUTestAll.class"/>
732          <exclude name="**/tools/AstJUTest.class"/>
733        </fileset>
734      </batchtest>
735    </junit>
736    <delete dir="${basedir}/test-tmp" />
737    <fail message="Tests expected to pass are failing!" if="tests.failed"/>
738  </target>
739
740  <target name="testCruiseControl" depends="compile"
741          description="Run all unit and system tests expected to pass.">
742    <mkdir dir="${test.results}"/>
743    <mkdir dir="${basedir}/test-tmp" />
744    <junit printsummary="on"
745           haltonerror="off"
746           haltonfailure="off"
747           showoutput="yes"
748           fork="true"
749           maxmemory="${junitMem}"
750           errorProperty="tests.failed"
751           failureProperty="tests.failed">
752      <classpath refid="compile.classpath"/>
753      <jvmarg value="-Djava.io.tmpdir=${basedir}/test-tmp" />
754      <formatter type="plain" usefile="true"/>
755      <batchtest fork="true" todir="${junit.dir}">
756        <formatter type="brief" usefile="false" />
757        <formatter type="xml" />
758        <fileset dir="${build}">
759          <include name="**/*JUTest.class"/>
760          <include name="**/*JUTests.class"/>
761          <exclude name="**/*$*.class"/>
762          <exclude name="**/SyntaxAbstractionJUTestAll.class"/>
763          <exclude name="**/tools/AstJUTest.class"/>
764        </fileset>
765      </batchtest>
766    </junit>
767    <delete dir="${basedir}/test-tmp" />
768    <fail message="Tests expected to pass are failing!" if="tests.failed"/>
769  </target>
770
771  <target name="testNotPassing" depends="compile"
772          description="Run system tests that aren't passing yet.">
773    <mkdir dir="${test.results}"/>
774    <mkdir dir="${basedir}/test-tmp" />
775    <junit printsummary="on"
776           haltonerror="off"
777           haltonfailure="off"
778           showoutput="yes"
779           fork="true"
780           maxmemory="${junitMem}"
781           errorProperty="tests.failed"
782           failureProperty="tests.failed">
783      <classpath refid="compile.classpath"/>
784      <jvmarg value="-Djava.io.tmpdir=${basedir}/test-tmp" />
785      <formatter type="brief" usefile="true"/>
786      <batchtest fork="true" todir="${test.results}">
787        <fileset dir="${build}">
788          <include name="**/*NotPassingYet.class"/>
789        </fileset>
790      </batchtest>
791    </junit>
792    <delete dir="${basedir}/test-tmp" />
793    <fail message="Tests expected to fail are failing!" if="tests.failed"/>
794  </target>
795
796  <target name="testSpecData" depends="compile"
797          description="Run SpecDataJUTests.">
798    <mkdir dir="${test.results}"/>
799    <mkdir dir="${basedir}/test-tmp" />
800    <junit printsummary="on"
801           haltonerror="off"
802           haltonfailure="off"
803           showoutput="yes"
804           fork="true"
805           maxmemory="${junitMem}"
806           errorProperty="tests.failed"
807           failureProperty="tests.failed">
808      <classpath refid="compile.classpath"/>
809      <jvmarg value="-Djava.io.tmpdir=${basedir}/test-tmp" />
810      <formatter type="plain" usefile="true"/>
811      <batchtest fork="true" todir="${test.results}">
812        <fileset dir="${build}">
813          <include name="**/SpecDataJUTest.class"/>
814        </fileset>
815      </batchtest>
816    </junit>
817    <delete dir="${basedir}/test-tmp" />
818    <fail message="Tests expected to pass are failing!" if="tests.failed"/>
819  </target>
820
821  <target name="testSystem" depends="compile"
822          description="Run SystemJUTests.">
823    <mkdir dir="${test.results}"/>
824    <mkdir dir="${basedir}/test-tmp" />
825    <junit printsummary="on"
826           haltonerror="off"
827           haltonfailure="off"
828           showoutput="yes"
829           fork="true"
830           maxmemory="${junitMem}"
831           errorProperty="tests.failed"
832           failureProperty="tests.failed">
833      <classpath refid="compile.classpath"/>
834      <jvmarg value="-Djava.io.tmpdir=${basedir}/test-tmp" />
835      <formatter type="plain" usefile="true"/>
836      <batchtest fork="true" todir="${test.results}">
837        <fileset dir="${build}">
838          <include name="**/SystemJUTest.class"/>
839        </fileset>
840      </batchtest>
841    </junit>
842    <delete dir="${basedir}/test-tmp" />
843    <fail message="Tests expected to pass are failing!" if="tests.failed"/>
844  </target>
845
846  <target name="testblas" depends="compile,blas" description="Test blas">
847    <mkdir dir="${basedir}/test-tmp" />
848    <junit printsummary="on"
849           haltonerror="off"
850           haltonfailure="off"
851           showoutput="yes"
852           fork="true"
853           maxmemory="${junitMem}"
854           errorProperty="tests.failed"
855           failureProperty="tests.failed">
856      <classpath refid="compile.classpath"/>
857      <jvmarg value="-Djava.io.tmpdir=${basedir}/test-tmp" />
858      <formatter type="plain" usefile="true"/>
859      <batchtest fork="true" todir="${test.results}">
860        <fileset dir="${build}">
861          <include name="**/BlasJxTest.class"/>
862        </fileset>
863      </batchtest>
864    </junit>
865    <delete dir="${basedir}/test-tmp" />
866    <fail message="Tests expected to pass are failing!" if="tests.failed"/>
867  </target>
868
869  <target name="testsyntax" depends="compile"
870          description="Run SyntaxAbstractionJUTests.">
871    <mkdir dir="${test.results}"/>
872    <mkdir dir="${basedir}/test-tmp" />
873    <junit printsummary="on"
874           haltonerror="off"
875           haltonfailure="off"
876           showoutput="yes"
877           fork="true"
878           maxmemory="${junitMem}"
879           errorProperty="tests.failed"
880           failureProperty="tests.failed">
881      <classpath refid="compile.classpath"/>
882      <jvmarg value="-Djava.io.tmpdir=${basedir}/test-tmp" />
883      <formatter type="plain" usefile="true"/>
884      <batchtest fork="true" todir="${test.results}">
885        <fileset dir="${build}">
886          <include name="**/SyntaxAbstractionJUTest.class"/>
887          <!--
888              <include name="**/SyntaxAbstractionJUTestAll.class"/>
889          -->
890        </fileset>
891      </batchtest>
892    </junit>
893    <delete dir="${basedir}/test-tmp" />
894    <fail message="Tests expected to pass are failing!" if="tests.failed"/>
895  </target>
896
897  <target name="testDemos" depends="compile"
898          description="Run demos in a test harness.">
899    <mkdir dir="${test.results}"/>
900    <mkdir dir="${basedir}/test-tmp" />
901    <junit printsummary="on"
902           haltonerror="off"
903           haltonfailure="off"
904           showoutput="yes"
905           fork="true"
906           maxmemory="${junitMem}"
907           errorProperty="tests.failed"
908           failureProperty="tests.failed">
909      <classpath refid="compile.classpath"/>
910      <jvmarg value="-Djava.io.tmpdir=${basedir}/test-tmp" />
911      <formatter type="brief" usefile="true"/>
912      <batchtest fork="true" todir="${test.results}">
913        <fileset dir="${build}">
914          <include name="**/DemoTests.class"/>
915        </fileset>
916      </batchtest>
917    </junit>
918    <delete dir="${basedir}/test-tmp" />
919    <fail message="Tests expected to pass are failing!" if="tests.failed"/>
920  </target>
921
922  <target name="testAll"
923          depends="test, testNotPassing, testDemos, reportNotPassing"
924          description="Run all tests, including those known not to pass yet.">
925  </target>
926
927  <target name="testNightly" depends="test, testDemos, testsyntax"
928          description="Run tests, demos, and syntax abstraction tests.">
929  </target>
930
931  <target name="reportNotPassing"
932          if="not.passing.yet"
933          depends="test,testNotPassing">
934    <echo message="Some tests expected to fail still aren't passing."/>
935  </target>
936
937  <!-- If the generated file Fortress.java is no older than all rats files
938       in the parser directory, then the parser must be up to date.
939       This is a conservative test; a more precise test would perform a
940       dependency analysis over Rats! code.-->
941  <target name="checkParserUptodate" depends="init">
942    <condition property="parser.uptodate">
943      <and>
944        <uptodate targetfile="${parser}/Fortress.java">
945          <srcfiles dir="${parser}" includes="**/*.rats"/>
946        </uptodate>
947        <uptodate targetfile="${preparser}/PreFortress.java">
948          <srcfiles dir="${parser}" includes="**/*.rats"/>
949          <srcfiles dir="${preparser}" includes="**/*.rats"/>
950        </uptodate>
951        <uptodate targetfile="${templateparser}/TemplateParser.java">
952          <srcfiles dir="${parser}" includes="**/*.rats"/>
953          <srcfiles dir="${templateparser}" includes="**/*.rats"/>
954        </uptodate>
955      </and>
956    </condition>
957    <echo>Parser up to date? ${parser.uptodate}</echo>
958  </target>
959
960  <target name="checkFortressParserUptodate" depends="init">
961    <uptodate property="fortressparser.uptodate"
962              targetfile="${parser}/Fortress.java">
963      <srcfiles dir="${parser}" includes="**/*.rats"/>
964    </uptodate>
965    <echo>Fortress parser up to date? ${parser.uptodate}</echo>
966  </target>
967
968  <target name="checkPreparserUptodate" depends="init">
969    <uptodate property="preparser.uptodate"
970              targetfile="${preparser}/PreFortress.java">
971      <srcfiles dir="${parser}" includes="**/*.rats"/>
972      <srcfiles dir="${preparser}" includes="**/*.rats"/>
973    </uptodate>
974    <echo>Preparser up to date? ${preparser.uptodate}</echo>
975  </target>
976
977  <target name="checkTemplateparserUptodate" depends="init">
978    <uptodate property="templateparser.uptodate"
979              targetfile="${templateparser}/TemplateParser.java">
980      <srcfiles dir="${parser}" includes="**/*.rats"/>
981      <srcfiles dir="${templateparser}" includes="**/*.rats"/>
982    </uptodate>
983    <echo>Templateparser up to date? ${templateparser.uptodate}</echo>
984  </target>
985
986  <target name="checkInstrumentedParserUptodate" depends="init">
987    <uptodate property="instrumentedparser.uptodate"
988              targetfile="${parser}/FortressInstrumented.java">
989      <srcfiles dir="${parser}" includes="**/*.rats"/>
990      <srcfiles dir="${src}/${instrumentationPackage}"
991                includes="*.java"/>
992    </uptodate>
993    <echo>Fortress parser up to date? ${parser.uptodate}</echo>
994  </target>
995
996  <macrodef name="buildparser">
997    <attribute name="name" />
998    <attribute name="file" />
999    <attribute name="dir" />
1000    <sequential>
1001      <echo message="Rebuilding @{name}..."/>
1002      <java fork="yes"
1003            failonerror="yes"
1004            dir="@{dir}"
1005            classname="xtc.parser.Rats"
1006            classpath="${xtc}/xtc.jar">
1007        <arg value="-in"/>
1008        <arg value="${src}"/>
1009        <arg value="@{file}"/>
1010      </java>
1011    </sequential>
1012  </macrodef>
1013
1014  <target name="fortressparser" unless="fortressparser.uptodate"
1015          depends="checkFortressParserUptodate"
1016          description="Fortress Parser">
1017    <buildparser name="Fortress" dir="${parser}" file="Fortress.rats" />
1018  </target>
1019
1020  <target name="preparser" unless="preparser.uptodate"
1021          depends="checkPreparserUptodate"
1022          description="Preparser">
1023    <buildparser name="preparser" dir="${preparser}" file="PreFortress.rats" />
1024  </target>
1025
1026  <target name="templateparser" unless="templateparser.uptodate"
1027          depends="checkTemplateparserUptodate"
1028          description="Templateparser">
1029    <buildparser name="template parser" dir="${templateparser}"
1030                 file="TemplateParser.rats" />
1031  </target>
1032
1033  <target name="instrumentedparser" unless="instrumentedparser.uptodate"
1034          depends="compile, checkInstrumentedParserUptodate"
1035          description="Instrumented Parser">
1036    <java fork="yes"
1037          maxmemory="512m"
1038          failonerror="yes"
1039          classname="${instrumentation.package}.InstrumentedParserGenerator">
1040      <classpath refid="instrumentedparser.classpath"/>
1041      <arg value="${parser}"/> <!-- input dir -->
1042      <arg value="${parser}"/> <!-- output dir for FortressInstrumented.java -->
1043    </java>
1044  </target>
1045
1046  <target name="optimizeParser"
1047          depends="compile"
1048          description="Optimized Parser">
1049    <java fork="yes"
1050          maxmemory="512m"
1051          failonerror="yes"
1052          classname="${instrumentation.package}.OptimizedParserGenerator">
1053      <classpath refid="instrumentedparser.classpath"/>
1054      <arg value="${parser}"/> <!-- input dir -->
1055      <arg value="${parser}"/> <!-- output dir for Fortress.java -->
1056      <arg value="${instrumentation.transient}"/>
1057    </java>
1058    <ant target="compile"/>
1059  </target>
1060
1061  <target name="parser" unless="parser.uptodate"
1062          depends="checkParserUptodate, operatorsGen"
1063          description="Fortress Parser">
1064    <ant target="fortressparser" />
1065    <ant target="preparser" />
1066    <ant target="templateparser" />
1067  </target>
1068
1069  <target name="compileGrammarCoverage" depends="compile, instrumentedparser">
1070    <depend srcdir="${src}"
1071            destdir="${build}"
1072            closure="yes"
1073            cache="${basedir}/.dependencies"/>
1074    <javac
1075        srcdir="${src}"
1076        destdir="${build}"
1077        source="1.5"
1078        debug="true"
1079        includeantruntime="false"
1080        fork="true"
1081        memorymaximumsize="${junitMem}">
1082      <!-- Uncomment the following line to print unchecked warnings
1083           (here and in the 'compileCommon' target. -->
1084      <!-- <compilerarg value="-Xlint:unchecked"/> -->
1085      <classpath refid="compile.classpath"/>
1086      <include name="${packagePrefix}/parser/FortressInstrumented.java"/>
1087    </javac>
1088  </target>
1089
1090  <target name="grammarCoverage" depends="compileGrammarCoverage">
1091    <java fork="yes"
1092          failonerror="yes"
1093          classname="${instrumentation.package}.Coverage"
1094          output="${instrumentation.outfile}">
1095      <classpath refid="compile.classpath"/>
1096    </java>
1097    <echo message="Wrote grammar coverage report to ${instrumentation.outfile}"/>
1098  </target>
1099
1100  <target name="doc" depends="compile">
1101    <javadoc overview="${src}/overview.html" destdir="${docs}" maxmemory="${junitMem}">
1102      <classpath refid="compile.classpath"/>
1103      <packageset dir="${src}">
1104        <include name="**/*"/>
1105      </packageset>
1106      <header><![CDATA[Fortress Interpreter]]></header>
1107      <doctitle><![CDATA[<h1>Fortress Interpreter Source Code</h1>]]></doctitle>
1108      <group title="Evaluator Packages"
1109             packages="com.sun.fortress.interpreter.evaluator.*"/>
1110      <link href="http://junit.org/junit/javadoc/3.8.1/"/>
1111      <link href="http://java.sun.com/j2se/1.5/docs/api/"/>
1112      <link href="http://drjava.org/javadoc/plt/"/>
1113    </javadoc>
1114  </target>
1115
1116  <target name="jar"
1117          depends="compile"
1118          description="Package up a Fortress distribution as a self-extracting jar.">
1119    <tstamp>
1120      <format
1121          property="jar.DSTAMP"
1122          timezone="GMT"
1123          pattern="yyyy_MMdd_hhmm"/>
1124    </tstamp>
1125
1126    <!-- Extract Ant jars into build directory to be packaged up.-->
1127    <unjar src="${protofortress}/lib/ant.jar" dest="${build}"/>
1128    <unjar src="${protofortress}/lib/ant-launcher.jar" dest="${build}"/>
1129
1130    <!-- Place anthooks.jar in the protofortress. -->
1131    <copy file="${src}/com/sun/fortress/shell/anthooks.xml"
1132          todir="${protofortress}/bin"/>
1133
1134    <!-- Package up class files as a new shell.jar,
1135         and place them in the protofortress. -->
1136    <jar
1137        destfile="fortress/FORTRESS/lib/shell.jar"
1138        basedir="${build}"
1139        includes="**/*"/>
1140
1141    <!-- Then package up the protofortress and place it
1142         in the build directory (so it can be extracted later). -->
1143    <jar
1144        destfile="${build}/com/sun/fortress/shell/fortress.jar"
1145        basedir="fortress"
1146        includes="**/*" />
1147
1148    <!-- Write timestamp of jar creation to a file for retrieval during
1149         extraction. -->
1150    <echo message="${jar.DSTAMP}" file="${build}/TIMESTAMP"/>
1151
1152    <!-- Finally, package up the build directory into a jar that
1153         extracts the protofortress at a destination site. -->
1154    <jar
1155        destfile="Fortress_${jar.DSTAMP}.jar"
1156        basedir="${build}"
1157        includes="**/*" >
1158      <manifest>
1159        <attribute name="Manifest-Version" value="${jar.DSTAMP}"/>
1160        <attribute name="Created-By" value="Sun Microsystems, Inc."/>
1161        <attribute name="Main-Class" value="com.sun.fortress.shell.Extractor"/>
1162        <section name="common/class1.class">
1163          <attribute name="Sealed" value="false"/>
1164        </section>
1165      </manifest>
1166    </jar>
1167  </target>
1168
1169  <target name="copy.anthooks" depends="init" unless="anthooks.uptodate">
1170    <copy file="${src}/com/sun/fortress/shell/anthooks.xml"
1171          todir="${build}/com/sun/fortress/shell"
1172          overwrite="false"/>
1173  </target>
1174
1175  <target name="installer" depends="compile"
1176          description="build a new installer as a jar">
1177    <delete dir="${installerDir}"/>
1178    <mkdir dir="${installerDir}/fortress"/>
1179    <copy todir="${installerDir}/fortress/FORTRESS">
1180      <fileset dir="FORTRESS"/>
1181    </copy>
1182    <copy todir="${installerDir}/fortress/bin">
1183      <fileset dir="bin"/>
1184    </copy>
1185    <copy file="docs/installer/README.txt" todir="${installerDir}/fortress"/>
1186    <tar
1187        destfile="fortress.tar.gz"
1188        basedir="${installerDir}"
1189        longfile="fail"
1190        compression="gzip"
1191        />
1192    <delete dir="${installerDir}"/>
1193  </target>
1194
1195  <target name="createNestedJarUpgrade"
1196          description="wrap up a jar for inclusion in a mock upgrade">
1197    <jar
1198        destfile="jars/fortress_mock_upgrade/java/mock_upgrade.jar"
1199        basedir="jars/nested_jar_upgrade"
1200        includes="**/*"
1201        />
1202  </target>
1203
1204  <target name="createMockUpgrade" depends="createNestedJarUpgrade"
1205          description="build a mock upgrade file for testing selfupgrade">
1206    <jar
1207        destfile="FORTRESS/test/fortress_mock_upgrade.jar"
1208        basedir="jars/fortress_mock_upgrade"
1209        includes="**/*"
1210        />
1211  </target>
1212</project>
Note: See TracBrowser for help on using the browser.