source: CIVL/mods/dev.civl.mc/build.xml@ 03f10e9

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

Removed coverage analysis as experiment.

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

  • Property mode set to 100644
File size: 10.2 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" default="compile"
14 xmlns:jacoco="antlib:org.jacoco.ant">
15 <import file="../../common.xml" />
16
17 <!-- Properties -->
18 <property name="src.dir" value="${mc.src.dir}" />
19 <property name="bin.dir" value="${mc.bin.dir}" />
20 <property name="real.src.dir" value="${src.dir}/dev/civl/mc" />
21 <property name="main-class" value="dev.civl.mc.CIVL" />
22 <property name="grammar.dir" value="${mc.dir}/grammar" />
23 <property name="test.src.dir" location="${mc.test.dir}/regress" />
24 <property name="test.bin.root.dir" location="${mc.dir}/bin-test" />
25 <property name="test.bin.dir"
26 location="${test.bin.root.dir}/regress" />
27 <property name="junit.dir" location="${mc.junit.dir}" />
28 <property name="junit.data.dir" location="${junit.dir}/data" />
29 <property name="junit.reports.dir" location="${junit.dir}/reports" />
30 <property name="coverage.dir" location="${mc.coverage.dir}" />
31 <property name="bench.src.dir" location="${mc.bench.dir}" />
32 <property name="javadoc.dir" value="${mc.javadoc.dir}" />
33
34 <!-- Running ANTLR -->
35
36 <target name="checkCommandParserChanges">
37 <uptodate property="noCommandParserChanges">
38 <srcfiles file="${grammar.dir}/Command.g4" />
39 <srcfiles file="${grammar.dir}/Command.tokens" />
40 <srcfiles file="${grammar.dir}/CommandLexer.tokens" />
41 <compositemapper>
42 <mapper type="merge"
43 to="${real.src.dir}/run/common/CommandLexer.java" />
44 <mapper type="merge"
45 to="${real.src.dir}/run/common/CommandParser.java" />
46 <mapper type="merge"
47 to="${real.src.dir}/run/common/CommandListener.java" />
48 <mapper type="merge"
49 to="${real.src.dir}/run/common/CommandBaseListener.java" />
50 </compositemapper>
51 </uptodate>
52 </target>
53
54 <target name="CommandParser" depends="checkCommandParserChanges"
55 unless="noCommandParserChanges">
56 <java classname="org.antlr.v4.Tool"
57 classpathref="antlr4.class.path"
58 fork="true" failonerror="true" dir="${grammar.dir}">
59 <arg value="-package" />
60 <arg value="dev.civl.mc.run.common" />
61 <arg value="Command.g4" />
62 </java>
63 <move file="${grammar.dir}/CommandLexer.java"
64 todir="${real.src.dir}/run/common" />
65 <move file="${grammar.dir}/CommandParser.java"
66 todir="${real.src.dir}/run/common" />
67 <move file="${grammar.dir}/CommandListener.java"
68 todir="${real.src.dir}/run/common" />
69 <move file="${grammar.dir}/CommandBaseListener.java"
70 todir="${real.src.dir}/run/common" />
71 </target>
72
73 <!-- Source compilation -->
74
75 <path id="module.path">
76 <pathelement path="${sarl.bin.dir}" />
77 <pathelement path="${abc.bin.dir}" />
78 <pathelement path="${gmc.bin.dir}" />
79 <pathelement path="${mc.bin.dir}" />
80 <pathelement location="${antlr4.runtime.mod.jar.path}" />
81 <pathelement location="${antlr3.runtime.mod.jar.path}" />
82 </path>
83
84 <!-- note that ABC builds SARL -->
85 <target name="dependencies"
86 description="Compile SARL, ABC, GMC modules.">
87 <ant dir="${abc.dir}" target="compile" inheritAll="false" />
88 <ant dir="${gmc.dir}" target="compile" inheritAll="false" />
89 </target>
90
91 <target name="compile" depends="CommandParser,dependencies"
92 description="Compile all Java source files for CIVL.">
93 <mkdir dir="${bin.dir}" />
94 <javac release="${javaversion}" debug="true"
95 srcdir="${src.dir}" destdir="${bin.dir}"
96 modulepathref="module.path"
97 encoding="UTF-8" includeantruntime="false" />
98 <copy todir="${bin.dir}/include">
99 <fileset dir="${src.dir}/include" />
100 </copy>
101 </target>
102
103 <!-- JUnit tests and Jacoco coverage analysis -->
104
105 <path id="test.compile.classpath">
106 <pathelement location="${test.src.dir}" />
107 <pathelement location="${bin.dir}" />
108 <pathelement location="${sarl.bin.dir}" />
109 <pathelement location="${abc.bin.dir}" />
110 <pathelement location="${gmc.bin.dir}" />
111 <pathelement location="${junit.jar}" />
112 <pathelement location="${hamcrest.jar}" />
113 <pathelement location="${antlr4.runtime.jar}" />
114 <pathelement location="${antlr3.runtime.jar}" />
115 </path>
116
117 <path id="test.execute.classpath">
118 <pathelement location="${test.bin.dir}" />
119 <pathelement location="${bin.dir}" />
120 <pathelement location="${root.dir}" />
121 <pathelement location="${sarl.bin.dir}" />
122 <pathelement location="${abc.bin.dir}" />
123 <pathelement location="${gmc.bin.dir}" />
124 <pathelement location="${junit.jar}" />
125 <pathelement location="${hamcrest.jar}" />
126 <pathelement location="${antlr4.runtime.jar}" />
127 <pathelement location="${antlr3.runtime.jar}" />
128 </path>
129
130 <target name="test-init">
131 <delete dir="${junit.dir}" quiet="true" />
132 <delete dir="${test.bin.dir}" quiet="true" />
133 <mkdir dir="${junit.dir}" />
134 <mkdir dir="${junit.data.dir}" />
135 <mkdir dir="${junit.reports.dir}" />
136 <mkdir dir="${test.bin.dir}" />
137 </target>
138
139 <target name="test-compile" depends="compile,test-init">
140 <javac release="${javaversion}" destdir="${test.bin.dir}"
141 debug="true" failonerror="false"
142 classpathref="test.compile.classpath"
143 encoding="UTF-8" includeantruntime="true">
144 <src path="${test.src.dir}" />
145 </javac>
146 </target>
147
148
149
150 <target name="test-only" depends="test-compile">
151 <junit dir="${root.dir}" fork="true" forkmode="perTest"
152 threads="${nthreads}" timeout="900000">
153 <jvmarg value="-ea" />
154 <classpath refid="test.execute.classpath" />
155 <formatter type="brief" usefile="false" />
156 <formatter type="xml" />
157 <batchtest todir="${junit.data.dir}">
158 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
159 </batchtest>
160 </junit>
161 <junitreport todir="${junit.data.dir}">
162 <fileset dir="${junit.data.dir}">
163 <include name="TEST-*.xml" />
164 </fileset>
165 <report format="frames" todir="${junit.reports.dir}">
166 <param name="TITLE"
167 expression="JUnit Report for CIVL-MC ${civlversion}.${revision} Regression Suite" />
168 </report>
169 </junitreport>
170 </target>
171
172
173
174 <target name="test-run" depends="test-compile">
175 <jacoco:coverage
176 excludes="*Listener*:*Lexer*:*Parser*"
177 includes="dev/civl/mc/*"
178 destfile="${mc.dir}/jacoco.exec">
179 <junit dir="${root.dir}" fork="true" forkmode="perTest"
180 threads="${nthreads}" timeout="900000">
181 <jvmarg value="-ea" />
182 <classpath refid="test.execute.classpath" />
183 <formatter type="brief" usefile="false" />
184 <formatter type="xml" />
185 <batchtest todir="${junit.data.dir}">
186 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
187 </batchtest>
188 </junit>
189 </jacoco:coverage>
190 <junitreport todir="${junit.data.dir}">
191 <fileset dir="${junit.data.dir}">
192 <include name="TEST-*.xml" />
193 </fileset>
194 <report format="frames" todir="${junit.reports.dir}">
195 <param name="TITLE"
196 expression="JUnit Report for CIVL ${civlversion}.${revision} Regression Suite" />
197 </report>
198 </junitreport>
199 </target>
200
201 <target name="test" depends="test-run">
202 <jacoco:report>
203 <executiondata>
204 <file file="jacoco.exec" />
205 </executiondata>
206 <structure name="Test Coverage Report for CIVL ${civlversion}.${revision} Regression Suite">
207 <classfiles>
208 <fileset dir="${bin.dir}" />
209 </classfiles>
210 <sourcefiles encoding="UTF-8">
211 <fileset dir="${src.dir}" />
212 </sourcefiles>
213 </structure>
214 <html destdir="coverage" />
215 </jacoco:report>
216 </target>
217
218 <!-- Benchmark Tasks -->
219
220 <!-- TODO: just make this part of regular CIVL source? -->
221
222 <target name="bench-compile" depends="compile"
223 description="Compile benchmark java source files.">
224 <javac release="${javaversion}"
225 debug="true" srcdir="${bench.src.dir}" destdir="${bin.dir}"
226 modulepathref="module.path"
227 encoding="UTF-8" includeantruntime="false"
228 includes="dev/civl/mc/**/*Benchmark.java" />
229 </target>
230
231 <target name="bench-scale-compile" depends="compile"
232 description="Compile scale benchmark java source files.">
233 <javac release="${javaversion}"
234 debug="true" srcdir="${bench.src.dir}" destdir="${bin.dir}"
235 modulepathref="module.path"
236 encoding="UTF-8" includeantruntime="false"
237 includes="dev/civl/mc/**/**/*BenchmarkScale.java" />
238 </target>
239
240 <!-- Javadoc Tasks -->
241
242 <target name="javadoc" depends="dependencies">
243 <delete dir="${javadoc.dir}" quiet="true" />
244 <mkdir dir="${javadoc.dir}" />
245 <javadoc destdir="${javadoc.dir}"
246 Overview="${src.dir}/overview.html"
247 author="false" version="true" use="true"
248 windowtitle="CIVL ${civlversion}.${revision}"
249 access="package"
250 failonerror="false" failonwarning="false">
251 <arg value="-Xmaxwarns"/>
252 <arg value="10000"/>
253 <arg value="-Xmaxerrs"/>
254 <arg value="10000"/>
255 <modulepath>
256 <pathelement path="${bin.dir}" />
257 <pathelement path="${sarl.bin.dir}" />
258 <pathelement path="${abc.bin.dir}" />
259 <pathelement path="${gmc.bin.dir}" />
260 <pathelement location="${antlr4.runtime.mod.jar.path}" />
261 <pathelement location="${antlr3.runtime.mod.jar.path}" />
262 </modulepath>
263 <packageset dir="${src.dir}" defaultexcludes="yes">
264 <include name="**/IF" />
265 <include name="**/IF/**" />
266 <include name="dev/civl/mc" />
267 </packageset>
268 </javadoc>
269 </target>
270
271 <!-- Clean -->
272
273 <target name="clean" description="Delete all generated files."
274 depends="clean-default">
275 <delete dir="${bin.dir}" />
276 <delete dir="${test.bin.root.dir}" />
277 <delete dir="${junit.dir}" />
278 <delete dir="${javadoc.dir}" />
279 <delete dir="${coverage.dir}" />
280 <delete file="${mc.dir}/jacoco.exec" />
281 <delete file="${grammar.dir}/Command.tokens" />
282 <delete file="${grammar.dir}/CommandLexer.tokens" />
283 <delete file="${real.src.dir}/run/common/CommandLexer.java" />
284 <delete file="${real.src.dir}/run/common/CommandParser.java" />
285 <delete file="${real.src.dir}/run/common/CommandListener.java" />
286 <delete file="${real.src.dir}/run/common/CommandBaseListener.java" />
287 </target>
288
289 <!-- Do everything -->
290
291 <target name="all" depends="test,javadoc,bench-compile,bench-scale-compile" />
292
293</project>
Note: See TracBrowser for help on using the repository browser.