| 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" xmlns:jacoco="antlib:org.jacoco.ant">
|
|---|
| 14 |
|
|---|
| 15 | <!-- Directories -->
|
|---|
| 16 |
|
|---|
| 17 | <condition property="properties.file" value="build.properties" else="build_default.properties">
|
|---|
| 18 | <available file="build.properties" />
|
|---|
| 19 | </condition>
|
|---|
| 20 | <property file="${properties.file}" />
|
|---|
| 21 | <property file="build.properties" />
|
|---|
| 22 | <property name="src.dir" value="${basedir}/src" />
|
|---|
| 23 | <property name="real.src.dir" value="${src.dir}/edu/udel/cis/vsl/civl" />
|
|---|
| 24 | <property name="bin.dir" value="${basedir}/bin" />
|
|---|
| 25 | <property name="javadoc.dir" value="${basedir}/doc/javadoc" />
|
|---|
| 26 | <property name="jar-name" value="civl.jar" />
|
|---|
| 27 | <property name="jar-path" value="${basedir}/${jar-name}" />
|
|---|
| 28 | <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
|
|---|
| 29 | <property name="grammar.dir" value="${basedir}/grammar" />
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | <!-- Junit and JaCoCo Coverage -->
|
|---|
| 33 |
|
|---|
| 34 | <property name="test.src.dir" location="${basedir}/test/regress" />
|
|---|
| 35 | <property name="test.bin.root.dir" location="${basedir}/bin-test" />
|
|---|
| 36 | <property name="test.bin.dir" location="${test.bin.root.dir}/regress" />
|
|---|
| 37 | <property name="junit.dir" location="${basedir}/junit" />
|
|---|
| 38 | <property name="junit.data.dir" location="${junit.dir}/data" />
|
|---|
| 39 | <property name="junit.reports.dir" location="${junit.dir}/reports" />
|
|---|
| 40 | <property name="coverage.dir" location="${basedir}/coverage" />
|
|---|
| 41 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
|
|---|
| 42 | <classpath path="${jacoco.jar}" />
|
|---|
| 43 | </taskdef>
|
|---|
| 44 |
|
|---|
| 45 | <!-- Benchmark -->
|
|---|
| 46 |
|
|---|
| 47 | <property name="bench.src.dir" location="${basedir}/bench" />
|
|---|
| 48 |
|
|---|
| 49 | <!-- Running ANTLR -->
|
|---|
| 50 | <path id="antlr.class.path">
|
|---|
| 51 | <pathelement location="${antlr.jar}" />
|
|---|
| 52 | </path>
|
|---|
| 53 |
|
|---|
| 54 | <target name="checkCommandParserChanges">
|
|---|
| 55 | <uptodate property="noCommandParserChanges">
|
|---|
| 56 | <srcfiles file="${grammar.dir}/Command.g4" />
|
|---|
| 57 | <srcfiles file="${grammar.dir}/Command.tokens" />
|
|---|
| 58 | <srcfiles file="${grammar.dir}/CommandLexer.tokens" />
|
|---|
| 59 | <compositemapper>
|
|---|
| 60 | <mapper type="merge" to="${real.src.dir}/run/common/CommandLexer.java" />
|
|---|
| 61 | <mapper type="merge" to="${real.src.dir}/run/common/CommandParser.java" />
|
|---|
| 62 | <mapper type="merge" to="${real.src.dir}/run/common/CommandListener.java" />
|
|---|
| 63 | <mapper type="merge" to="${real.src.dir}/run/common/CommandBaseListener.java" />
|
|---|
| 64 | </compositemapper>
|
|---|
| 65 | </uptodate>
|
|---|
| 66 | </target>
|
|---|
| 67 |
|
|---|
| 68 | <target name="CommandParser" depends="checkCommandParserChanges" unless="noCommandParserChanges">
|
|---|
| 69 | <java classname="org.antlr.v4.Tool" classpathref="antlr.class.path" fork="true" failonerror="true" dir="${grammar.dir}">
|
|---|
| 70 | <arg value="-package" />
|
|---|
| 71 | <arg value="edu.udel.cis.vsl.civl.run.common" />
|
|---|
| 72 | <!-- <arg value="-o" />
|
|---|
| 73 | <arg value="${real.src.dir}/run/common" />-->
|
|---|
| 74 | <arg value="Command.g4" />
|
|---|
| 75 | </java>
|
|---|
| 76 | <move file="${grammar.dir}/CommandLexer.java" todir="${real.src.dir}/run/common" />
|
|---|
| 77 | <move file="${grammar.dir}/CommandParser.java" todir="${real.src.dir}/run/common" />
|
|---|
| 78 | <move file="${grammar.dir}/CommandListener.java" todir="${real.src.dir}/run/common" />
|
|---|
| 79 | <move file="${grammar.dir}/CommandBaseListener.java" todir="${real.src.dir}/run/common" />
|
|---|
| 80 | </target>
|
|---|
| 81 |
|
|---|
| 82 | <!-- Source compilation and JAR construction -->
|
|---|
| 83 |
|
|---|
| 84 | <path id="src.compile.classpath">
|
|---|
| 85 | <pathelement location="${src.dir}" />
|
|---|
| 86 | <pathelement location="${sarl.jar}" />
|
|---|
| 87 | <pathelement location="${gmc.jar}" />
|
|---|
| 88 | <pathelement location="${abc.jar}" />
|
|---|
| 89 | <pathelement location="${antlr.jar}" />
|
|---|
| 90 | </path>
|
|---|
| 91 |
|
|---|
| 92 | <target name="compile" depends="CommandParser" description="Compile all java source files.">
|
|---|
| 93 | <mkdir dir="${bin.dir}" />
|
|---|
| 94 | <javac debug="true" srcdir="${src.dir}" destdir="${bin.dir}" classpathref="src.compile.classpath" encoding="UTF-8" includeantruntime="false">
|
|---|
| 95 | </javac>
|
|---|
| 96 | <copy todir="${bin.dir}/include">
|
|---|
| 97 | <fileset dir="${src.dir}/include" />
|
|---|
| 98 | </copy>
|
|---|
| 99 | </target>
|
|---|
| 100 |
|
|---|
| 101 | <target name="jar" depends="compile" description="Jar up all class files.">
|
|---|
| 102 | <jar destfile="${jar-path}">
|
|---|
| 103 | <fileset dir="${bin.dir}" />
|
|---|
| 104 | <zipfileset includes="**/*.class" src="${abc.jar}" />
|
|---|
| 105 | <zipfileset includes="include/**" src="${abc.jar}" />
|
|---|
| 106 | <zipfileset includes="**/*.class" src="${antlr.runtime.jar}" />
|
|---|
| 107 | <zipfileset includes="**/*.class" src="${gmc.jar}" />
|
|---|
| 108 | <zipfileset includes="**/*.class" src="${sarl.jar}" />
|
|---|
| 109 | <manifest>
|
|---|
| 110 | <attribute name="Built-By" value="${user.name}" />
|
|---|
| 111 | <attribute name="Main-Class" value="${main-class}" />
|
|---|
| 112 | </manifest>
|
|---|
| 113 | </jar>
|
|---|
| 114 | </target>
|
|---|
| 115 |
|
|---|
| 116 | <!-- Plain JUnit tests -->
|
|---|
| 117 |
|
|---|
| 118 | <path id="test.compile.classpath">
|
|---|
| 119 | <pathelement location="${test.src.dir}" />
|
|---|
| 120 | <pathelement location="${bin.dir}" />
|
|---|
| 121 | <pathelement location="${junit.jar}" />
|
|---|
| 122 | <pathelement location="${hamcrest.jar}" />
|
|---|
| 123 | <pathelement location="${sarl.jar}" />
|
|---|
| 124 | <pathelement location="${gmc.jar}" />
|
|---|
| 125 | <pathelement location="${abc.jar}" />
|
|---|
| 126 | <pathelement location="${antlr.jar}" />
|
|---|
| 127 | </path>
|
|---|
| 128 |
|
|---|
| 129 | <path id="test.execute.classpath">
|
|---|
| 130 | <pathelement location="${test.bin.dir}" />
|
|---|
| 131 | <pathelement location="${bin.dir}" />
|
|---|
| 132 | <pathelement location="${junit.jar}" />
|
|---|
| 133 | <pathelement location="${hamcrest.jar}" />
|
|---|
| 134 | <pathelement location="${sarl.jar}" />
|
|---|
| 135 | <pathelement location="${gmc.jar}" />
|
|---|
| 136 | <pathelement location="${abc.jar}" />
|
|---|
| 137 | <pathelement location="${antlr.jar}" />
|
|---|
| 138 | </path>
|
|---|
| 139 |
|
|---|
| 140 | <target name="test-init">
|
|---|
| 141 | <delete dir="${junit.dir}" quiet="true" />
|
|---|
| 142 | <delete dir="${test.bin.dir}" quiet="true" />
|
|---|
| 143 | <mkdir dir="${junit.dir}" />
|
|---|
| 144 | <mkdir dir="${junit.data.dir}" />
|
|---|
| 145 | <mkdir dir="${junit.reports.dir}" />
|
|---|
| 146 | <mkdir dir="${test.bin.dir}" />
|
|---|
| 147 | </target>
|
|---|
| 148 |
|
|---|
| 149 | <target name="test-compile" depends="compile,test-init">
|
|---|
| 150 | <javac destdir="${test.bin.dir}" debug="true" failonerror="false" classpathref="test.compile.classpath" encoding="UTF-8" includeantruntime="true">
|
|---|
| 151 | <src path="${test.src.dir}" />
|
|---|
| 152 | </javac>
|
|---|
| 153 | </target>
|
|---|
| 154 |
|
|---|
| 155 | <target name="test-run" depends="test-compile">
|
|---|
| 156 | <jacoco:coverage>
|
|---|
| 157 | <junit fork="true" forkmode="once" timeout="900000">
|
|---|
| 158 | <jvmarg value="-ea" />
|
|---|
| 159 | <classpath refid="test.execute.classpath" />
|
|---|
| 160 | <formatter type="brief" usefile="false" />
|
|---|
| 161 | <formatter type="xml" />
|
|---|
| 162 | <batchtest todir="${junit.data.dir}">
|
|---|
| 163 | <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
|
|---|
| 164 | </batchtest>
|
|---|
| 165 | </junit>
|
|---|
| 166 | </jacoco:coverage>
|
|---|
| 167 | <junitreport todir="${junit.data.dir}">
|
|---|
| 168 | <fileset dir="${junit.data.dir}">
|
|---|
| 169 | <include name="TEST-*.xml" />
|
|---|
| 170 | </fileset>
|
|---|
| 171 | <report format="frames" todir="${junit.reports.dir}">
|
|---|
| 172 | <param name="TITLE" expression="JUnit Report for CIVL ${revision} Regression Suite" />
|
|---|
| 173 | </report>
|
|---|
| 174 | </junitreport>
|
|---|
| 175 | </target>
|
|---|
| 176 |
|
|---|
| 177 | <target name="test" depends="test-run">
|
|---|
| 178 | <jacoco:report>
|
|---|
| 179 | <executiondata>
|
|---|
| 180 | <file file="jacoco.exec" />
|
|---|
| 181 | </executiondata>
|
|---|
| 182 | <structure name="Test Coverage Report for CIVL ${revision} Regression Suite">
|
|---|
| 183 | <classfiles>
|
|---|
| 184 | <fileset dir="${bin.dir}" />
|
|---|
| 185 | </classfiles>
|
|---|
| 186 | <sourcefiles encoding="UTF-8">
|
|---|
| 187 | <fileset dir="${src.dir}" />
|
|---|
| 188 | </sourcefiles>
|
|---|
| 189 | </structure>
|
|---|
| 190 | <html destdir="coverage" />
|
|---|
| 191 | </jacoco:report>
|
|---|
| 192 | </target>
|
|---|
| 193 |
|
|---|
| 194 | <!-- Benchmark Tasks -->
|
|---|
| 195 |
|
|---|
| 196 | <target name="bench-compile" depends="jar" description="Compile benchmark java source files.">
|
|---|
| 197 | <mkdir dir="${bin.dir}" />
|
|---|
| 198 | <javac debug="true" srcdir="${bench.src.dir}" destdir="${bin.dir}" includes="edu/udel/cis/vsl/civl/**/*Benchmark.java" classpathref="src.compile.classpath" encoding="UTF-8" includeantruntime="false">
|
|---|
| 199 | </javac>
|
|---|
| 200 | </target>
|
|---|
| 201 |
|
|---|
| 202 | <target name="bench-scale-compile" depends="jar" description="Compile scale benchmark java source files.">
|
|---|
| 203 | <mkdir dir="${bin.dir}" />
|
|---|
| 204 | <javac debug="true" srcdir="${bench.src.dir}" destdir="${bin.dir}" includes="edu/udel/cis/vsl/civl/**/**/*BenchmarkScale.java" classpathref="src.compile.classpath" encoding="UTF-8" includeantruntime="false">
|
|---|
| 205 | </javac>
|
|---|
| 206 | </target>
|
|---|
| 207 |
|
|---|
| 208 | <!-- Javadoc Tasks -->
|
|---|
| 209 |
|
|---|
| 210 | <target name="javadoc">
|
|---|
| 211 | <delete dir="${javadoc.dir}" quiet="true" />
|
|---|
| 212 | <mkdir dir="${javadoc.dir}" />
|
|---|
| 213 | <javadoc destdir="${javadoc.dir}" Overview="src/overview.html" author="false" version="true" use="true" windowtitle="API for CIVL ${revision}" access="public" classpathref="test.execute.classpath" failonerror="false">
|
|---|
| 214 | <packageset dir="${src.dir}" defaultexcludes="yes">
|
|---|
| 215 | <include name="**/IF" />
|
|---|
| 216 | <include name="**/IF/**" />
|
|---|
| 217 | <include name="edu/udel/cis/vsl/civl" />
|
|---|
| 218 | </packageset>
|
|---|
| 219 | </javadoc>
|
|---|
| 220 | </target>
|
|---|
| 221 |
|
|---|
| 222 | <!-- Clean -->
|
|---|
| 223 |
|
|---|
| 224 | <target name="clean" description="Delete all generated files.">
|
|---|
| 225 | <delete dir="${bin.dir}" />
|
|---|
| 226 | <delete dir="${test.bin.root.dir}" />
|
|---|
| 227 | <delete dir="${junit.dir}" />
|
|---|
| 228 | <delete dir="${javadoc.dir}" />
|
|---|
| 229 | <delete dir="${coverage.dir}" />
|
|---|
| 230 | <delete file="${jar-path}" />
|
|---|
| 231 | <delete file="${basedir}/jacoco.exec" />
|
|---|
| 232 | <delete file="${manifest-file}" />
|
|---|
| 233 | <delete file="${grammar.dir}/Command.tokens" />
|
|---|
| 234 | <delete file="${grammar.dir}/CommandLexer.tokens" />
|
|---|
| 235 | <delete file="${real.src.dir}/run/common/CommandLexer.java" />
|
|---|
| 236 | <delete file="${real.src.dir}/run/common/CommandParser.java" />
|
|---|
| 237 | <delete file="${real.src.dir}/run/common/CommandListener.java" />
|
|---|
| 238 | <delete file="${real.src.dir}/run/common/CommandBaseListener.java" />
|
|---|
| 239 | </target>
|
|---|
| 240 |
|
|---|
| 241 | <!-- Do everything -->
|
|---|
| 242 |
|
|---|
| 243 | <target name="all" depends="jar,test,javadoc,bench-compile, bench-scale-compile" />
|
|---|
| 244 |
|
|---|
| 245 | </project>
|
|---|