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

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

Added junit to module path in build.xml since now it is referenced in the module-info.java and build was failing because module could not be found. Refactoring other classes to remove warnings.

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

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