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

3 4 5 6 7 8 9 10 11 12 13 14 15 16
  <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}" />
    <cup srcfile="${cup}/Parser.cup"      destdir="${java}"
17
          parser="Parser"                 interface="true" locations="true" />
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
  </target>

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

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

    <javac srcdir="${java}" destdir="${classes}">
    	<classpath refid="libraries" />
    </javac>

    <jar destfile="${result}/CupParser.jar" basedir="${classes}">
    	<manifest>
        </manifest>
    </jar>
34 35 36 37
  	<echo>Deploy in </echo>
  	       <copy todir="../CupReferencedLibraries/" overwrite="true">
  	           <fileset dir="${result}/" includes="*.jar"/>
  	       </copy>
38 39 40 41 42 43 44 45 46
  </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>
47
</project>