build.xml 2.54 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
<project name="emugen" default ="dist" basedir=".">
  <property name="etc"       location="etc"       />
  <property name="bin"       location="bin"       />
  <property name="lib"       location="lib"       />
  <property name="src"       location="src"       />
  <property name="java"      location="java"      />
  <property name="classes"   location="classes"   />
  <property name="dist"      location="dist"      />
  <!--property name="test"      location="test"      /-->
  <property name="flex"      location="flex"      />
  <property name="cup"       location="cup"       />

  <!-- initialize the workspace -->
  <target name="init">
    <tstamp />
    <mkdir dir="${src}" />
    <mkdir dir="${java}" />
    <mkdir dir="${classes}" />
    <mkdir dir="${dist}" />    
  </target>

  <property environment="env" />

  <path id="libraries">
     <pathelement location="${src}" />
     <fileset dir="${lib}">
	<include name="**/*.jar" />
     </fileset>
  </path>

  <path id="binaries">
     <fileset dir="${bin}">
	<include name="**/*.jar" />
     </fileset>
  </path>

  <target name="clean">
    <delete dir="${java}" />
    <delete dir="${classes}" />
    <delete dir="${dist}" />
  </target>

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

  <target name="cup" depends="init">
    <cup srcfile="${cup}/parser.cup" interface="on" destdir="${java}" parser="parser" symbols="sym" quiet="false" nonterms="true"/>
  </target>

  <target name="jflex" depends="cup">
    <jflex file="${flex}/Lexer.jflex" destdir="${java}" />
  </target>

  <target name="compile" depends="jflex">
    <copy todir="${java}"><fileset dir="${src}"></fileset></copy>
    <javac srcdir="${java}" destdir="${classes}" verbose="off" listfiles="off" debug="on" source="1.2" target="1.2">
      <classpath refid="libraries"/>
    </javac>
  </target>

  <target name="dist" depends="compile">
   <jar jarfile="${dist}/java-cup-11a.jar" basedir="${classes}">
      <manifest>
        <attribute name="Main-Class" value="java_cup/Main" />
	<attribute name="Class-Path" value="java-cup-11a-runtime.jar" />
      </manifest>
    </jar>
    <jar jarfile="${dist}/java-cup-11a-runtime.jar" basedir="${classes}" includes="java_cup/runtime/*">
    </jar>
  </target>

  <target name="test" depends="dist">
    <java jar="${dist}/java-cup-11a.jar" fork="true">
        <arg value="-interface" />
        <arg value="${cup}/parser.cup" />
    </java>  
    
  </target>
</project>