1<project name="s2-geometry-java" default="compile"> 2 3 <property name="src.dir" value="${basedir}/src" /> 4 <property name="tests.dir" value="${basedir}/tests" /> 5 <property name="lib.dir" value="${basedir}/lib" /> 6 <property name="build.dir" value="${basedir}/build" /> 7 <property name="classes.dir" value="${build.dir}/classes" /> 8 <property name="project-jarfile" 9 value="${build.dir}/${ant.project.name}.jar" /> 10 <property name="testClasses.dir" value="${build.dir}/test" /> 11 12 <path id="classpath.path"> 13 <fileset dir="${lib.dir}"> 14 <include name="*.jar" /> 15 </fileset> 16 </path> 17 18 <target name="clean" 19 description="removes all generated files"> 20 <delete dir="${build.dir}" /> 21 </target> 22 23 <target name="compile" 24 description="compiles Java files for the s2 library"> 25 <mkdir dir="${classes.dir}" /> 26 <javac srcdir="${src.dir}" 27 destdir="${classes.dir}" 28 includeAntRuntime="false" 29 deprecation="on"> 30 <compilerarg value="-Werror" /> 31 <classpath refid="classpath.path" /> 32 </javac> 33 </target> 34 35 <target name="jar" 36 depends="compile" 37 description="packages the class files as a jar"> 38 <jar destfile="${project-jarfile}" update="true"> 39 <fileset dir="${classes.dir}" /> 40 </jar> 41 </target> 42 43 <target name="compile-tests" 44 depends="compile" 45 description="compile the JUnit tests"> 46 <mkdir dir="${testClasses.dir}" /> 47 <javac srcdir="${tests.dir}" 48 destdir="${testClasses.dir}" 49 deprecation="on"> 50 <compilerarg value="-Werror" /> 51 <classpath refid="classpath.path" /> 52 <classpath> 53 <pathelement location="${classes.dir}" /> 54 </classpath> 55 </javac> 56 </target> 57 58 <macrodef name="testing"> 59 <attribute name="printsummary" default="off" /> 60 <attribute name="fork" default="off" /> 61 <attribute name="forkmode" default="perTest" /> 62 <sequential> 63 <antcall target="compile-tests" /> 64 <junit printsummary="@{printsummary}" 65 fork="@{fork}" 66 forkmode="@{forkmode}" 67 showoutput="true"> 68 <classpath refid="classpath.path" /> 69 <classpath> 70 <pathelement location="${classes.dir}" /> 71 <pathelement location="${testClasses.dir}" /> 72 </classpath> 73 <formatter type="plain" usefile="false" /> 74 <batchtest haltonfailure="true"> 75 <fileset dir="${testClasses.dir}"> 76 <include name="**/*Test.class" /> 77 </fileset> 78 </batchtest> 79 </junit> 80 </sequential> 81 </macrodef> 82 83 <target name="test" 84 description="runs all of the tests"> 85 <testing printsummary="on" fork="on" forkmode="once" /> 86 </target> 87 88 <target name="test-forkless" 89 description="runs all of the tests without forking the process"> 90 <testing /> 91 </target> 92 93 <target name="all" 94 depends="compile,jar,compile-tests,test" 95 description="build all deliverables for the project" 96 /> 97 98</project> 99