| 1 | <!--
|
|---|
| 2 | build.xml : Ant build file for GMC
|
|---|
| 3 | Author: Stephen F. Siegel, University of Delaware
|
|---|
| 4 | Last modified:
|
|---|
| 5 |
|
|---|
| 6 | The following can be defined on command line with -Dprop=val:
|
|---|
| 7 | revision. This is for the use of our SVN commit hook, which
|
|---|
| 8 | runs the test suite and performs other tasks every time a commit
|
|---|
| 9 | is made. The SVN revision number is just used here to insert
|
|---|
| 10 | into reports.
|
|---|
| 11 | -->
|
|---|
| 12 |
|
|---|
| 13 | <project name="GMC" default="compile"
|
|---|
| 14 | xmlns:jacoco="antlib:org.jacoco.ant">
|
|---|
| 15 | <import file="../../common.xml" />
|
|---|
| 16 |
|
|---|
| 17 | <!-- Properties -->
|
|---|
| 18 | <property name="src.dir" value="${gmc.src.dir}" />
|
|---|
| 19 | <property name="bin.dir" value="${gmc.bin.dir}" />
|
|---|
| 20 | <property name="main-class" value="civl.dev.gmc.simplemc.UserInterface"/>
|
|---|
| 21 | <property name="test.src.dir" location="${gmc.test.dir}" />
|
|---|
| 22 | <property name="test.bin.dir" location="${gmc.dir}/bin-test" />
|
|---|
| 23 | <property name="junit.dir" location="${gmc.junit.dir}" />
|
|---|
| 24 | <property name="junit.data.dir" location="${junit.dir}/data" />
|
|---|
| 25 | <property name="junit.reports.dir" location="${junit.dir}/reports" />
|
|---|
| 26 | <property name="coverage.dir" location="${gmc.coverage.dir}" />
|
|---|
| 27 | <property name="javadoc.dir" value="${gmc.javadoc.dir}" />
|
|---|
| 28 |
|
|---|
| 29 | <!-- Source compilation -->
|
|---|
| 30 |
|
|---|
| 31 | <target name="compile" description="Compile all java source files.">
|
|---|
| 32 | <mkdir dir="${bin.dir}" />
|
|---|
| 33 | <javac release="${javaversion}" debug="true"
|
|---|
| 34 | srcdir="${src.dir}" destdir="${bin.dir}"
|
|---|
| 35 | encoding="UTF-8" includeantruntime="false">
|
|---|
| 36 | </javac>
|
|---|
| 37 | </target>
|
|---|
| 38 |
|
|---|
| 39 | <!-- JUnit tests and Jacoco coverage analysis -->
|
|---|
| 40 |
|
|---|
| 41 | <path id="test.compile.classpath">
|
|---|
| 42 | <pathelement location="${test.src.dir}" />
|
|---|
| 43 | <pathelement location="${bin.dir}" />
|
|---|
| 44 | <pathelement location="${junit.jar}" />
|
|---|
| 45 | <pathelement location="${hamcrest.jar}" />
|
|---|
| 46 | </path>
|
|---|
| 47 |
|
|---|
| 48 | <path id="test.execute.classpath">
|
|---|
| 49 | <pathelement location="${test.bin.dir}" />
|
|---|
| 50 | <pathelement location="${bin.dir}" />
|
|---|
| 51 | <pathelement location="${junit.jar}" />
|
|---|
| 52 | <pathelement location="${hamcrest.jar}" />
|
|---|
| 53 | </path>
|
|---|
| 54 |
|
|---|
| 55 | <target name="test-init">
|
|---|
| 56 | <delete dir="${junit.dir}" quiet="true" />
|
|---|
| 57 | <delete dir="${test.bin.dir}" quiet="true" />
|
|---|
| 58 | <mkdir dir="${junit.dir}" />
|
|---|
| 59 | <mkdir dir="${junit.data.dir}" />
|
|---|
| 60 | <mkdir dir="${junit.reports.dir}" />
|
|---|
| 61 | <mkdir dir="${test.bin.dir}" />
|
|---|
| 62 | </target>
|
|---|
| 63 |
|
|---|
| 64 | <target name="test-compile" depends="compile,test-init">
|
|---|
| 65 | <javac release="${javaversion}" destdir="${test.bin.dir}"
|
|---|
| 66 | debug="true" failonerror="false"
|
|---|
| 67 | classpathref="test.compile.classpath"
|
|---|
| 68 | encoding="UTF-8" includeantruntime="true">
|
|---|
| 69 | <src path="${test.src.dir}" />
|
|---|
| 70 | </javac>
|
|---|
| 71 | </target>
|
|---|
| 72 |
|
|---|
| 73 | <target name="test-run" depends="test-compile">
|
|---|
| 74 | <jacoco:coverage destfile="${gmc.dir}/jacoco.exec">
|
|---|
| 75 | <junit dir="${gmc.dir}" fork="true" forkmode="once" timeout="300000">
|
|---|
| 76 | <jvmarg value="-ea" />
|
|---|
| 77 | <classpath refid="test.execute.classpath" />
|
|---|
| 78 | <formatter type="brief" usefile="false" />
|
|---|
| 79 | <formatter type="xml" />
|
|---|
| 80 | <batchtest todir="${junit.data.dir}">
|
|---|
| 81 | <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
|
|---|
| 82 | </batchtest>
|
|---|
| 83 | </junit>
|
|---|
| 84 | </jacoco:coverage>
|
|---|
| 85 | <junitreport todir="${junit.data.dir}">
|
|---|
| 86 | <fileset dir="${junit.data.dir}">
|
|---|
| 87 | <include name="TEST-*.xml" />
|
|---|
| 88 | </fileset>
|
|---|
| 89 | <report format="frames" todir="${junit.reports.dir}">
|
|---|
| 90 | <param name="TITLE" expression="JUnit Report for GMC ${civlversion}.${revision}" />
|
|---|
| 91 | </report>
|
|---|
| 92 | </junitreport>
|
|---|
| 93 | </target>
|
|---|
| 94 |
|
|---|
| 95 | <target name="test" depends="test-run">
|
|---|
| 96 | <jacoco:report>
|
|---|
| 97 | <executiondata>
|
|---|
| 98 | <file file="jacoco.exec" />
|
|---|
| 99 | </executiondata>
|
|---|
| 100 | <structure name="Test Coverage Report for GMC ${civlversion}.${revision}">
|
|---|
| 101 | <classfiles>
|
|---|
| 102 | <fileset dir="${bin.dir}" />
|
|---|
| 103 | </classfiles>
|
|---|
| 104 | <sourcefiles encoding="UTF-8">
|
|---|
| 105 | <fileset dir="${src.dir}" />
|
|---|
| 106 | </sourcefiles>
|
|---|
| 107 | </structure>
|
|---|
| 108 | <html destdir="coverage" />
|
|---|
| 109 | </jacoco:report>
|
|---|
| 110 | </target>
|
|---|
| 111 |
|
|---|
| 112 | <!-- Javadoc Tasks -->
|
|---|
| 113 |
|
|---|
| 114 | <target name="javadoc">
|
|---|
| 115 | <delete dir="${javadoc.dir}" quiet="true" />
|
|---|
| 116 | <mkdir dir="${javadoc.dir}" />
|
|---|
| 117 | <javadoc destdir="${javadoc.dir}"
|
|---|
| 118 | Overview="${src.dir}/overview.html"
|
|---|
| 119 | author="false" version="true" use="true"
|
|---|
| 120 | windowtitle="GMC ${civlversion}.${revision}"
|
|---|
| 121 | access="public"
|
|---|
| 122 | classpathref="test.execute.classpath"
|
|---|
| 123 | sourcepath="${src.dir}"
|
|---|
| 124 | failonerror="false">
|
|---|
| 125 | </javadoc>
|
|---|
| 126 | </target>
|
|---|
| 127 |
|
|---|
| 128 | <!-- Clean -->
|
|---|
| 129 |
|
|---|
| 130 | <target name="clean" description="Delete all generated files."
|
|---|
| 131 | depends="clean-default">
|
|---|
| 132 | <delete dir="${bin.dir}" />
|
|---|
| 133 | <delete dir="${test.bin.dir}" />
|
|---|
| 134 | <delete dir="${junit.dir}" />
|
|---|
| 135 | <delete dir="${javadoc.dir}" />
|
|---|
| 136 | <delete dir="${coverage.dir}" />
|
|---|
| 137 | <delete file="${gmc.dir}/jacoco.exec" />
|
|---|
| 138 | </target>
|
|---|
| 139 |
|
|---|
| 140 | <!-- Do everything -->
|
|---|
| 141 |
|
|---|
| 142 | <target name="all" depends="test,javadoc" />
|
|---|
| 143 |
|
|---|
| 144 | </project>
|
|---|