build.xml 1.7 KB
Newer Older
1 2
<project name="Compiler" default ="compile" basedir=".">

3 4 5 6 7 8 9 10 11 12 13 14 15
  <property name="cup"      location="src/cup"   />
  <property name="jflex"    location="src/jflex" />
  <property name="java"     location="src"       />
  <property name="classes"  location="bin/cls"   />
  <property name="result"   location="bin/jar"   />
  <property name="lib"      location="lib"       />
  <property name="tools"    location="tools"     />

  <taskdef  name="jflex" classname="JFlex.anttask.JFlexTask"   classpath="${tools}/JFlex.jar"   />
  <taskdef  name="cup"   classname="java_cup.anttask.CUPTask"  classpath="${tools}/java-cup-11b.jar"  />

  <target name="generate">
    <jflex  file="${jflex}/Lexer.jflex"   destdir="${java}" />
16
    <cup srcfile="${cup}/parser.cup"      destdir="${java}"
17 18 19 20
          parser="Parser"
		  interface="true"
  	      locations="true"
          debugsymbols="true" />
21 22 23 24 25 26 27 28
  </target>

  <path id="libraries"> <files includes="${lib}/java-cup-11b-runtime.jar" /> </path>

  <target name="compile" depends="generate">
  	<mkdir dir="${classes}"/>
  	<mkdir dir="${result}"/>

29
    <javac srcdir="${java}" includeantruntime="false" destdir="${classes}">
30 31 32 33 34 35 36
    	<classpath refid="libraries" />
    </javac>

    <jar destfile="${result}/CupParser.jar" basedir="${classes}">
    	<manifest>
        </manifest>
    </jar>
37 38 39 40
  	<echo>Deploy in </echo>
  	       <copy todir="../CupReferencedLibraries/" overwrite="true">
  	           <fileset dir="${result}/" includes="*.jar"/>
  	       </copy>
41 42 43 44 45 46 47 48 49
  </target>

  <target name="clean">
    <delete file="${java}/Parser.java" />
    <delete file="${java}/sym.java" />
    <delete file="${java}/Scanner.java" />
    <delete dir="${classes}" />
    <delete dir="${result}" />
  </target>
50
</project>