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

main
Last change on this file was 00064ea, checked in by Alex Wilton <awilton@…>, 3 years ago

Fixed build issue introduced when moving include folders

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5774 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}/dev/civl/mc/src">
99 <fileset dir="${src.dir}/dev/civl/mc/src" />
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 <target name="test-only" depends="test-compile">
149 <junit dir="${root.dir}" fork="true" forkmode="perTest"
150 threads="${nthreads}" timeout="900000">
151 <jvmarg value="-ea" />
152 <classpath refid="test.execute.classpath" />
153 <formatter type="brief" usefile="false" />
154 <formatter type="xml" />
155 <batchtest todir="${junit.data.dir}">
156 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
157 </batchtest>
158 </junit>
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-MC ${civlversion}.${revision} Regression Suite" />
166 </report>
167 </junitreport>
168 </target>
169
170 <target name="test-cov-run" depends="test-compile">
171 <jacoco:coverage
172 excludes="*Listener*:*Lexer*:*Parser*"
173 includes="dev/civl/mc/*"
174 destfile="${mc.dir}/jacoco.exec">
175 <junit dir="${root.dir}" fork="true" forkmode="perTest"
176 threads="${nthreads}" timeout="900000">
177 <jvmarg value="-ea" />
178 <classpath refid="test.execute.classpath" />
179 <formatter type="brief" usefile="false" />
180 <formatter type="xml" />
181 <batchtest todir="${junit.data.dir}">
182 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
183 </batchtest>
184 </junit>
185 </jacoco:coverage>
186 <junitreport todir="${junit.data.dir}">
187 <fileset dir="${junit.data.dir}">
188 <include name="TEST-*.xml" />
189 </fileset>
190 <report format="frames" todir="${junit.reports.dir}">
191 <param name="TITLE"
192 expression="JUnit Report for CIVL-MC ${civlversion}.${revision} Regression Suite" />
193 </report>
194 </junitreport>
195 </target>
196
197 <target name="test" depends="test-cov-run">
198 <jacoco:report>
199 <executiondata>
200 <file file="jacoco.exec" />
201 </executiondata>
202 <structure name="Test Coverage Report for CIVL-MC ${civlversion}.${revision} Regression Suite">
203 <classfiles>
204 <fileset dir="${bin.dir}" />
205 </classfiles>
206 <sourcefiles encoding="UTF-8">
207 <fileset dir="${src.dir}" />
208 </sourcefiles>
209 </structure>
210 <html destdir="coverage" />
211 </jacoco:report>
212 </target>
213
214 <!-- Benchmark Tasks -->
215
216 <!-- TODO: just make this part of regular CIVL source? -->
217
218 <target name="bench-compile" depends="compile"
219 description="Compile benchmark java source files.">
220 <javac release="${javaversion}"
221 debug="true" srcdir="${bench.src.dir}" destdir="${bin.dir}"
222 modulepathref="module.path"
223 encoding="UTF-8" includeantruntime="false"
224 includes="dev/civl/mc/**/*Benchmark.java" />
225 </target>
226
227 <target name="bench-scale-compile" depends="compile"
228 description="Compile scale benchmark java source files.">
229 <javac release="${javaversion}"
230 debug="true" srcdir="${bench.src.dir}" destdir="${bin.dir}"
231 modulepathref="module.path"
232 encoding="UTF-8" includeantruntime="false"
233 includes="dev/civl/mc/**/**/*BenchmarkScale.java" />
234 </target>
235
236 <!-- Javadoc Tasks -->
237
238 <target name="javadoc" depends="dependencies">
239 <delete dir="${javadoc.dir}" quiet="true" />
240 <mkdir dir="${javadoc.dir}" />
241 <javadoc destdir="${javadoc.dir}"
242 Overview="${src.dir}/overview.html"
243 author="false" version="true" use="true"
244 windowtitle="CIVL ${civlversion}.${revision}"
245 access="package"
246 failonerror="false" failonwarning="false">
247 <arg value="-Xmaxwarns"/>
248 <arg value="10000"/>
249 <arg value="-Xmaxerrs"/>
250 <arg value="10000"/>
251 <modulepath>
252 <pathelement path="${bin.dir}" />
253 <pathelement path="${sarl.bin.dir}" />
254 <pathelement path="${abc.bin.dir}" />
255 <pathelement path="${gmc.bin.dir}" />
256 <pathelement location="${antlr4.runtime.mod.jar.path}" />
257 <pathelement location="${antlr3.runtime.mod.jar.path}" />
258 </modulepath>
259 <packageset dir="${src.dir}" defaultexcludes="yes">
260 <include name="**/IF" />
261 <include name="**/IF/**" />
262 <include name="dev/civl/mc" />
263 </packageset>
264 </javadoc>
265 </target>
266
267 <!-- Clean -->
268
269 <target name="clean" description="Delete all generated files."
270 depends="clean-default">
271 <delete dir="${bin.dir}" />
272 <delete dir="${test.bin.root.dir}" />
273 <delete dir="${junit.dir}" />
274 <delete dir="${javadoc.dir}" />
275 <delete dir="${coverage.dir}" />
276 <delete file="${mc.dir}/jacoco.exec" />
277 <delete file="${grammar.dir}/Command.tokens" />
278 <delete file="${grammar.dir}/CommandLexer.tokens" />
279 <delete file="${real.src.dir}/run/common/CommandLexer.java" />
280 <delete file="${real.src.dir}/run/common/CommandParser.java" />
281 <delete file="${real.src.dir}/run/common/CommandListener.java" />
282 <delete file="${real.src.dir}/run/common/CommandBaseListener.java" />
283 </target>
284
285 <!-- Do everything -->
286
287 <target name="all" depends="test,javadoc,bench-compile,bench-scale-compile" />
288
289</project>
Note: See TracBrowser for help on using the repository browser.