| <project name="s2-geometry-java" default="compile"> |
| |
| <property name="src.dir" value="${basedir}/src" /> |
| <property name="tests.dir" value="${basedir}/tests" /> |
| <property name="lib.dir" value="${basedir}/lib" /> |
| <property name="build.dir" value="${basedir}/build" /> |
| <property name="classes.dir" value="${build.dir}/classes" /> |
| <property name="project-jarfile" |
| value="${build.dir}/${ant.project.name}.jar" /> |
| <property name="testClasses.dir" value="${build.dir}/test" /> |
| |
| <path id="classpath.path"> |
| <fileset dir="${lib.dir}"> |
| <include name="*.jar" /> |
| </fileset> |
| </path> |
| |
| <target name="clean" |
| description="removes all generated files"> |
| <delete dir="${build.dir}" /> |
| </target> |
| |
| <target name="compile" |
| description="compiles Java files for the s2 library"> |
| <mkdir dir="${classes.dir}" /> |
| <javac srcdir="${src.dir}" |
| destdir="${classes.dir}" |
| includeAntRuntime="false" |
| deprecation="on"> |
| <compilerarg value="-Werror" /> |
| <classpath refid="classpath.path" /> |
| </javac> |
| </target> |
| |
| <target name="jar" |
| depends="compile" |
| description="packages the class files as a jar"> |
| <jar destfile="${project-jarfile}" update="true"> |
| <fileset dir="${classes.dir}" /> |
| </jar> |
| </target> |
| |
| <target name="compile-tests" |
| depends="compile" |
| description="compile the JUnit tests"> |
| <mkdir dir="${testClasses.dir}" /> |
| <javac srcdir="${tests.dir}" |
| destdir="${testClasses.dir}" |
| deprecation="on"> |
| <compilerarg value="-Werror" /> |
| <classpath refid="classpath.path" /> |
| <classpath> |
| <pathelement location="${classes.dir}" /> |
| </classpath> |
| </javac> |
| </target> |
| |
| <macrodef name="testing"> |
| <attribute name="printsummary" default="off" /> |
| <attribute name="fork" default="off" /> |
| <attribute name="forkmode" default="perTest" /> |
| <sequential> |
| <antcall target="compile-tests" /> |
| <junit printsummary="@{printsummary}" |
| fork="@{fork}" |
| forkmode="@{forkmode}" |
| showoutput="true"> |
| <classpath refid="classpath.path" /> |
| <classpath> |
| <pathelement location="${classes.dir}" /> |
| <pathelement location="${testClasses.dir}" /> |
| </classpath> |
| <formatter type="plain" usefile="false" /> |
| <batchtest haltonfailure="true"> |
| <fileset dir="${testClasses.dir}"> |
| <include name="**/*Test.class" /> |
| </fileset> |
| </batchtest> |
| </junit> |
| </sequential> |
| </macrodef> |
| |
| <target name="test" |
| description="runs all of the tests"> |
| <testing printsummary="on" fork="on" forkmode="once" /> |
| </target> |
| |
| <target name="test-forkless" |
| description="runs all of the tests without forking the process"> |
| <testing /> |
| </target> |
| |
| <target name="all" |
| depends="compile,jar,compile-tests,test" |
| description="build all deliverables for the project" |
| /> |
| |
| </project> |