source: CIVL/build.xml@ cffd3a6

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

Fixed jar construction to include all dependencies.

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

  • Property mode set to 100644
File size: 9.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="javadoc.dir" value="${basedir}/doc/javadoc" />
22 <property name="jar-name" value="civl.jar" />
23 <property name="jar-path" value="${basedir}/${jar-name}" />
24 <!--
25 <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
26 -->
27 <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
28
29 <!-- Junit: automated unit tester Properties -->
30
31 <property name="test.src.dir" location="${basedir}/test" />
32 <property name="test.bin.dir" location="${basedir}/bin-test" />
33 <property name="junit.dir" location="${basedir}/junit" />
34 <property name="junit.data.dir" location="${junit.dir}/data" />
35 <property name="junit.reports.dir" location="${junit.dir}/reports" />
36
37 <!-- Cobertura: test coverage analyzer Properties -->
38
39 <property name="cob.log.file" value="${basedir}/cobertura.log" />
40 <property name="cob.ser.file" value="${basedir}/cobertura.ser" />
41 <property name="cobertura.dir" value="${basedir}/cobertura" />
42 <property name="cob.instrumented.dir" value="${cobertura.dir}/instrumented" />
43 <property name="cob.reports.dir" value="${cobertura.dir}/reports" />
44 <property name="cob.reports.xml.dir" value="${cob.reports.dir}/junit-xml" />
45 <property name="cob.reports.html.dir" value="${cob.reports.dir}/junit-html" />
46 <property name="cob.coverage.xml.dir" value="${cob.reports.dir}/cobertura-xml" />
47 <property name="cob.coverage.html.dir" value="${cob.reports.dir}/cobertura-html" />
48
49 <!-- Tell Ant about Cobertura tasks -->
50
51 <path id="cobertura.classpath">
52 <fileset dir="${cobertura.lib.dir}">
53 <include name="cobertura.jar" />
54 <include name="lib/**/*.jar" />
55 </fileset>
56 </path>
57
58 <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
59
60
61 <!-- Running ANTLR -->
62
63 <path id="antlr.class.path">
64 <pathelement location="${antlr.jar}" />
65 </path>
66
67
68 <!-- Source compilation and JAR construction -->
69
70 <path id="src.compile.classpath">
71 <pathelement location="${src.dir}" />
72 <pathelement location="${antlr.jar}" />
73 <pathelement location="${sarl.jar}" />
74 <pathelement location="${gmc.jar}" />
75 <pathelement location="${abc.jar}" />
76 <pathelement location="${cvc3.jar}" />
77 <pathelement location="${pcollections.jar}" />
78 <pathelement location="${clj-ds.dir}" />
79 </path>
80
81 <target name="compile" description="Compile all java source files.">
82 <mkdir dir="${bin.dir}" />
83 <javac debug="true" srcdir="${src.dir}" destdir="${bin.dir}" includes="edu/udel/cis/vsl/civl/**" classpathref="src.compile.classpath" encoding="UTF-8" includeantruntime="false">
84 </javac>
85 </target>
86
87 <target name="jar" depends="compile" description="Jar up all class files.">
88 <jar destfile="${jar-path}">
89 <fileset dir="${bin.dir}" />
90 <zipfileset includes="**/*.class" src="${abc.jar}" />
91 <zipfileset includes="**/*.h" src="${abc.jar}" />
92 <zipfileset includes="**/*.class" src="${gmc.jar}" />
93 <zipfileset includes="**/*.class" src="${sarl.jar}" />
94 <fileset dir="${basedir}/lib" />
95 <manifest>
96 <attribute name="Built-By" value="${user.name}" />
97 <attribute name="Main-Class" value="${main-class}" />
98 </manifest>
99 </jar>
100 </target>
101
102 <!-- Plain JUnit tests -->
103
104 <path id="test.compile.classpath">
105 <pathelement location="${test.src.dir}" />
106 <pathelement location="${bin.dir}" />
107 <pathelement location="${antlr.jar}" />
108 <pathelement location="${junit.jar}" />
109 <pathelement location="${sarl.jar}" />
110 <pathelement location="${gmc.jar}" />
111 <pathelement location="${abc.jar}" />
112 <pathelement location="${cvc3.jar}" />
113 <pathelement location="${pcollections.jar}" />
114 <pathelement location="${clj-ds.dir}" />
115 </path>
116
117 <path id="test.execute.classpath">
118 <pathelement location="${test.bin.dir}" />
119 <pathelement location="${bin.dir}" />
120 <pathelement location="${antlr.jar}" />
121 <pathelement location="${junit.jar}" />
122 <pathelement location="${sarl.jar}" />
123 <pathelement location="${gmc.jar}" />
124 <pathelement location="${abc.jar}" />
125 <pathelement location="${cvc3.jar}" />
126 <pathelement location="${pcollections.jar}" />
127 <pathelement location="${clj-ds.dir}" />
128 </path>
129
130 <target name="test-init">
131 <delete dir="${junit.dir}" quiet="true" />
132 <delete dir="${test.bin.dir}" quiet="true" />
133 <mkdir dir="${junit.dir}" />
134 <mkdir dir="${junit.data.dir}" />
135 <mkdir dir="${junit.reports.dir}" />
136 <mkdir dir="${test.bin.dir}" />
137 </target>
138
139 <target name="test-compile" depends="compile,test-init">
140 <javac destdir="${test.bin.dir}" debug="true" failonerror="false" classpathref="test.compile.classpath" encoding="UTF-8" includeantruntime="true">
141 <src path="${test.src.dir}" />
142 </javac>
143 </target>
144
145 <target name="test" depends="test-compile">
146 <junit printsummary="false" errorProperty="test.failed" failureProperty="test.failed" fork="true" timeout="300000">
147 <jvmarg value="-ea" />
148 <sysproperty key="java.library.path" path="${cvc3.jni.dir}" />
149 <classpath refid="test.execute.classpath" />
150 <formatter type="brief" usefile="false" />
151 <formatter type="xml" />
152 <batchtest todir="${junit.data.dir}">
153 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
154 </batchtest>
155 </junit>
156 <junitreport todir="${junit.data.dir}">
157 <fileset dir="${junit.data.dir}">
158 <include name="TEST-*.xml" />
159 </fileset>
160 <report format="frames" todir="${junit.reports.dir}">
161 <param name="TITLE" expression="JUnit Report for CIVL Project, Revision ${revision}" />
162 </report>
163 </junitreport>
164 <fail message="Tests failed. Check log and/or reports." if="test.failed" />
165 </target>
166
167 <!-- Cobertura Tasks -->
168
169 <target name="cobertura-init" depends="test-compile">
170 <delete dir="${cobertura.dir}" quiet="true" />
171 <delete file="${cob.ser.file}" quiet="true" />
172 <delete file="${cob.log.file}" quiet="true" />
173 <mkdir dir="${cobertura.dir}" />
174 <mkdir dir="${cob.instrumented.dir}" />
175 <mkdir dir="${cob.reports.xml.dir}" />
176 <mkdir dir="${cob.reports.html.dir}" />
177 <mkdir dir="${cob.coverage.xml.dir}" />
178 <mkdir dir="${cob.coverage.html.dir}" />
179 </target>
180
181 <target name="cobertura-instrument" depends="cobertura-init">
182 <cobertura-instrument todir="${cob.instrumented.dir}">
183 <ignore regex="org.apache.log4j.*" />
184 <fileset dir="${bin.dir}">
185 <include name="**/*.class" />
186 </fileset>
187 </cobertura-instrument>
188 </target>
189
190 <path id="instrumented.classpath">
191 <pathelement location="${cob.instrumented.dir}" />
192 <pathelement location="${test.bin.dir}" />
193 <pathelement location="${antlr.jar}" />
194 <pathelement location="${junit.jar}" />
195 <pathelement location="${bin.dir}" />
196 </path>
197
198 <target name="cobertura-test" depends="cobertura-instrument">
199 <junit fork="yes" dir="${basedir}" failureProperty="test.failed">
200 <jvmarg value="-ea" />
201 <classpath refid="instrumented.classpath" />
202 <classpath refid="cobertura.classpath" />
203 <formatter type="xml" />
204 <batchtest todir="${cob.reports.xml.dir}">
205 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
206 </batchtest>
207 </junit>
208 <junitreport todir="${cob.reports.xml.dir}">
209 <fileset dir="${cob.reports.xml.dir}">
210 <include name="TEST-*.xml" />
211 </fileset>
212 <report format="frames" todir="${cob.reports.html.dir}">
213 <param name="TITLE" expression="JUnit Report for CIVL Project, Revision ${revision}" />
214 </report>
215 </junitreport>
216 </target>
217
218 <target name="cobertura-html-coverage-report" depends="cobertura-test">
219 <cobertura-report destdir="${cob.coverage.html.dir}">
220 <fileset dir="${src.dir}">
221 <include name="**/*.java" />
222 </fileset>
223 </cobertura-report>
224 </target>
225
226 <target name="cobertura" depends="cobertura-html-coverage-report" />
227
228 <!-- Javadoc Tasks -->
229
230 <path id="javadoc.classpath">
231 <pathelement location="${src.dir}" />
232 <pathelement location="${junit.jar}" />
233 <pathelement location="${antlr.jar}" />
234 </path>
235
236 <target name="javadoc">
237 <delete dir="${javadoc.dir}" quiet="true" />
238 <mkdir dir="${javadoc.dir}" />
239 <javadoc destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="CIVL Project API, Revision ${revision}" access="public" classpathref="javadoc.classpath" failonerror="false">
240 <fileset dir="${src.dir}" defaultexcludes="yes">
241 <include name="**/*.java" />
242 </fileset>
243 </javadoc>
244 </target>
245
246 <!-- Clean -->
247
248 <target name="clean" description="Delete all generated files.">
249 <delete dir="${bin.dir}" />
250 <delete dir="${test.bin.dir}" />
251 <delete dir="${junit.dir}" />
252 <delete dir="${javadoc.dir}" />
253 <delete file="${jar-path}" />
254 <delete dir="${cobertura.dir}" />
255 <delete file="${cob.ser.file}" />
256 <delete file="${cob.log.file}" />
257 <delete file="${manifest-file}" />
258 </target>
259
260 <!-- Do everything -->
261
262 <target name="all" depends="jar,test,cobertura,javadoc" />
263
264</project>
Note: See TracBrowser for help on using the repository browser.