compiler-design-eth/build.xml

119 lines
4.4 KiB
XML
Raw Normal View History

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"/>
<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:32:25 +01:00
<property name="antlr.jar" value="${basedir}/lib/antlr-4.4-complete.jar"/>
2020-01-15 22:18:07 +01:00
<property name="antlr.profile" value="false"/>
<property name="antlr.report" value="false"/>
<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:32:25 +01:00
<property name="doc.dir" value="javadoc"/>
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:32:25 +01:00
<target name="compile">
2020-01-15 22:18:07 +01:00
<mkdir dir="${build.dir}"/>
<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}"/>
2020-01-15 22:32:25 +01:00
<pathelement location="${parser.jar}"/>
2020-01-15 22:18:07 +01:00
</classpath>
</javac>
</target>
<!-- 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"/>
<fileset dir="${javali_tests.dir}" includes="**/*.ref"/>
</delete>
</target>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="${jacocoant.jar}"/>
</taskdef>
<!-- Runs the tests. Use the compile target first! -->
<target name="test" depends="compile">
<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="REFERENCE" />
<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>
2020-01-15 22:32:25 +01:00
<target name="test-coverage-report">
<jacoco:report>
<executiondata>
<file file="${coverage.file}"/>
</executiondata>
<structure name="JaCoCo Ant Example">
<classfiles>
<fileset dir="${build.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${src.dir}"/>
</sourcefiles>
</structure>
<check>
<rule element="PACKAGE" includes="${coverage.check}">
<limit counter="LINE" value="COVEREDRATIO" minimum="${min.coverage}"/>
</rule>
</check>
</jacoco:report>
<echo message="Coverage above ${min.coverage} in ${coverage.check}: OK" level="info"/>
</target>
<target name="clean-doc">
<delete dir="javadoc"/>
</target>
<target name="generate-doc">
<javadoc sourcepath="${src.dir}" destdir="${doc.dir}"
private="true" use="true" author="true">
<package name="cd"/>
<package name="cd.frontend.semantic"/>
<package name="cd.ir"/>
<arg value="-notimestamp"/>
</javadoc>
</target>
2020-01-15 22:18:07 +01:00
</project>