source: CIVL/build.xml@ 9ae277d

1.23 2.0 main test-branch
Last change on this file since 9ae277d was bc43897, checked in by Stephen Siegel <siegel@…>, 13 years ago

Porting antlr2ast from ABC to CIVL.

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

  • Property mode set to 100644
File size: 12.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" 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/civlc" />
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<!--
26 <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
27 -->
28 <property name="main-class" value="edu.udel.cis.vsl.civl.civlc.antlr2ast.Antlr2AST" />
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}" />
148 </path>
149
150 <target name="compile" description="Compile all java source files." depends="parsers">
151 <mkdir dir="${bin.dir}" />
152 <javac debug="true" srcdir="${src.dir}" destdir="${bin.dir}" includes="edu/udel/cis/vsl/civl/**" classpathref="src.compile.classpath" includeantruntime="false">
153 </javac>
154 </target>
155
156 <target name="jar" depends="compile" description="Jar up all class files.">
157 <jar destfile="${jar-path}">
158 <fileset dir="${bin.dir}" />
159 <fileset dir="${antlr.runtime.bin}" />
160 <fileset dir="${basedir}/lib" />
161 <manifest>
162 <attribute name="Built-By" value="${user.name}" />
163 <attribute name="Main-Class" value="${main-class}" />
164 </manifest>
165 </jar>
166 </target>
167
168 <!-- Plain JUnit tests -->
169
170 <path id="test.compile.classpath">
171 <pathelement location="${test.src.dir}" />
172 <pathelement location="${bin.dir}" />
173 <pathelement location="${antlr.jar}" />
174 <pathelement location="${junit.jar}" />
175 </path>
176
177 <path id="test.execute.classpath">
178 <pathelement location="${test.bin.dir}" />
179 <pathelement location="${bin.dir}" />
180 <pathelement location="${antlr.jar}" />
181 <pathelement location="${junit.jar}" />
182 </path>
183
184 <target name="test-init">
185 <delete dir="${junit.dir}" quiet="true" />
186 <delete dir="${test.bin.dir}" quiet="true" />
187 <mkdir dir="${junit.dir}" />
188 <mkdir dir="${junit.data.dir}" />
189 <mkdir dir="${junit.reports.dir}" />
190 <mkdir dir="${test.bin.dir}" />
191 </target>
192
193 <target name="test-compile" depends="compile,test-init">
194 <javac destdir="${test.bin.dir}" debug="true" failonerror="false" classpathref="test.compile.classpath" includeantruntime="true">
195 <src path="${test.src.dir}" />
196 </javac>
197 </target>
198
199 <target name="test" depends="test-compile">
200 <junit printsummary="false" errorProperty="test.failed" failureProperty="test.failed" fork="true" timeout="300000">
201 <jvmarg value="-ea" />
202 <classpath refid="test.execute.classpath" />
203 <formatter type="brief" usefile="false" />
204 <formatter type="xml" />
205 <batchtest todir="${junit.data.dir}">
206 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
207 </batchtest>
208 </junit>
209 <junitreport todir="${junit.data.dir}">
210 <fileset dir="${junit.data.dir}">
211 <include name="TEST-*.xml" />
212 </fileset>
213 <report format="frames" todir="${junit.reports.dir}">
214 <param name="TITLE" expression="JUnit Report for CIVL Project, Revision ${revision}" />
215 </report>
216 </junitreport>
217 <fail message="Tests failed. Check log and/or reports." if="test.failed" />
218 </target>
219
220 <!-- Cobertura Tasks -->
221
222 <target name="cobertura-init" depends="test-compile">
223 <delete dir="${cobertura.dir}" quiet="true" />
224 <delete file="${cob.ser.file}" quiet="true" />
225 <delete file="${cob.log.file}" quiet="true" />
226 <mkdir dir="${cobertura.dir}" />
227 <mkdir dir="${cob.instrumented.dir}" />
228 <mkdir dir="${cob.reports.xml.dir}" />
229 <mkdir dir="${cob.reports.html.dir}" />
230 <mkdir dir="${cob.coverage.xml.dir}" />
231 <mkdir dir="${cob.coverage.html.dir}" />
232 </target>
233
234 <target name="cobertura-instrument" depends="cobertura-init">
235 <cobertura-instrument todir="${cob.instrumented.dir}">
236 <ignore regex="org.apache.log4j.*" />
237 <fileset dir="${bin.dir}">
238 <include name="**/*.class" />
239 </fileset>
240 </cobertura-instrument>
241 </target>
242
243 <path id="instrumented.classpath">
244 <pathelement location="${cob.instrumented.dir}" />
245 <pathelement location="${test.bin.dir}" />
246 <pathelement location="${antlr.jar}" />
247 <pathelement location="${junit.jar}" />
248 <pathelement location="${bin.dir}" />
249 </path>
250
251 <target name="cobertura-test" depends="cobertura-instrument">
252 <junit fork="yes" dir="${basedir}" failureProperty="test.failed">
253 <jvmarg value="-ea" />
254 <classpath refid="instrumented.classpath" />
255 <classpath refid="cobertura.classpath" />
256 <formatter type="xml" />
257 <batchtest todir="${cob.reports.xml.dir}">
258 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
259 </batchtest>
260 </junit>
261 <junitreport todir="${cob.reports.xml.dir}">
262 <fileset dir="${cob.reports.xml.dir}">
263 <include name="TEST-*.xml" />
264 </fileset>
265 <report format="frames" todir="${cob.reports.html.dir}">
266 <param name="TITLE" expression="JUnit Report for CIVL Project, Revision ${revision}" />
267 </report>
268 </junitreport>
269 </target>
270
271 <target name="cobertura-html-coverage-report" depends="cobertura-test">
272 <cobertura-report destdir="${cob.coverage.html.dir}">
273 <fileset dir="${src.dir}">
274 <include name="**/*.java" />
275 </fileset>
276 </cobertura-report>
277 </target>
278
279 <target name="cobertura" depends="cobertura-html-coverage-report" />
280
281 <!-- Javadoc Tasks -->
282
283 <path id="javadoc.classpath">
284 <pathelement location="${src.dir}" />
285 <pathelement location="${junit.jar}" />
286 <pathelement location="${antlr.jar}" />
287 </path>
288
289 <target name="javadoc">
290 <delete dir="${javadoc.dir}" quiet="true" />
291 <mkdir dir="${javadoc.dir}" />
292 <javadoc destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="CIVL Project API, Revision ${revision}" access="public" classpathref="javadoc.classpath" failonerror="false">
293 <fileset dir="${src.dir}" defaultexcludes="yes">
294 <include name="**/*.java" />
295 </fileset>
296 </javadoc>
297 </target>
298
299 <!-- Clean -->
300
301 <target name="clean" description="Delete all generated files.">
302 <delete dir="${bin.dir}" />
303 <delete dir="${test.bin.dir}" />
304 <delete dir="${junit.dir}" />
305 <delete dir="${javadoc.dir}" />
306 <delete file="${jar-path}" />
307 <delete dir="${cobertura.dir}" />
308 <delete file="${cob.ser.file}" />
309 <delete file="${cob.log.file}" />
310 <delete file="${manifest-file}" />
311 <delete file="${grammar.dir}/CivlCParser.tokens" />
312 <delete file="${real.src.dir}/parse/common/CivlCParser.java" />
313 <delete file="${grammar.dir}/PreprocessorLexer.tokens" />
314 <delete file="${real.src.dir}/preproc/common/PreprocessorLexer.java" />
315 <delete file="${grammar.dir}/PreprocessorParser.tokens" />
316 <delete file="${real.src.dir}/preproc/common/PreprocessorParser.java" />
317 <delete file="${grammar.dir}/PreprocessorExpressionParser.tokens" />
318 <delete file="${real.src.dir}/preproc/common/PreprocessorExpressionParser.java" />
319 </target>
320
321 <!-- Do everything -->
322
323 <target name="all" depends="jar,test,cobertura,javadoc" />
324
325</project>
Note: See TracBrowser for help on using the repository browser.