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

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

Fixed build files to do tests from correct directories.

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

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