-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
283 lines (247 loc) · 8.65 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id: build.xml,v 1.11 2006-02-07 11:01:38 ctl Exp $ -->
<project name="3dm" default="3dm" basedir=".">
<description>3DM build file</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="classes"/>
<property name="tmpdir" location="tmp"/>
<property name="build-jar" location="build"/>
<property name="javalib" location="contrib/jar"/>
<!-- Library path -->
<path id="libpath">
<fileset dir="${javalib}">
<include name="*.jar" />
</fileset>
</path>
<target name="init">
<!-- Ensure contrib up-to-date -->
<uptodate srcfile="contrib/contrib.xml"
targetfile="contrib/.binstamp"
property="contrib.uptodate" />
<fail unless="contrib.uptodate">
Contrib is not up-to-date. Run
ant contrib-get
to automatically download latest contrib, or fetch manually and run
ant contrib-ok
</fail>
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${tmpdir}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<javac srcdir="${src}" destdir="${build}"
includes="tdm/**" excludes="tdm/guitool/**" >
<classpath>
<path refid="libpath" />
</classpath>
</javac>
</target>
<target name="compile-lib" depends="init"
description="compile the lib source " >
<javac srcdir="${src}" destdir="${build}"
includes="tdm/lib/**" >
<classpath>
<path refid="libpath" />
</classpath>
</javac>
</target>
<target name="compile-tool" depends="init"
description="compile the tool source " >
<javac srcdir="${src}" destdir="${build}"
includes="tdm/tool/**">
<classpath>
<path refid="libpath" />
<pathelement path="${build}" />
</classpath>
</javac>
</target>
<target name="3dm" depends="compile-lib,compile-tool"
description="generate 3dm" >
</target>
<target name="3dm.jar" depends="3dm"
description="generate 3dm.jar" >
<jar jarfile="${build-jar}/3dm.jar" basedir="${build}">
<include name="tdm/**" />
<exclude name="tdm/test/**" />
</jar>
<jar jarfile="${build-jar}/3dm-lib.jar" basedir="${build}">
<include name="tdm/lib/**" />
</jar>
</target>
<target name="diff" depends="3dm">
<java classname="tdm.tool.TreeDiffMerge" fork="yes">
<classpath>
<path refid="libpath" />
<pathelement path="${build}" />
</classpath>
<arg value="--diff"/>
<arg file="${base}"/>
<arg file="${branch}"/>
<arg file="${diff}"/>
</java>
</target>
<target name="patch" depends="3dm">
<java classname="tdm.tool.TreeDiffMerge" fork="yes">
<classpath>
<path refid="libpath" />
<pathelement path="${build}" />
</classpath>
<arg value="--patch"/>
<arg file="${base}"/>
<arg file="${patch}"/>
<arg file="${patched}"/>
</java>
</target>
<target name="merge" depends="3dm">
<java classname="tdm.tool.TreeDiffMerge" fork="yes">
<classpath>
<path refid="libpath" />
<pathelement path="${build}" />
</classpath>
<arg value="--merge"/>
<arg file="${base}"/>
<arg file="${branch1}"/>
<arg file="${branch2}"/>
<arg file="${merge}"/>
</java>
</target>
<target name="quick-test" depends="3dm">
<java classname="tdm.tool.TreeDiffMerge" fork="yes">
<classpath>
<path refid="libpath" />
<pathelement path="${build}" />
</classpath>
<arg value="--merge"/>
<arg file="mergecases/a13/b.xml"/>
<arg file="mergecases/a13/1.xml"/>
<arg file="mergecases/a13/2.xml"/>
<arg file="mergecases/a13/tmp.xml"/>
</java>
<echo
message="The test is successful if there are no errors, and the diff below is <diff />"
/>
<java classname="tdm.tool.TreeDiffMerge" fork="yes">
<classpath>
<path refid="libpath" />
<pathelement path="${build}" />
</classpath>
<arg value="--diff"/>
<arg file="mergecases/a13/tmp.xml"/>
<arg file="mergecases/a13/m.xml"/>
</java>
<delete file="mergecases/a13/tmp.xml" />
</target>
<target name="release" depends="compile">
<fail unless="3dm.version">
You need to set the 3dm.version ant property</fail>
<echo>Java used to build is version ${java.version}</echo>
<tstamp>
<format property="build.stamp" pattern="yyyy.MM.dd.hh.mm.ss" />
</tstamp>
<manifest file="${build-jar}/MANIFEST.MF">
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="tdm.tool.TreeDiffMerge"/>
<attribute name="Specification-Title" value="3dm" />
<attribute name="Specification-Version" value="${3dm.version}" />
<attribute name="Implementation-Title"
value="3DM XML differencing and merging tool" />
<attribute name="Implementation-Version"
value="${3dm.version}-${build.stamp}" />
</manifest>
<jar jarfile="${build-jar}/3dm-${3dm.version}.jar" basedir="${build}"
manifest="${build-jar}/MANIFEST.MF" >
<include name="tdm/**" />
<exclude name="tdm/test/**" />
<zipfileset excludes="META-INF/*.SF" src="contrib/jar/java-getopt-1.0.12.jar"/>
<zipfileset excludes="META-INF/*.SF" src="contrib/jar/xmlParserAPIs.jar"/>
<zipfileset excludes="META-INF/*.SF" src="contrib/jar/xercesImpl.jar"/>
</jar>
<tar destfile="${build-jar}/3dm-${3dm.version}-src.tar.gz"
basedir="."
compression="gzip"
includes=
"build.xml,COPYING,contrib/*.xml,mergecases/**,src/**,usecases/**"
excludes="*~"
longfile="gnu" />
<echo>Below is output from release jar using no args</echo>
<java classname="tdm.tool.TreeDiffMerge" fork="yes">
<classpath>
<path refid="libpath" />
<pathelement path="${build-jar}/3dm-${3dm.version}.jar" />
</classpath>
</java>
</target>
<target name="clean">
<delete dir="${build}" />
<delete dir="${tmpdir}" />
</target>
<target name="contrib-get" >
<ant antfile="contrib.xml" dir="contrib" target="binaries" />
<antcall target="clean" />
<antcall target="contrib-ok" />
</target>
<target name="contrib-get-src" >
<ant antfile="contrib.xml" dir="contrib" target="source" />
</target>
<target name="contrib-ok" >
<touch file="contrib/.binstamp" />
</target>
<target name="test-usecase-review-unzipper">
<unzip src="${oodoc}.sxw" dest="${tmpdir}" />
<copy file="${tmpdir}/Content.xml" tofile="${oodoc}.xml" />
<delete includeemptydirs="true">
<fileset dir="${tmpdir}" includes="**/*" excludes="${tmpdir}"/>
</delete>
</target>
<target name="test-unzipper" unless="review.unzipped">
<antcall target="test-usecase-review-unzipper">
<param name="oodoc" value="usecases/review/base" />
</antcall>
<antcall target="test-usecase-review-unzipper">
<param name="oodoc" value="usecases/review/branch1" />
</antcall>
<antcall target="test-usecase-review-unzipper">
<param name="oodoc" value="usecases/review/branch2" />
</antcall>
<antcall target="test-usecase-review-unzipper">
<param name="oodoc" value="usecases/review/branch3" />
</antcall>
<antcall target="test-usecase-review-unzipper">
<param name="oodoc" value="usecases/review/mergeb12" />
</antcall>
<antcall target="test-usecase-review-unzipper">
<param name="oodoc" value="usecases/review/mergeb123" />
</antcall>
</target>
<target name="test" depends="compile">
<!-- This test below is not 100% correct, but what the hey -->
<available file="usecases/review/base.xml"
property="review.unzipped" />
<antcall target="test-unzipper" />
<echo message="Running tests, takes a while. (Sample point: 8 min on Athlon 1.3Ghz) "/>
<echo message="Test run results saved in file test.log"/>
<condition property="testclass" value="tdm.test.RootSuite" >
<not><isset property="testclass" /></not>
</condition>
<java classname="junit.textui.TestRunner"
output="test.log"
logError="true"
failonerror="true"
fork="true">
<!--jvmarg value="-verbose:class"/-->
<jvmarg value="-enableassertions"/>
<arg value="${testclass}"/>
<classpath>
<path refid="libpath" />
<pathelement path="${build}" />
</classpath>
<syspropertyset>
<propertyref prefix="tdm.test" />
</syspropertyset>
</java>
</target>
</project>