2020-01-15 22:32:25 +01:00
|
|
|
<project name="compiler-design" default="test" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
|
2020-01-15 22:18:07 +01:00
|
|
|
|
|
|
|
<!-- A very simple ant file that primarily exists to run cup and lex;
|
|
|
|
it also includes targets to build the compiler and run tests for those
|
|
|
|
who would rather not use Eclipse -->
|
|
|
|
|
|
|
|
<!-- Set project properties. -->
|
|
|
|
<property name="src.dir" value="${basedir}/src"/>
|
|
|
|
<property name="test.dir" value="${basedir}/test"/>
|
|
|
|
<property name="javali_tests.dir" value="${basedir}/javali_tests"/>
|
2020-01-15 22:38:07 +01:00
|
|
|
<property name="benchmarks.dir" value="${basedir}/benchmarks"/>
|
|
|
|
<property name="parser.dir" value="${src.dir}/cd/frontend/parser"/>
|
2020-01-15 22:18:07 +01:00
|
|
|
<property name="parser.jar" value="${basedir}/lib/javaliParserObf.jar"/>
|
|
|
|
<property name="build.dir" value="${basedir}/bin"/>
|
|
|
|
<property name="junit.jar" value="${basedir}/lib/junit-4.12.jar"/>
|
|
|
|
<property name="hamcrest.jar" value="${basedir}/lib/hamcrest-core-1.3.jar"/>
|
2020-01-15 22:38:07 +01:00
|
|
|
<property name="antlr.jar" value="${basedir}/lib/antlr-4.7.1-complete.jar"/>
|
2020-01-15 22:18:07 +01:00
|
|
|
<property name="antlr.profile" value="false"/>
|
|
|
|
<property name="antlr.report" value="false"/>
|
2020-01-15 22:38:07 +01:00
|
|
|
<property name="jacocoant.jar" value="${basedir}/lib/jacocoant.jar"/>
|
|
|
|
<property name="coverage.file" location="${build.dir}/jacoco.exec"/>
|
|
|
|
<property name="min.coverage" value="0.5"/>
|
|
|
|
<property name="coverage.check" value="cd.frontend.*:cd.backend.*"/>
|
2020-01-15 22:18:07 +01:00
|
|
|
|
|
|
|
<!-- Cleans generated code, but NOT the parser source! -->
|
|
|
|
<target name="clean">
|
|
|
|
<delete dir="${build.dir}"/>
|
|
|
|
</target>
|
|
|
|
|
2020-01-15 22:38:07 +01:00
|
|
|
<!-- Builds the compiler framework for HW > HW1. -->
|
|
|
|
<target name="compile">
|
|
|
|
<mkdir dir="${build.dir}"/>
|
2020-01-15 22:18:07 +01:00
|
|
|
|
2020-01-15 22:38:07 +01:00
|
|
|
<javac debug="true" destdir="${build.dir}" includeantruntime="false">
|
|
|
|
<src path="${src.dir}"/>
|
|
|
|
<src path="${test.dir}"/>
|
|
|
|
<classpath>
|
|
|
|
<pathelement location="${antlr.jar}"/>
|
|
|
|
<pathelement location="${junit.jar}"/>
|
|
|
|
<pathelement location="${hamcrest.jar}"/>
|
|
|
|
<pathelement location="${parser.jar}"/>
|
|
|
|
</classpath>
|
|
|
|
</javac>
|
|
|
|
</target>
|
2020-01-15 22:18:07 +01:00
|
|
|
|
|
|
|
<!-- Deletes all byproducts of running the tests -->
|
|
|
|
<target name="clean-test">
|
|
|
|
<delete>
|
|
|
|
<fileset dir="${javali_tests.dir}" includes="**/*.err"/>
|
|
|
|
<fileset dir="${javali_tests.dir}" includes="**/*.s"/>
|
|
|
|
<fileset dir="${javali_tests.dir}" includes="**/*.bin"/>
|
|
|
|
<fileset dir="${javali_tests.dir}" includes="**/*.dot"/>
|
|
|
|
<fileset dir="${javali_tests.dir}" includes="**/*.exe"/>
|
2020-01-15 22:38:07 +01:00
|
|
|
<fileset dir="${javali_tests.dir}" includes="**/*.ref"/>
|
|
|
|
|
|
|
|
<fileset dir="${benchmarks.dir}" includes="**/*.err"/>
|
|
|
|
<fileset dir="${benchmarks.dir}" includes="**/*.s"/>
|
|
|
|
<fileset dir="${benchmarks.dir}" includes="**/*.bin"/>
|
|
|
|
<fileset dir="${benchmarks.dir}" includes="**/*.dot"/>
|
|
|
|
<fileset dir="${benchmarks.dir}" includes="**/*.exe"/>
|
|
|
|
<fileset dir="${benchmarks.dir}" includes="**/*.ref"/>
|
2020-01-15 22:18:07 +01:00
|
|
|
</delete>
|
|
|
|
</target>
|
|
|
|
|
2020-01-15 22:38:07 +01:00
|
|
|
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
|
|
|
|
<classpath path="${jacocoant.jar}"/>
|
|
|
|
</taskdef>
|
|
|
|
|
2020-01-15 22:18:07 +01:00
|
|
|
<!-- Runs the tests. Use the compile target first! -->
|
|
|
|
<target name="test" depends="compile">
|
2020-01-15 22:38:07 +01:00
|
|
|
<jacoco:coverage destfile="${coverage.file}">
|
|
|
|
<junit fork="true" forkmode="once" failureproperty="tests-failed" outputtoformatters="false">
|
|
|
|
<formatter type="brief" usefile="false"/>
|
|
|
|
<batchtest skipNonTests="true">
|
|
|
|
<fileset dir="bin" includes="**/*.class" />
|
|
|
|
</batchtest>
|
|
|
|
<assertions enablesystemassertions="true" />
|
|
|
|
<sysproperty key="cd.meta_hidden.Version" value="BENCH" />
|
|
|
|
<classpath>
|
|
|
|
<pathelement location="${build.dir}"/>
|
|
|
|
<pathelement location="${junit.jar}"/>
|
|
|
|
<pathelement location="${hamcrest.jar}"/>
|
|
|
|
<pathelement location="${antlr.jar}"/>
|
|
|
|
<pathelement location="${parser.jar}"/>
|
|
|
|
</classpath>
|
|
|
|
</junit>
|
|
|
|
</jacoco:coverage>
|
|
|
|
<fail if="tests-failed" />
|
|
|
|
</target>
|
|
|
|
|
|
|
|
<target name="bench" depends="compile">
|
|
|
|
<java classname="cd.BenchmarksRunner" fork="yes" error="bench-log.txt">
|
2020-01-15 22:34:57 +01:00
|
|
|
<classpath>
|
|
|
|
<pathelement location="${build.dir}"/>
|
2020-01-15 22:38:07 +01:00
|
|
|
<pathelement location="${antlr.jar}"/>
|
|
|
|
<pathelement location="${junit.jar}"/>
|
|
|
|
<pathelement location="${hamcrest.jar}"/>
|
|
|
|
<pathelement location="${parser.jar}"/>
|
|
|
|
</classpath>
|
|
|
|
</java>
|
2020-01-15 22:32:25 +01:00
|
|
|
</target>
|
2020-01-15 22:38:07 +01:00
|
|
|
|
2020-01-15 22:18:07 +01:00
|
|
|
</project>
|