source: CIVL/build.xml@ 844ebd8

1.23 2.0 main test-branch
Last change on this file since 844ebd8 was b6c1fcb, checked in by Tim Zirkel <zirkeltk@…>, 13 years ago

Initial commit of model builder, side effect remover, and other related classes.

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

  • Property mode set to 100644
File size: 12.4 KB
RevLine 
[173ff32]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="jar">
14
15 <!-- Directories -->
16
17 <property file="build.properties" />
18 <property name="src.dir" value="${basedir}/src" />
[af8a6cb]19 <property name="real.src.dir" value="${src.dir}/edu/udel/cis/vsl/civl/civlc" />
[173ff32]20 <property name="bin.dir" value="${basedir}/bin" />
21 <property name="grammar.dir" value="${basedir}/grammar" />
22 <property name="javadoc.dir" value="${basedir}/doc/javadoc" />
23 <property name="jar-name" value="civl.jar" />
24 <property name="jar-path" value="${basedir}/${jar-name}" />
[34760dc]25<!--
[173ff32]26 <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
[34760dc]27 -->
[dad210da]28 <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
[173ff32]29
30 <!-- Junit: automated unit tester Properties -->
31
32 <property name="test.src.dir" location="${basedir}/test" />
33 <property name="test.bin.dir" location="${basedir}/bin-test" />
34 <property name="junit.dir" location="${basedir}/junit" />
35 <property name="junit.data.dir" location="${junit.dir}/data" />
36 <property name="junit.reports.dir" location="${junit.dir}/reports" />
37
38 <!-- Cobertura: test coverage analyzer Properties -->
39
40 <property name="cob.log.file" value="${basedir}/cobertura.log" />
41 <property name="cob.ser.file" value="${basedir}/cobertura.ser" />
42 <property name="cobertura.dir" value="${basedir}/cobertura" />
43 <property name="cob.instrumented.dir" value="${cobertura.dir}/instrumented" />
44 <property name="cob.reports.dir" value="${cobertura.dir}/reports" />
45 <property name="cob.reports.xml.dir" value="${cob.reports.dir}/junit-xml" />
46 <property name="cob.reports.html.dir" value="${cob.reports.dir}/junit-html" />
47 <property name="cob.coverage.xml.dir" value="${cob.reports.dir}/cobertura-xml" />
48 <property name="cob.coverage.html.dir" value="${cob.reports.dir}/cobertura-html" />
49
50 <!-- Tell Ant about Cobertura tasks -->
51
52 <path id="cobertura.classpath">
53 <fileset dir="${cobertura.lib.dir}">
54 <include name="cobertura.jar" />
55 <include name="lib/**/*.jar" />
56 </fileset>
57 </path>
58
59 <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
60
61
62 <!-- Running ANTLR -->
63
64 <path id="antlr.class.path">
65 <pathelement location="${antlr.jar}" />
66 </path>
67
68 <target name="parsers" depends="CivlCParser,PreprocessorExpressionParser,PreprocessorParser,PreprocessorLexer">
69 </target>
70
71 <target name="checkCivlCParserChanges">
72 <uptodate property="noCivlCParserChanges">
73 <srcfiles file="${grammar.dir}/CivlCParser.g" />
74 <srcfiles file="${grammar.dir}/PreprocessorLexer.g" />
75 <srcfiles file="${grammar.dir}/PreprocessorLexer.tokens" />
76 <srcfiles file="${grammar.dir}/PreprocessorParser.g" />
77 <srcfiles file="${grammar.dir}/PreprocessorParser.tokens" />
78 <mapper type="merge" to="${real.src.dir}/parse/common/CivlCParser.java" />
79 </uptodate>
80 </target>
81
82 <target name="CivlCParser" depends="PreprocessorParser,checkCivlCParserChanges" unless="noCivlCParserChanges">
83 <java classname="org.antlr.Tool" classpathref="antlr.class.path" fork="true" failonerror="true" dir="${grammar.dir}">
84 <arg value="-verbose" />
85 <arg value="CivlCParser.g" />
86 </java>
87 <move file="${grammar.dir}/CivlCParser.java" todir="${real.src.dir}/parse/common" />
88 </target>
89
90 <target name="checkExpressionParserChanges">
91 <uptodate property="noExpressionParserChanges">
92 <srcfiles file="${grammar.dir}/PreprocessorExpressionParser.g" />
93 <srcfiles file="${grammar.dir}/PreprocessorLexer.g" />
94 <srcfiles file="${grammar.dir}/PreprocessorLexer.tokens" />
95 <mapper type="merge" to="${real.src.dir}/preproc/common/PreprocessorExpressionParser.java" />
96 </uptodate>
97 </target>
98
99 <target name="PreprocessorExpressionParser" depends="PreprocessorLexer,checkExpressionParserChanges" unless="noExpressionParserChanges">
100 <java classname="org.antlr.Tool" classpathref="antlr.class.path" fork="true" failonerror="true" dir="${grammar.dir}">
101 <arg value="-verbose" />
102 <arg value="PreprocessorExpressionParser.g" />
103 </java>
104 <move file="${grammar.dir}/PreprocessorExpressionParser.java" todir="${real.src.dir}/preproc/common" />
105 </target>
106
107 <target name="checkParserChanges">
108 <uptodate property="noParserChanges">
109 <srcfiles file="${grammar.dir}/PreprocessorParser.g" />
110 <srcfiles file="${grammar.dir}/PreprocessorLexer.g" />
111 <srcfiles file="${grammar.dir}/PreprocessorLexer.tokens" />
112 <mapper type="merge" to="${real.src.dir}/preproc/common/PreprocessorParser.java" />
113 </uptodate>
114 </target>
115
116 <target name="PreprocessorParser" depends="PreprocessorLexer,checkParserChanges" unless="noParserChanges">
117 <java classname="org.antlr.Tool" classpathref="antlr.class.path" fork="true" failonerror="true" dir="${grammar.dir}">
118 <arg value="-verbose" />
119 <arg value="PreprocessorParser.g" />
120 </java>
121 <move file="${grammar.dir}/PreprocessorParser.java" todir="${real.src.dir}/preproc/common" />
122 </target>
123
124 <target name="checkLexerChanges">
125 <uptodate property="noLexerChanges">
126 <srcfiles file="${grammar.dir}/PreprocessorLexer.g" />
127 <compositemapper>
128 <mapper type="merge" to="${grammar.dir}/PreprocessorLexer.tokens" />
129 <mapper type="merge" to="${real.src.dir}/preproc/common/PreprocessorLexer.java" />
130 </compositemapper>
131 </uptodate>
132 </target>
133
134 <target name="PreprocessorLexer" depends="checkLexerChanges" unless="noLexerChanges">
135 <java classname="org.antlr.Tool" classpathref="antlr.class.path" fork="true" failonerror="true" dir="${grammar.dir}">
136 <arg value="-verbose" />
137 <arg value="PreprocessorLexer.g" />
138 </java>
139 <move file="${grammar.dir}/PreprocessorLexer.java" todir="${real.src.dir}/preproc/common" />
140 </target>
141
142
143 <!-- Source compilation and JAR construction -->
144
145 <path id="src.compile.classpath">
146 <pathelement location="${src.dir}" />
147 <pathelement location="${antlr.jar}" />
[b6c1fcb]148 <pathelement location="${sarl.jar}"/>
149 <pathelement location="${gmc.jar}"/>
[173ff32]150 </path>
151
152 <target name="compile" description="Compile all java source files." depends="parsers">
153 <mkdir dir="${bin.dir}" />
154 <javac debug="true" srcdir="${src.dir}" destdir="${bin.dir}" includes="edu/udel/cis/vsl/civl/**" classpathref="src.compile.classpath" includeantruntime="false">
155 </javac>
156 </target>
157
158 <target name="jar" depends="compile" description="Jar up all class files.">
159 <jar destfile="${jar-path}">
160 <fileset dir="${bin.dir}" />
161 <fileset dir="${antlr.runtime.bin}" />
[af8a6cb]162 <fileset dir="${basedir}/lib" />
[173ff32]163 <manifest>
164 <attribute name="Built-By" value="${user.name}" />
165 <attribute name="Main-Class" value="${main-class}" />
166 </manifest>
167 </jar>
168 </target>
169
170 <!-- Plain JUnit tests -->
171
172 <path id="test.compile.classpath">
173 <pathelement location="${test.src.dir}" />
174 <pathelement location="${bin.dir}" />
175 <pathelement location="${antlr.jar}" />
176 <pathelement location="${junit.jar}" />
[b6c1fcb]177 <pathelement location="${sarl.jar}"/>
178 <pathelement location="${gmc.jar}"/>
[173ff32]179 </path>
180
181 <path id="test.execute.classpath">
182 <pathelement location="${test.bin.dir}" />
183 <pathelement location="${bin.dir}" />
184 <pathelement location="${antlr.jar}" />
185 <pathelement location="${junit.jar}" />
[b6c1fcb]186 <pathelement location="${sarl.jar}"/>
187 <pathelement location="${gmc.jar}"/>
[173ff32]188 </path>
189
190 <target name="test-init">
191 <delete dir="${junit.dir}" quiet="true" />
192 <delete dir="${test.bin.dir}" quiet="true" />
193 <mkdir dir="${junit.dir}" />
194 <mkdir dir="${junit.data.dir}" />
195 <mkdir dir="${junit.reports.dir}" />
196 <mkdir dir="${test.bin.dir}" />
197 </target>
198
199 <target name="test-compile" depends="compile,test-init">
200 <javac destdir="${test.bin.dir}" debug="true" failonerror="false" classpathref="test.compile.classpath" includeantruntime="true">
201 <src path="${test.src.dir}" />
202 </javac>
203 </target>
204
205 <target name="test" depends="test-compile">
206 <junit printsummary="false" errorProperty="test.failed" failureProperty="test.failed" fork="true" timeout="300000">
207 <jvmarg value="-ea" />
208 <classpath refid="test.execute.classpath" />
209 <formatter type="brief" usefile="false" />
210 <formatter type="xml" />
211 <batchtest todir="${junit.data.dir}">
212 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
213 </batchtest>
214 </junit>
215 <junitreport todir="${junit.data.dir}">
216 <fileset dir="${junit.data.dir}">
217 <include name="TEST-*.xml" />
218 </fileset>
219 <report format="frames" todir="${junit.reports.dir}">
220 <param name="TITLE" expression="JUnit Report for CIVL Project, Revision ${revision}" />
221 </report>
222 </junitreport>
223 <fail message="Tests failed. Check log and/or reports." if="test.failed" />
224 </target>
225
226 <!-- Cobertura Tasks -->
227
228 <target name="cobertura-init" depends="test-compile">
229 <delete dir="${cobertura.dir}" quiet="true" />
230 <delete file="${cob.ser.file}" quiet="true" />
231 <delete file="${cob.log.file}" quiet="true" />
232 <mkdir dir="${cobertura.dir}" />
233 <mkdir dir="${cob.instrumented.dir}" />
234 <mkdir dir="${cob.reports.xml.dir}" />
235 <mkdir dir="${cob.reports.html.dir}" />
236 <mkdir dir="${cob.coverage.xml.dir}" />
237 <mkdir dir="${cob.coverage.html.dir}" />
238 </target>
239
240 <target name="cobertura-instrument" depends="cobertura-init">
241 <cobertura-instrument todir="${cob.instrumented.dir}">
242 <ignore regex="org.apache.log4j.*" />
243 <fileset dir="${bin.dir}">
244 <include name="**/*.class" />
245 </fileset>
246 </cobertura-instrument>
247 </target>
248
249 <path id="instrumented.classpath">
250 <pathelement location="${cob.instrumented.dir}" />
251 <pathelement location="${test.bin.dir}" />
252 <pathelement location="${antlr.jar}" />
253 <pathelement location="${junit.jar}" />
254 <pathelement location="${bin.dir}" />
255 </path>
256
257 <target name="cobertura-test" depends="cobertura-instrument">
258 <junit fork="yes" dir="${basedir}" failureProperty="test.failed">
259 <jvmarg value="-ea" />
260 <classpath refid="instrumented.classpath" />
261 <classpath refid="cobertura.classpath" />
262 <formatter type="xml" />
263 <batchtest todir="${cob.reports.xml.dir}">
264 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
265 </batchtest>
266 </junit>
267 <junitreport todir="${cob.reports.xml.dir}">
268 <fileset dir="${cob.reports.xml.dir}">
269 <include name="TEST-*.xml" />
270 </fileset>
271 <report format="frames" todir="${cob.reports.html.dir}">
272 <param name="TITLE" expression="JUnit Report for CIVL Project, Revision ${revision}" />
273 </report>
274 </junitreport>
275 </target>
276
277 <target name="cobertura-html-coverage-report" depends="cobertura-test">
278 <cobertura-report destdir="${cob.coverage.html.dir}">
279 <fileset dir="${src.dir}">
280 <include name="**/*.java" />
281 </fileset>
282 </cobertura-report>
283 </target>
284
285 <target name="cobertura" depends="cobertura-html-coverage-report" />
286
287 <!-- Javadoc Tasks -->
288
289 <path id="javadoc.classpath">
290 <pathelement location="${src.dir}" />
291 <pathelement location="${junit.jar}" />
292 <pathelement location="${antlr.jar}" />
293 </path>
294
295 <target name="javadoc">
296 <delete dir="${javadoc.dir}" quiet="true" />
297 <mkdir dir="${javadoc.dir}" />
298 <javadoc destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="CIVL Project API, Revision ${revision}" access="public" classpathref="javadoc.classpath" failonerror="false">
299 <fileset dir="${src.dir}" defaultexcludes="yes">
300 <include name="**/*.java" />
301 </fileset>
302 </javadoc>
303 </target>
304
305 <!-- Clean -->
306
307 <target name="clean" description="Delete all generated files.">
308 <delete dir="${bin.dir}" />
309 <delete dir="${test.bin.dir}" />
310 <delete dir="${junit.dir}" />
311 <delete dir="${javadoc.dir}" />
312 <delete file="${jar-path}" />
313 <delete dir="${cobertura.dir}" />
314 <delete file="${cob.ser.file}" />
315 <delete file="${cob.log.file}" />
316 <delete file="${manifest-file}" />
[af8a6cb]317 <delete file="${grammar.dir}/CivlCParser.tokens" />
[110cd04]318 <delete file="${real.src.dir}/parse/common/CivlCParser.java" />
[173ff32]319 <delete file="${grammar.dir}/PreprocessorLexer.tokens" />
[110cd04]320 <delete file="${real.src.dir}/preproc/common/PreprocessorLexer.java" />
[173ff32]321 <delete file="${grammar.dir}/PreprocessorParser.tokens" />
[110cd04]322 <delete file="${real.src.dir}/preproc/common/PreprocessorParser.java" />
[173ff32]323 <delete file="${grammar.dir}/PreprocessorExpressionParser.tokens" />
[110cd04]324 <delete file="${real.src.dir}/preproc/common/PreprocessorExpressionParser.java" />
[173ff32]325 </target>
326
327 <!-- Do everything -->
328
329 <target name="all" depends="jar,test,cobertura,javadoc" />
330
331</project>
Note: See TracBrowser for help on using the repository browser.