source: CIVL/build.xml@ 173ff32

1.23 2.0 acw/focus-triggers main test-branch
Last change on this file since 173ff32 was 173ff32, checked in by Stephen Siegel <siegel@…>, 14 years ago

Adding Ant build.

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

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