| 1 | <!--
|
|---|
| 2 | build.xml : Ant build file for CIVL
|
|---|
| 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="CIVL" basedir="." default="jar">
|
|---|
| 14 |
|
|---|
| 15 | <!-- Directories -->
|
|---|
| 16 |
|
|---|
| 17 | <property file="build.properties" />
|
|---|
| 18 | <property name="src.dir" value="${basedir}/src" />
|
|---|
| 19 | <property name="real.src.dir" value="${src.dir}/edu/udel/cis/vsl/civl/civlc" />
|
|---|
| 20 | <property name="bin.dir" value="${basedir}/bin" />
|
|---|
| 21 | <property name="javadoc.dir" value="${basedir}/doc/javadoc" />
|
|---|
| 22 | <property name="jar-name" value="civl.jar" />
|
|---|
| 23 | <property name="jar-path" value="${basedir}/${jar-name}" />
|
|---|
| 24 | <!--
|
|---|
| 25 | <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
|
|---|
| 26 | -->
|
|---|
| 27 | <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
|
|---|
| 28 |
|
|---|
| 29 | <!-- Junit: automated unit tester Properties -->
|
|---|
| 30 |
|
|---|
| 31 | <property name="test.src.dir" location="${basedir}/test" />
|
|---|
| 32 | <property name="test.bin.dir" location="${basedir}/bin-test" />
|
|---|
| 33 | <property name="junit.dir" location="${basedir}/junit" />
|
|---|
| 34 | <property name="junit.data.dir" location="${junit.dir}/data" />
|
|---|
| 35 | <property name="junit.reports.dir" location="${junit.dir}/reports" />
|
|---|
| 36 |
|
|---|
| 37 | <!-- Cobertura: test coverage analyzer Properties -->
|
|---|
| 38 |
|
|---|
| 39 | <property name="cob.log.file" value="${basedir}/cobertura.log" />
|
|---|
| 40 | <property name="cob.ser.file" value="${basedir}/cobertura.ser" />
|
|---|
| 41 | <property name="cobertura.dir" value="${basedir}/cobertura" />
|
|---|
| 42 | <property name="cob.instrumented.dir" value="${cobertura.dir}/instrumented" />
|
|---|
| 43 | <property name="cob.reports.dir" value="${cobertura.dir}/reports" />
|
|---|
| 44 | <property name="cob.reports.xml.dir" value="${cob.reports.dir}/junit-xml" />
|
|---|
| 45 | <property name="cob.reports.html.dir" value="${cob.reports.dir}/junit-html" />
|
|---|
| 46 | <property name="cob.coverage.xml.dir" value="${cob.reports.dir}/cobertura-xml" />
|
|---|
| 47 | <property name="cob.coverage.html.dir" value="${cob.reports.dir}/cobertura-html" />
|
|---|
| 48 |
|
|---|
| 49 | <!-- Tell Ant about Cobertura tasks -->
|
|---|
| 50 |
|
|---|
| 51 | <path id="cobertura.classpath">
|
|---|
| 52 | <fileset dir="${cobertura.lib.dir}">
|
|---|
| 53 | <include name="cobertura.jar" />
|
|---|
| 54 | <include name="lib/**/*.jar" />
|
|---|
| 55 | </fileset>
|
|---|
| 56 | </path>
|
|---|
| 57 |
|
|---|
| 58 | <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 | <!-- Running ANTLR -->
|
|---|
| 62 |
|
|---|
| 63 | <path id="antlr.class.path">
|
|---|
| 64 | <pathelement location="${antlr.jar}" />
|
|---|
| 65 | </path>
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | <!-- Source compilation and JAR construction -->
|
|---|
| 69 |
|
|---|
| 70 | <path id="src.compile.classpath">
|
|---|
| 71 | <pathelement location="${src.dir}" />
|
|---|
| 72 | <pathelement location="${antlr.jar}" />
|
|---|
| 73 | <pathelement location="${sarl.jar}"/>
|
|---|
| 74 | <pathelement location="${gmc.jar}"/>
|
|---|
| 75 | <pathelement location="${abc.jar}"/>
|
|---|
| 76 | <pathelement location="${cvc3.jar}"/>
|
|---|
| 77 | <pathelement location="${pcollections.jar}"/>
|
|---|
| 78 | <pathelement location="${clj-ds.dir}"/>
|
|---|
| 79 | </path>
|
|---|
| 80 |
|
|---|
| 81 | <target name="compile" description="Compile all java source files.">
|
|---|
| 82 | <mkdir dir="${bin.dir}" />
|
|---|
| 83 | <javac debug="true" srcdir="${src.dir}" destdir="${bin.dir}" includes="edu/udel/cis/vsl/civl/**" classpathref="src.compile.classpath" encoding="UTF-8" includeantruntime="false">
|
|---|
| 84 | </javac>
|
|---|
| 85 | </target>
|
|---|
| 86 |
|
|---|
| 87 | <target name="jar" depends="compile" description="Jar up all class files.">
|
|---|
| 88 | <jar destfile="${jar-path}">
|
|---|
| 89 | <fileset dir="${bin.dir}" />
|
|---|
| 90 | <fileset dir="${antlr.runtime.bin}" />
|
|---|
| 91 | <fileset dir="${basedir}/lib" />
|
|---|
| 92 | <manifest>
|
|---|
| 93 | <attribute name="Built-By" value="${user.name}" />
|
|---|
| 94 | <attribute name="Main-Class" value="${main-class}" />
|
|---|
| 95 | </manifest>
|
|---|
| 96 | </jar>
|
|---|
| 97 | </target>
|
|---|
| 98 |
|
|---|
| 99 | <!-- Plain JUnit tests -->
|
|---|
| 100 |
|
|---|
| 101 | <path id="test.compile.classpath">
|
|---|
| 102 | <pathelement location="${test.src.dir}" />
|
|---|
| 103 | <pathelement location="${bin.dir}" />
|
|---|
| 104 | <pathelement location="${antlr.jar}" />
|
|---|
| 105 | <pathelement location="${junit.jar}" />
|
|---|
| 106 | <pathelement location="${sarl.jar}"/>
|
|---|
| 107 | <pathelement location="${gmc.jar}"/>
|
|---|
| 108 | <pathelement location="${abc.jar}"/>
|
|---|
| 109 | <pathelement location="${cvc3.jar}"/>
|
|---|
| 110 | <pathelement location="${pcollections.jar}"/>
|
|---|
| 111 | <pathelement location="${clj-ds.dir}"/>
|
|---|
| 112 | </path>
|
|---|
| 113 |
|
|---|
| 114 | <path id="test.execute.classpath">
|
|---|
| 115 | <pathelement location="${test.bin.dir}" />
|
|---|
| 116 | <pathelement location="${bin.dir}" />
|
|---|
| 117 | <pathelement location="${antlr.jar}" />
|
|---|
| 118 | <pathelement location="${junit.jar}" />
|
|---|
| 119 | <pathelement location="${sarl.jar}"/>
|
|---|
| 120 | <pathelement location="${gmc.jar}"/>
|
|---|
| 121 | <pathelement location="${abc.jar}"/>
|
|---|
| 122 | <pathelement location="${cvc3.jar}"/>
|
|---|
| 123 | <pathelement location="${pcollections.jar}"/>
|
|---|
| 124 | <pathelement location="${clj-ds.dir}"/>
|
|---|
| 125 | </path>
|
|---|
| 126 |
|
|---|
| 127 | <target name="test-init">
|
|---|
| 128 | <delete dir="${junit.dir}" quiet="true" />
|
|---|
| 129 | <delete dir="${test.bin.dir}" quiet="true" />
|
|---|
| 130 | <mkdir dir="${junit.dir}" />
|
|---|
| 131 | <mkdir dir="${junit.data.dir}" />
|
|---|
| 132 | <mkdir dir="${junit.reports.dir}" />
|
|---|
| 133 | <mkdir dir="${test.bin.dir}" />
|
|---|
| 134 | </target>
|
|---|
| 135 |
|
|---|
| 136 | <target name="test-compile" depends="compile,test-init">
|
|---|
| 137 | <javac destdir="${test.bin.dir}" debug="true" failonerror="false" classpathref="test.compile.classpath" encoding="UTF-8" includeantruntime="true">
|
|---|
| 138 | <src path="${test.src.dir}" />
|
|---|
| 139 | </javac>
|
|---|
| 140 | </target>
|
|---|
| 141 |
|
|---|
| 142 | <target name="test" depends="test-compile">
|
|---|
| 143 | <junit printsummary="false" errorProperty="test.failed" failureProperty="test.failed" fork="true" timeout="300000">
|
|---|
| 144 | <jvmarg value="-ea" />
|
|---|
| 145 | <sysproperty key="java.library.path" path="${cvc3.jni.dir}"/>
|
|---|
| 146 | <classpath refid="test.execute.classpath" />
|
|---|
| 147 | <formatter type="brief" usefile="false" />
|
|---|
| 148 | <formatter type="xml" />
|
|---|
| 149 | <batchtest todir="${junit.data.dir}">
|
|---|
| 150 | <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
|
|---|
| 151 | </batchtest>
|
|---|
| 152 | </junit>
|
|---|
| 153 | <junitreport todir="${junit.data.dir}">
|
|---|
| 154 | <fileset dir="${junit.data.dir}">
|
|---|
| 155 | <include name="TEST-*.xml" />
|
|---|
| 156 | </fileset>
|
|---|
| 157 | <report format="frames" todir="${junit.reports.dir}">
|
|---|
| 158 | <param name="TITLE" expression="JUnit Report for CIVL Project, Revision ${revision}" />
|
|---|
| 159 | </report>
|
|---|
| 160 | </junitreport>
|
|---|
| 161 | <fail message="Tests failed. Check log and/or reports." if="test.failed" />
|
|---|
| 162 | </target>
|
|---|
| 163 |
|
|---|
| 164 | <!-- Cobertura Tasks -->
|
|---|
| 165 |
|
|---|
| 166 | <target name="cobertura-init" depends="test-compile">
|
|---|
| 167 | <delete dir="${cobertura.dir}" quiet="true" />
|
|---|
| 168 | <delete file="${cob.ser.file}" quiet="true" />
|
|---|
| 169 | <delete file="${cob.log.file}" quiet="true" />
|
|---|
| 170 | <mkdir dir="${cobertura.dir}" />
|
|---|
| 171 | <mkdir dir="${cob.instrumented.dir}" />
|
|---|
| 172 | <mkdir dir="${cob.reports.xml.dir}" />
|
|---|
| 173 | <mkdir dir="${cob.reports.html.dir}" />
|
|---|
| 174 | <mkdir dir="${cob.coverage.xml.dir}" />
|
|---|
| 175 | <mkdir dir="${cob.coverage.html.dir}" />
|
|---|
| 176 | </target>
|
|---|
| 177 |
|
|---|
| 178 | <target name="cobertura-instrument" depends="cobertura-init">
|
|---|
| 179 | <cobertura-instrument todir="${cob.instrumented.dir}">
|
|---|
| 180 | <ignore regex="org.apache.log4j.*" />
|
|---|
| 181 | <fileset dir="${bin.dir}">
|
|---|
| 182 | <include name="**/*.class" />
|
|---|
| 183 | </fileset>
|
|---|
| 184 | </cobertura-instrument>
|
|---|
| 185 | </target>
|
|---|
| 186 |
|
|---|
| 187 | <path id="instrumented.classpath">
|
|---|
| 188 | <pathelement location="${cob.instrumented.dir}" />
|
|---|
| 189 | <pathelement location="${test.bin.dir}" />
|
|---|
| 190 | <pathelement location="${antlr.jar}" />
|
|---|
| 191 | <pathelement location="${junit.jar}" />
|
|---|
| 192 | <pathelement location="${bin.dir}" />
|
|---|
| 193 | </path>
|
|---|
| 194 |
|
|---|
| 195 | <target name="cobertura-test" depends="cobertura-instrument">
|
|---|
| 196 | <junit fork="yes" dir="${basedir}" failureProperty="test.failed">
|
|---|
| 197 | <jvmarg value="-ea" />
|
|---|
| 198 | <classpath refid="instrumented.classpath" />
|
|---|
| 199 | <classpath refid="cobertura.classpath" />
|
|---|
| 200 | <formatter type="xml" />
|
|---|
| 201 | <batchtest todir="${cob.reports.xml.dir}">
|
|---|
| 202 | <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
|
|---|
| 203 | </batchtest>
|
|---|
| 204 | </junit>
|
|---|
| 205 | <junitreport todir="${cob.reports.xml.dir}">
|
|---|
| 206 | <fileset dir="${cob.reports.xml.dir}">
|
|---|
| 207 | <include name="TEST-*.xml" />
|
|---|
| 208 | </fileset>
|
|---|
| 209 | <report format="frames" todir="${cob.reports.html.dir}">
|
|---|
| 210 | <param name="TITLE" expression="JUnit Report for CIVL Project, Revision ${revision}" />
|
|---|
| 211 | </report>
|
|---|
| 212 | </junitreport>
|
|---|
| 213 | </target>
|
|---|
| 214 |
|
|---|
| 215 | <target name="cobertura-html-coverage-report" depends="cobertura-test">
|
|---|
| 216 | <cobertura-report destdir="${cob.coverage.html.dir}">
|
|---|
| 217 | <fileset dir="${src.dir}">
|
|---|
| 218 | <include name="**/*.java" />
|
|---|
| 219 | </fileset>
|
|---|
| 220 | </cobertura-report>
|
|---|
| 221 | </target>
|
|---|
| 222 |
|
|---|
| 223 | <target name="cobertura" depends="cobertura-html-coverage-report" />
|
|---|
| 224 |
|
|---|
| 225 | <!-- Javadoc Tasks -->
|
|---|
| 226 |
|
|---|
| 227 | <path id="javadoc.classpath">
|
|---|
| 228 | <pathelement location="${src.dir}" />
|
|---|
| 229 | <pathelement location="${junit.jar}" />
|
|---|
| 230 | <pathelement location="${antlr.jar}" />
|
|---|
| 231 | </path>
|
|---|
| 232 |
|
|---|
| 233 | <target name="javadoc">
|
|---|
| 234 | <delete dir="${javadoc.dir}" quiet="true" />
|
|---|
| 235 | <mkdir dir="${javadoc.dir}" />
|
|---|
| 236 | <javadoc destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="CIVL Project API, Revision ${revision}" access="public" classpathref="javadoc.classpath" failonerror="false">
|
|---|
| 237 | <fileset dir="${src.dir}" defaultexcludes="yes">
|
|---|
| 238 | <include name="**/*.java" />
|
|---|
| 239 | </fileset>
|
|---|
| 240 | </javadoc>
|
|---|
| 241 | </target>
|
|---|
| 242 |
|
|---|
| 243 | <!-- Clean -->
|
|---|
| 244 |
|
|---|
| 245 | <target name="clean" description="Delete all generated files.">
|
|---|
| 246 | <delete dir="${bin.dir}" />
|
|---|
| 247 | <delete dir="${test.bin.dir}" />
|
|---|
| 248 | <delete dir="${junit.dir}" />
|
|---|
| 249 | <delete dir="${javadoc.dir}" />
|
|---|
| 250 | <delete file="${jar-path}" />
|
|---|
| 251 | <delete dir="${cobertura.dir}" />
|
|---|
| 252 | <delete file="${cob.ser.file}" />
|
|---|
| 253 | <delete file="${cob.log.file}" />
|
|---|
| 254 | <delete file="${manifest-file}" />
|
|---|
| 255 | </target>
|
|---|
| 256 |
|
|---|
| 257 | <!-- Do everything -->
|
|---|
| 258 |
|
|---|
| 259 | <target name="all" depends="jar,test,cobertura,javadoc" />
|
|---|
| 260 |
|
|---|
| 261 | </project>
|
|---|