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

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

Adjustments to ignore property and fine tuning of clean targets.

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

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