Changeset 3125

Show
Ignore:
Timestamp:
12/01/08 17:39:03 (12 months ago)
Author:
EricAllen
Message:

Altered build.xml to compile all Scala files in the project.
Cleaned up build.xml.
Added a package com.sun.fortress.scalasrc.
Added an autogenerated translator from Scala-based ASTs to Java-based ASTs.
Added Scala compiler jars.

Location:
trunk
Files:
6 added
5 modified
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/ant

    r1698 r3125  
    6060        exit $n 
    6161fi 
    62 "$ant_exec" -noclasspath -lib third_party/junit "$@" 
     62"$ant_exec" -noclasspath -lib third_party/junit:third_party/scala/scala-library-2.7.1.jar:third_party/scala/scala-compiler-2.7.1.jar "$@" 
  • trunk/ProjectFortress/astgen/Fortress.ast

    r3123 r3125  
    21162116             * in the Printer and UnPrinter so be careful if Level is changed. 
    21172117             */ 
    2118             Level(Integer level, Object _object); 
     2118            Level(int level, Object _object); 
     2119 
    21192120            /* 
    21202121             * An overloading, and the type of that particular overloading. 
  • trunk/ProjectFortress/build.xml

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

    r3104 r3125  
    116116 
    117117        // Classes defined outside ASTGen and extended by an ASTGen class 
    118         // are required to have a zeroary constructor, such as UIDObject. 
     118        // are required to have a zeroary constructor. 
    119119        buffer.append("("); 
    120120        boolean first = true; 
     
    152152                String method; 
    153153                if ( name.equals("int") ){ 
    154                     return "int"; 
     154                    return "Int"; 
    155155                } 
    156156                if ( name.equals("boolean") ){ 
    157                     return "boolean"; 
     157                    return "Boolean"; 
    158158                } 
    159159                throw new RuntimeException("Unknown primitive " + name); 
     
    192192            /** A type for which none of the other cases apply. */ 
    193193            public String forGeneralClass(ClassName t){ 
    194                 StringBuffer name = new StringBuffer(t.className()); 
     194                StringBuffer name = new StringBuffer(); 
     195 
     196                // Handle types for which ASTGen provides no hooks, 
     197                // but that we still want to treat specially. 
     198                if (t.className().equals("java.util.Map")) {  
     199                    name.append("Map"); 
     200                } else {  
     201                    name.append(t.className()); 
     202                } 
     203 
    195204                boolean first = true; 
    196205                for (TypeArgumentName arg : t.typeArguments()) { 
     
    350359    } 
    351360 
     361    private String wrappedFieldCalls(String wrapper, NodeType box) { 
     362        if ( mkList(filterFields(box.allFields(ast))).isEmpty() ){ 
     363            return ""; 
     364        } else { 
     365            StringBuffer buffer = new StringBuffer(); 
     366            buffer.append("("); 
     367            int i = 0; 
     368            for ( Field field : filterFields(box.allFields(ast)) ){ 
     369                if ( i != 0 ){ 
     370                    buffer.append( ", " ); 
     371                } 
     372                i += 1; 
     373                buffer.append(sub("@wrapper(@name).asInstanceOf",  
     374                                  "@wrapper", wrapper, "@name", field.getGetterName())); 
     375            } 
     376            buffer.append(")"); 
     377            return buffer.toString(); 
     378        } 
     379    } 
     380 
    352381 
    353382    /* a nice function for string replacement. 
     
    416445                writer.println(sub( "abstract class @name @fields @extends", "@name", c.name(), "@fields", fields(c), "@extends", extendsClause(c) )); 
    417446            } else { 
    418                 writer.println(sub( "case class @name @fields @extends", "@name", c.name(), "@fields", fields(c), "@extends", extendsClause(c)  )); 
    419             } 
    420         } 
     447                writer.println(sub( "case class @name @fields @extends",  
     448                                    "@name", c.name(), "@fields", fields(c), "@extends", extendsClause(c)  )); 
     449            } 
     450        } 
     451        // Generate translator 
     452        writer.println(); 
     453        writer.println("object Translator {"); 
     454        writer.println("   def toJavaAst(node:Any):Any = {"); 
     455        writer.println("       node match {"); 
     456        for ( NodeClass c : sort(ast.classes()) ) { 
     457            if ( ignoreClass(c.name()) ){ 
     458                continue; 
     459            } 
     460            if ( c.isAbstract() ){ 
     461                continue; 
     462            } else { 
     463                writer.println(sub( "         case @name @fieldsNoTypes =>",  
     464                                    "@name", c.name(), "@fieldsNoTypes", fieldsNoTypes(c))); 
     465                writer.println(sub("             new com.sun.fortress.nodes.@name @fieldsNoTypes", 
     466                                   "@name", c.name(), "@fieldsNoTypes", wrappedFieldCalls("toJavaAst", c))); 
     467 
     468            } 
     469        } 
     470        writer.println("         case xs:List[_] => Lists.toJavaList(xs)"); 
     471        writer.println("         case _ => node"); 
     472        writer.println("      }"); 
     473        writer.println("   }"); 
     474        writer.println("}"); 
    421475    } 
    422476 
     
    458512    private void generateScalaFile() { 
    459513        generateFile("FortressAst.scala",  
     514                     "package com.sun.fortress.scalasrc.nodes\n" + 
     515                     "import com.sun.fortress.scalasrc.useful._\n" +  
    460516                     "import com.sun.fortress.nodes_util._\n" + 
    461                      "import scala.collection.mutable.ListBuffer\n" + 
    462517                     "import com.sun.fortress.useful.HasAt\n" + 
    463                      "import java.math.BigInteger\n"); 
     518                     "import _root_.scala.collection.mutable.ListBuffer\n" + 
     519                     "import _root_.java.math.BigInteger\n"); 
    464520    } 
    465521 
  • trunk/build.xml

    r3055 r3125  
    55        default="compile" 
    66        basedir="ProjectFortress"> 
    7     <target name="compile"> 
    8         <ant target="compile"/> 
    9         <ant dir="../scala" target="compile"/> 
    10     </target> 
    11     <target name="blas"> 
    12         <ant target="blas"/> 
    13     </target> 
    14     <target name="test"> 
    15         <ant target="test"/> 
    16     </target> 
    17     <target name="clean"> 
    18         <ant target="clean"/> 
    19         <ant dir="../scala" target="clean"/> 
    20     </target> 
    21     <target name="cleanCache"> 
    22         <ant target="cleanCache"/> 
    23     </target> 
    24     <target name="testSystem"> 
    25         <ant target="testSystem"/> 
    26     </target> 
    27     <target name="testOnly"> 
    28         <ant target="testOnly" /> 
    29     </target> 
    30     <target name="testsyntax"> 
    31         <ant target="testsyntax" /> 
    32     </target> 
     7  <!--  
     8       Taskdefs  
     9  -->  
     10  <taskdef resource="scala/tools/ant/antlib.xml"> 
     11    <classpath refid="scala.classpath"/> 
     12  </taskdef> 
     13 
     14  <!--  
     15       Paths 
     16  --> 
     17  <path id="scala.classpath"> 
     18    <pathelement location="${scala-compiler.jar}"/> 
     19    <pathelement location="${scala-library.jar}"/> 
     20  </path> 
     21 
     22  <!-- Scala jar files --> 
     23  <property name="scala-compiler.jar"  
     24            value="${basedir}/third_party/scala/scala-compiler-2.7.1.jar"/> 
     25  <property name="scala-library.jar"  
     26            value="${basedir}/third_party/scala/scala-library-2.7.1.jar"/> 
     27 
     28  <target name="compile"> 
     29    <ant target="compile"/> 
     30    <ant dir="../scala" target="compile"/> 
     31  </target> 
     32  <target name="blas"> 
     33    <ant target="blas"/> 
     34  </target> 
     35  <target name="test"> 
     36    <ant target="test"/> 
     37  </target> 
     38  <target name="clean"> 
     39    <ant target="clean"/> 
     40    <ant dir="../scala" target="clean"/> 
     41  </target> 
     42  <target name="cleanCache"> 
     43    <ant target="cleanCache"/> 
     44  </target> 
     45  <target name="testSystem"> 
     46    <ant target="testSystem"/> 
     47  </target> 
     48  <target name="testOnly"> 
     49    <ant target="testOnly" /> 
     50  </target> 
     51  <target name="testsyntax"> 
     52    <ant target="testsyntax" /> 
     53  </target> 
    3354</project>