-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
170 lines (147 loc) · 5.76 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<project name="osmosis-simplifyways" default="jar" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- what version of ivy do we want? -->
<property name="ivy.install.version" value="2.2.0" />
<property name="ivy.jar.dir" value="${basedir}/ivy" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />
<!-- some variables used -->
<property name="lib.dir" value="lib" />
<property name="dist.dir" value="dist" />
<property name="build.dir" value="build" />
<property name="src.dir" value="src/main" />
<property name="test.src.dir" value="src/test" />
<property name="report.dir" value="report" />
<!-- paths used for compilation and run -->
<path id="compile.path.id">
<fileset dir="${lib.dir}/compile" />
</path>
<path id="compile.test.path.id">
<fileset dir="${lib.dir}/test" />
<path location="${build.dir}/main" />
</path>
<path id="run.test.path.id">
<path refid="compile.test.path.id" />
<path location="${build.dir}/test" />
</path>
<path id="run.path.id">
<path refid="compile.path.id" />
</path>
<target name="_get-version" unless="${project.version}">
<condition property="git.command" value="git.cmd">
<os family="windows" />
</condition>
<condition property="git.command" value="git">
<not><os family="windows" /></not>
</condition>
<exec executable="${git.command}" dir="${basedir}" outputproperty="git.revision"
failonerror="false" failifexecutionfails="false" resultproperty="git.returncode"
>
<arg value="describe"/>
<arg value="--always"/>
</exec>
<tstamp />
<condition property="project.version"
value="${git.revision}"
else="SNAPSHOT-${DSTAMP}">
<not><isfailure code="${git.returncode}" /></not>
</condition>
</target>
<target name="init-ivy" unless="ivy.initialized">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar" />
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" />
<!-- Override the shared repo location to point at the svn-based ivy repo. -->
<ivy:configure file="${ivy.jar.dir}/ivysettings.xml" />
<!-- Retrieve ivy details from the config file. -->
<ivy:info />
<property name="ivy.initialized" value="true"/>
</target>
<!-- =================================
target: resolve
================================= -->
<target name="resolve" depends="init-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact]-[revision].[ext]" />
</target>
<!-- =================================
target: report
================================= -->
<target name="report" depends="resolve" description="--> generates a report of dependencies">
<ivy:report todir="${report.dir}/ivy" />
</target>
<!-- =================================
target: clean
================================= -->
<target name="clean" description="--> clean the project">
<delete dir="${build.dir}" includeemptydirs="true" />
<delete dir="${lib.dir}" includeemptydirs="true" />
<delete dir="${report.dir}" includeemptydirs="true" />
<delete dir="${dist.dir}" includeemptydirs="true" />
</target>
<!-- =================================
target: clean-cache
================================= -->
<target name="clean-cache" depends="init-ivy" description="--> clean the ivy cache">
<ivy:cleancache />
</target>
<target name="compile" depends="resolve" description="--> compile the project">
<mkdir dir="${build.dir}/main" />
<javac destdir="${build.dir}/main" srcdir="${src.dir}">
<classpath refid="compile.path.id" />
</javac>
<copy todir="${build.dir}/main">
<fileset dir="${src.dir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="compile-tests" depends="resolve,compile">
<mkdir dir="${build.dir}/test" />
<javac destdir="${build.dir}/test" srcdir="${test.src.dir}">
<classpath refid="compile.test.path.id" />
</javac>
<copy todir="${build.dir}/test">
<fileset dir="${test.src.dir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="test" depends="compile-tests" description="--> compile and run the unit tests">
<mkdir dir="report/test" />
<junit fork="no" maxmemory="512 m" printsummary="on" haltonerror="off" haltonfailure="off" filtertrace="on" failureproperty="test.failure">
<formatter type="plain" usefile="true"/>
<formatter type="xml" usefile="true"/>
<classpath>
<path refid="run.test.path.id"/>
</classpath>
<batchtest todir="${report.dir}/test">
<fileset dir="${build.dir}/test">
<include name="**/*Test*.class"/>
<exclude name="**/TestUtil.class"/>
<exclude name="**/*TestSuite*.class"/>
<exclude name="**/*$*.class"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="jar" depends="compile,_get-version" description="--> create the jar file">
<jar destfile="${dist.dir}/${ant.project.name}-${project.version}.jar">
<fileset dir="${build.dir}/main">
</fileset>
</jar>
</target>
<target name="dist" depends="jar" description="--> create a distribution">
<copy todir="${dist.dir}">
<fileset dir="${lib.dir}/dist">
<exclude name="xerces*.jar" />
</fileset>
</copy>
<zip destfile="${dist.dir}/${ant.project.name}-${project.version}-bin.zip">
<fileset dir="${dist.dir}">
<include name="${ant.project.name}-${project.version}.jar" />
</fileset>
<fileset dir="${lib.dir}/dist">
<exclude name="xerces*.jar" />
</fileset>
</zip>
</target>
</project>