source: CIVL/build.xml@ a054a5b

1.23 2.0 main test-branch
Last change on this file since a054a5b was eb6952c, checked in by Manchun Zheng <zmanchun@…>, 13 years ago

Abandon the usage of build_default.properties because abc, sarl, gmc.jar's have to be specified according to local machines.

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

  • Property mode set to 100644
File size: 5.7 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" xmlns:jacoco="antlib:org.jacoco.ant">
14
15 <!-- Directories -->
16
17 <property file="build.properties" />
18 <property name="src.dir" value="${basedir}/src" />
19 <property name="bin.dir" value="${basedir}/bin" />
20 <property name="javadoc.dir" value="${basedir}/doc/javadoc" />
21 <property name="jar-name" value="civl.jar" />
22 <property name="jar-path" value="${basedir}/${jar-name}" />
23 <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
24
25 <!-- Junit and JaCoCo Coverage -->
26
27 <property name="test.src.dir" location="${basedir}/test" />
28 <property name="test.bin.dir" location="${basedir}/bin-test" />
29 <property name="junit.dir" location="${basedir}/junit" />
30 <property name="junit.data.dir" location="${junit.dir}/data" />
31 <property name="junit.reports.dir" location="${junit.dir}/reports" />
32 <property name="coverage.dir" location="${basedir}/coverage" />
33 <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
34 <classpath path="${jacoco.jar}" />
35 </taskdef>
36
37
38 <!-- Source compilation and JAR construction -->
39
40 <path id="src.compile.classpath">
41 <pathelement location="${src.dir}" />
42 <pathelement location="${sarl.jar}" />
43 <pathelement location="${gmc.jar}" />
44 <pathelement location="${abc.jar}" />
45 </path>
46
47 <target name="compile" description="Compile all java source files.">
48 <mkdir dir="${bin.dir}" />
49 <javac debug="true" srcdir="${src.dir}" destdir="${bin.dir}" includes="edu/udel/cis/vsl/civl/**" classpathref="src.compile.classpath" encoding="UTF-8" includeantruntime="false">
50 </javac>
51 </target>
52
53 <target name="jar" depends="compile" description="Jar up all class files.">
54 <jar destfile="${jar-path}">
55 <fileset dir="${bin.dir}" />
56 <zipfileset includes="**/*.class" src="${abc.jar}" />
57 <zipfileset includes="**/*.h" src="${abc.jar}" />
58 <zipfileset includes="**/*.class" src="${gmc.jar}" />
59 <zipfileset includes="**/*.class" src="${sarl.jar}" />
60 <fileset dir="${basedir}/lib" />
61 <manifest>
62 <attribute name="Built-By" value="${user.name}" />
63 <attribute name="Main-Class" value="${main-class}" />
64 </manifest>
65 </jar>
66 </target>
67
68 <!-- Plain JUnit tests -->
69
70 <path id="test.compile.classpath">
71 <pathelement location="${test.src.dir}" />
72 <pathelement location="${bin.dir}" />
73 <pathelement location="${junit.jar}" />
74 <pathelement location="${hamcrest.jar}" />
75 <pathelement location="${sarl.jar}" />
76 <pathelement location="${gmc.jar}" />
77 <pathelement location="${abc.jar}" />
78 </path>
79
80 <path id="test.execute.classpath">
81 <pathelement location="${test.bin.dir}" />
82 <pathelement location="${bin.dir}" />
83 <pathelement location="${junit.jar}" />
84 <pathelement location="${hamcrest.jar}" />
85 <pathelement location="${sarl.jar}" />
86 <pathelement location="${gmc.jar}" />
87 <pathelement location="${abc.jar}" />
88 </path>
89
90 <target name="test-init">
91 <delete dir="${junit.dir}" quiet="true" />
92 <delete dir="${test.bin.dir}" quiet="true" />
93 <mkdir dir="${junit.dir}" />
94 <mkdir dir="${junit.data.dir}" />
95 <mkdir dir="${junit.reports.dir}" />
96 <mkdir dir="${test.bin.dir}" />
97 </target>
98
99 <target name="test-compile" depends="compile,test-init">
100 <javac destdir="${test.bin.dir}" debug="true" failonerror="false" classpathref="test.compile.classpath" encoding="UTF-8" includeantruntime="true">
101 <src path="${test.src.dir}" />
102 </javac>
103 </target>
104
105 <target name="test-run" depends="test-compile">
106 <jacoco:coverage>
107 <junit fork="true" forkmode="once" timeout="300000">
108 <jvmarg value="-ea" />
109 <classpath refid="test.execute.classpath" />
110 <formatter type="brief" usefile="false" />
111 <formatter type="xml" />
112 <batchtest todir="${junit.data.dir}">
113 <fileset dir="${test.bin.dir}" includes="**/*Test.class" />
114 </batchtest>
115 </junit>
116 </jacoco:coverage>
117 <junitreport todir="${junit.data.dir}">
118 <fileset dir="${junit.data.dir}">
119 <include name="TEST-*.xml" />
120 </fileset>
121 <report format="frames" todir="${junit.reports.dir}">
122 <param name="TITLE" expression="JUnit Report for CIVL ${revision}" />
123 </report>
124 </junitreport>
125 </target>
126
127 <target name="test" depends="test-run">
128 <jacoco:report>
129 <executiondata>
130 <file file="jacoco.exec" />
131 </executiondata>
132 <structure name="Test Coverage Report for CIVL ${revision}">
133 <classfiles>
134 <fileset dir="${bin.dir}" />
135 </classfiles>
136 <sourcefiles encoding="UTF-8">
137 <fileset dir="${src.dir}" />
138 </sourcefiles>
139 </structure>
140 <html destdir="coverage" />
141 </jacoco:report>
142 </target>
143
144
145 <!-- Javadoc Tasks -->
146
147 <target name="javadoc">
148 <delete dir="${javadoc.dir}" quiet="true" />
149 <mkdir dir="${javadoc.dir}" />
150 <javadoc destdir="${javadoc.dir}" Overview="src/overview.html" author="false" version="true" use="true" windowtitle="API for CIVL ${revision}" access="public" classpathref="test.execute.classpath" sourcepath="${src.dir}" failonerror="false">
151 </javadoc>
152 </target>
153
154 <!-- Clean -->
155
156 <target name="clean" description="Delete all generated files.">
157 <delete dir="${bin.dir}" />
158 <delete dir="${test.bin.dir}" />
159 <delete dir="${junit.dir}" />
160 <delete dir="${javadoc.dir}" />
161 <delete dir="${coverage.dir}" />
162 <delete file="${jar-path}" />
163 <delete file="${basedir}/jacoco.exec" />
164 <delete file="${manifest-file}" />
165 </target>
166
167 <!-- Do everything -->
168
169 <target name="all" depends="jar,test,javadoc" />
170
171</project>
Note: See TracBrowser for help on using the repository browser.