source: CIVL/build.xml@ a0b7ab5

1.23 2.0 main test-branch
Last change on this file since a0b7ab5 was eb8c59a, checked in by Stephen Siegel <siegel@…>, 6 years ago

Trying again to fix the jacoco ant task includes/excludes

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5385 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 9.6 KB
Line 
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 release="${javaversion}" 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 release="${javaversion}" 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 <!-- What t nclde n nstrmentatn
156 All CVL classes nt generated Lstener Lexer Parser
157
158 -->
159
160 <target name="test-run" depends="test-compile">
161 <jacoco:coverage
162 excludes="*Listener*:*Lexer*:*Parser*"
163 includes="edu/udel/cis/vsl/civl/*">
164 <junit fork="true" forkmode="perTest" threads="${nthreads}" timeout="900000">
165 <jvmarg value="-ea" />
166 <classpath refid="test.execute.classpath" />
167 <formatter type="brief" usefile="false" />
168 <formatter type="xml" />
169 <batchtest todir="${junit.data.dir}">
170 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
171 </batchtest>
172 </junit>
173 </jacoco:coverage>
174 <junitreport todir="${junit.data.dir}">
175 <fileset dir="${junit.data.dir}">
176 <include name="TEST-*.xml" />
177 </fileset>
178 <report format="frames" todir="${junit.reports.dir}">
179 <param name="TITLE" expression="JUnit Report for CIVL ${revision} Regression Suite" />
180 </report>
181 </junitreport>
182 </target>
183
184 <target name="test" depends="test-run">
185 <jacoco:report>
186 <executiondata>
187 <file file="jacoco.exec" />
188 </executiondata>
189 <structure name="Test Coverage Report for CIVL ${revision} Regression Suite">
190 <classfiles>
191 <fileset dir="${bin.dir}" />
192 </classfiles>
193 <sourcefiles encoding="UTF-8">
194 <fileset dir="${src.dir}" />
195 </sourcefiles>
196 </structure>
197 <html destdir="coverage" />
198 </jacoco:report>
199 </target>
200
201 <!-- Benchmark Tasks -->
202
203 <target name="bench-compile" depends="jar" description="Compile benchmark java source files.">
204 <mkdir dir="${bin.dir}" />
205 <javac release="${javaversion}" 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">
206 </javac>
207 </target>
208
209 <target name="bench-scale-compile" depends="jar" description="Compile scale benchmark java source files.">
210 <mkdir dir="${bin.dir}" />
211 <javac release="${javaversion}" 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">
212 </javac>
213 </target>
214
215 <!-- Javadoc Tasks -->
216
217 <target name="javadoc">
218 <delete dir="${javadoc.dir}" quiet="true" />
219 <mkdir dir="${javadoc.dir}" />
220 <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">
221 <packageset dir="${src.dir}" defaultexcludes="yes">
222 <include name="**/IF" />
223 <include name="**/IF/**" />
224 <include name="edu/udel/cis/vsl/civl" />
225 </packageset>
226 </javadoc>
227 </target>
228
229 <!-- Clean -->
230
231 <target name="clean" description="Delete all generated files.">
232 <delete dir="${bin.dir}" />
233 <delete dir="${test.bin.root.dir}" />
234 <delete dir="${junit.dir}" />
235 <delete dir="${javadoc.dir}" />
236 <delete dir="${coverage.dir}" />
237 <delete file="${jar-path}" />
238 <delete file="${basedir}/jacoco.exec" />
239 <delete file="${manifest-file}" />
240 <delete file="${grammar.dir}/Command.tokens" />
241 <delete file="${grammar.dir}/CommandLexer.tokens" />
242 <delete file="${real.src.dir}/run/common/CommandLexer.java" />
243 <delete file="${real.src.dir}/run/common/CommandParser.java" />
244 <delete file="${real.src.dir}/run/common/CommandListener.java" />
245 <delete file="${real.src.dir}/run/common/CommandBaseListener.java" />
246 </target>
247
248 <!-- Do everything -->
249
250 <target name="all" depends="jar,test,javadoc,bench-compile, bench-scale-compile" />
251
252</project>
Note: See TracBrowser for help on using the repository browser.