source: CIVL/build.xml@ a8ca3d3

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

added build_default.properties; modified build.xml to use build_default.properties if build.properties is missing.

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

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