source: CIVL/build.xml@ c1c00b6

1.23 2.0 main test-branch
Last change on this file since c1c00b6 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
RevLine 
[173ff32]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
[12af7b8]13<project name="CIVL" basedir="." default="jar" xmlns:jacoco="antlib:org.jacoco.ant">
[173ff32]14
15 <!-- Directories -->
16
[d005d94]17 <condition property="properties.file" value="build.properties" else="build_default.properties">
18 <available file="build.properties" />
19 </condition>
20 <property file="${properties.file}" />
[eb6952c]21 <property file="build.properties" />
[173ff32]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}" />
[dad210da]27 <property name="main-class" value="edu.udel.cis.vsl.civl.CIVL" />
[173ff32]28
[12af7b8]29 <!-- Junit and JaCoCo Coverage -->
[173ff32]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" />
[12af7b8]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>
[173ff32]40
41
42 <!-- Source compilation and JAR construction -->
43
44 <path id="src.compile.classpath">
45 <pathelement location="${src.dir}" />
[290908a]46 <pathelement location="${sarl.jar}" />
47 <pathelement location="${gmc.jar}" />
48 <pathelement location="${abc.jar}" />
[173ff32]49 </path>
50
[3c84707]51 <target name="compile" description="Compile all java source files.">
[173ff32]52 <mkdir dir="${bin.dir}" />
[e31fe2c]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">
[173ff32]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}" />
[290908a]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}" />
[af8a6cb]64 <fileset dir="${basedir}/lib" />
[173ff32]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}" />
[d75e0d7]78 <pathelement location="${hamcrest.jar}" />
[290908a]79 <pathelement location="${sarl.jar}" />
80 <pathelement location="${gmc.jar}" />
81 <pathelement location="${abc.jar}" />
[173ff32]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}" />
[d75e0d7]88 <pathelement location="${hamcrest.jar}" />
[290908a]89 <pathelement location="${sarl.jar}" />
90 <pathelement location="${gmc.jar}" />
91 <pathelement location="${abc.jar}" />
[173ff32]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">
[e31fe2c]104 <javac destdir="${test.bin.dir}" debug="true" failonerror="false" classpathref="test.compile.classpath" encoding="UTF-8" includeantruntime="true">
[173ff32]105 <src path="${test.src.dir}" />
106 </javac>
107 </target>
108
[12af7b8]109 <target name="test-run" depends="test-compile">
110 <jacoco:coverage>
[9ac0d73]111 <junit fork="true" forkmode="once" timeout="300000">
[12af7b8]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>
[173ff32]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}">
[12af7b8]126 <param name="TITLE" expression="JUnit Report for CIVL ${revision}" />
[173ff32]127 </report>
128 </junitreport>
129 </target>
130
[12af7b8]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>
[173ff32]146 </target>
147
148
149 <!-- Javadoc Tasks -->
150
151 <target name="javadoc">
152 <delete dir="${javadoc.dir}" quiet="true" />
153 <mkdir dir="${javadoc.dir}" />
[12af7b8]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">
[173ff32]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}" />
[12af7b8]165 <delete dir="${coverage.dir}" />
[173ff32]166 <delete file="${jar-path}" />
[12af7b8]167 <delete file="${basedir}/jacoco.exec" />
[173ff32]168 <delete file="${manifest-file}" />
169 </target>
170
171 <!-- Do everything -->
172
[12af7b8]173 <target name="all" depends="jar,test,javadoc" />
[173ff32]174
175</project>
Note: See TracBrowser for help on using the repository browser.