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

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

Fixing some things in the build files, adding overall build file.

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