forked from harvard-lts/fits
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
358 lines (274 loc) · 11.4 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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!-- ====================================================================== -->
<!-- Slightly modified version of OIS Standard Build file. -->
<!-- Removed .java files from JAR -->
<!-- ====================================================================== -->
<project name="FITS Build File" default="compile" basedir=".">
<!-- ===================== Property Definitions =========================== -->
<property file="project.properties" />
<!-- ==================== File and Directory Names ======================== -->
<property name="app.name" value="fits" />
<property name="app.longName" value="File Information Toolset" />
<property name="app.package" value="edu.harvard.hul.ois.fits" />
<property name="jar.name" value="${app.name}.jar" />
<property name="jar.home" value="lib" />
<property name="compile.dirs" value="src" />
<property name="javadoc.home" value="javadoc" />
<property name="manifest.name" value="MANIFEST.MF" />
<property name="output.location" value="release_temp" />
<!-- ===================== Compilation Control Options ==================== -->
<!--
These properties control option settings on the Javac compiler when it
is invoked using the <javac> task.
compile.debug Should compilation include the debug option?
compile.deprecation Should compilation include the deprecation option?
compile.optimize Should compilation include the optimize option?
-->
<property name="compile.debug" value="true" />
<property name="compile.deprecation" value="true" />
<property name="compile.optimize" value="true" />
<!-- ==================== Compilation Classpath =========================== -->
<!--
Rather than relying on the CLASSPATH environment variable, Ant includes
features that makes it easy to dynamically construct the classpath you
need for each compilation. The example below constructs the compile
classpath to include the servlet.jar file, as well as the other components
that Tomcat makes available to web applications automatically, plus anything
that you explicitly added.
-->
<path id="compile.classpath">
<!-- Include all JAR files that will be included in lib -->
<fileset dir=".">
<include name="lib/*.jar" />
<include name="lib/droid/*.jar" />
<include name="lib/jhove/*.jar" />
<include name="lib/mediainfo/*.jar" />
<include name="lib/nzmetool/*.jar" />
</fileset>
</path>
<!-- ==================== Compile Target ================================== -->
<!--
The "compile" target transforms source files (from your "src" directory)
into object files in the appropriate location in the build directory.
-->
<target name="compile" description="Compile Java sources">
<javac srcdir="${compile.dirs}" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
<classpath refid="compile.classpath">
</classpath>
</javac>
<antcall target="create-tmp-jar" />
<antcall target="compile-copy-lib" />
<antcall target="delete-tmp-jar" />
</target>
<target name="compile-copy-lib" if="lib.present" depends="check-lib">
<copy file="${app.name}.jar" todir="lib" />
</target>
<!-- ==================== Clean Target ==================================== -->
<!--
The "clean" target deletes any previous "build" and "dist" directory,
so that you can be ensured the application can be built from scratch.
-->
<target name="clean" description="Delete old build and dist directories">
<delete quiet="true">
<fileset dir="src" includes="**/*.class" />
</delete>
</target>
<!-- ===================== Create Tmp Jar Target ========================== -->
<target name="create-tmp-jar" description="Create the jar for this project">
<antcall target="create-manifest" />
<antcall target="create-tmp-jar-src" />
<antcall target="delete-manifest" />
</target>
<target name="create-tmp-jar-src" if="src.present" depends="check-src">
<jar jarfile="${app.name}.jar" update="true" manifest="${manifest.name}">
<fileset dir="src">
<include name="**/*.class" />
<include name="**/*.properties" />
<include name="**/*.xml" />
</fileset>
</jar>
</target>
<target name="create-manifest" description="Create the manifest for the jar file">
<condition property="jar.version" value="${build.version.major}.${build.version.minor}.${build.version.micro}">
<and>
<isset property="build.version.major" />
<isset property="build.version.minor" />
<isset property="build.version.micro" />
</and>
</condition>
<tstamp>
<format property="timestamp.isoformat" pattern="yyyy-MM-dd'T'HH:mm:ss" />
</tstamp>
<condition property="build.timestamp" value="development" else="${timestamp.isoformat}">
<not>
<isset property="jar.version" />
</not>
</condition>
<condition property="build.date" value="development" else="${TODAY}">
<not>
<isset property="jar.version" />
</not>
</condition>
<condition property="jar.version" value="development">
<not>
<isset property="jar.version" />
</not>
</condition>
<manifest file="${manifest.name}">
<attribute name="Application-Name" value="${app.longName}" />
<attribute name="Specification-Title" value="${app.name} Java Classes" />
<attribute name="Specification-Version" value="${jar.version}" />
<attribute name="Implementation-Title" value="${app.package}" />
<attribute name="Implementation-Version" value="${jar.version}" />
<attribute name="Implementation-Vendor" value="OIS Harvard University Library" />
<attribute name="Build-Date" value="${build.date}" />
<attribute name="Build-Timestamp" value="${build.timestamp}" />
</manifest>
</target>
<target name="delete-manifest" description="Deletes the tmp manifest file">
<delete quiet="true" file="${manifest.name}" />
</target>
<target name="delete-tmp-jar" description="Delete the tmp jar for this project">
<delete file="${app.name}.jar" quiet="true" />
</target>
<!-- ==================== Javadoc Target ================================== -->
<!--
The "javadoc" target creates Javadoc API documentation for the Java
classes included in your application. Normally, this is only required
when preparing a distribution release, but is available as a separate
target in case the developer wants to create Javadocs independently.
-->
<target name="javadoc" description="Create Javadoc API documentation">
<mkdir dir="${javadoc.home}" />
<javadoc destdir="${javadoc.home}" packagenames="*">
<fileset dir=".">
<include name="src/**/*.java" />
</fileset>
<classpath refid="compile.classpath" />
</javadoc>
</target>
<!-- ==================== Check and Set Targets =========================== -->
<target name="check-conf">
<available file="conf" type="dir" property="conf.present" />
</target>
<target name="check-lib">
<available file="lib" type="dir" property="lib.present" />
</target>
<target name="check-src">
<available file="src" type="dir" property="src.present" />
</target>
<!-- ========================= Release Targets ============================ -->
<target name="release">
<property name="output.location.version" value="${output.location}/${app.name}-${build.version.major}.${build.version.minor}.${build.version.micro}" />
<mkdir dir="${output.location}" />
<copy todir="${output.location.version}/xml">
<fileset dir="xml">
<exclude name="**/CVS" />
<exclude name="**/.cvsignore" />
</fileset>
</copy>
<copy todir="${output.location.version}/tools">
<fileset dir="tools">
<exclude name="**/CVS" />
<exclude name="**/.cvsignore" />
</fileset>
</copy>
<copy todir="${output.location.version}/lib">
<fileset dir="lib">
<exclude name="**/CVS" />
<exclude name="**/.cvsignore" />
</fileset>
</copy>
<copy todir="${output.location.version}/src">
<fileset dir="src">
<exclude name="**/CVS" />
<exclude name="**/.cvsignore" />
<exclude name="**/*.class" />
</fileset>
</copy>
<copy file="cpappend.bat" todir="${output.location.version}" />
<copy file="fits.bat" todir="${output.location.version}" />
<copy file="fits.sh" todir="${output.location.version}" />
<copy file="fits-env.sh" todir="${output.location.version}" />
<copy file="fits-ngserver.sh" todir="${output.location.version}" />
<copy file="RELEASE.txt" todir="${output.location.version}" />
<copy file="COPYING" todir="${output.location.version}" />
<copy file="COPYING.LESSER" todir="${output.location.version}" />
<copy file="COPYING_APACHE_LICENSE_v2.txt" todir="${output.location.version}" />
<copy file="build.xml" todir="${output.location.version}" />
<copy file="project.properties" todir="${output.location.version}" />
<antcall target="zip-output" />
<antcall target="delete-output" />
</target>
<target name="zip-output">
<input message="Enter output location for zip file:" addproperty="zip.output" />
<zip basedir="${output.location}" destfile="${zip.output}/${app.name}-${build.version.major}.${build.version.minor}.${build.version.micro}.zip" />
</target>
<target name="delete-output">
<delete dir="${output.location}" quiet="true" />
</target>
<!-- ===================== Create Jar Target ========================== -->
<target name="jar">
<jar destfile="fits-complete-i.jar" basedir="./lib" filesetmanifest="skip">
<zipgroupfileset dir="lib" includes="**/*.jar" />
<manifest>
<attribute name="Class-Path" value="${mf.classpath}" />
</manifest>
</jar>
</target>
<path id="build.classpath">
<fileset dir="./">
<include name="lib/**/*.jar" />
<exclude name="**/*.DSA" />
<exclude name="**/*.SF" />
</fileset>
</path>
<pathconvert property="mf.classpath" pathsep=" ">
<path refid="build.classpath" />
<mapper>
<chainedmapper>
<flattenmapper />
<globmapper from="*.jar" to="lib/**/*.jar" />
</chainedmapper>
</mapper>
</pathconvert>
<!-- ===================== Create Jar Target ========================== -->
<target name="jar2" depends="compile" description="Create one big jarfile.">
<jar jarfile="fits-complete-ii.jar" basedir="./src">
<zipgroupfileset dir="lib" excludes="**/*.SF,**/*.DSA">
<include name="**/*.jar" />
</zipgroupfileset>
<manifest>
<attribute name="Main-Class" value="hul.harvard.edu.ois.fits.Fits" />
</manifest>
</jar>
</target>
<!-- ===================== Create Jar Target ========================== -->
<target name="jar3">
<jar destfile="fits-complete-iii.jar">
<zipgroupfileset dir="lib" includes="**/*.jar" />
</jar>
</target>
<!-- ===================== Create Jar Target ========================== -->
<target name="jar4">
<jar destfile="fits-complete-iv.jar">
<zipgroupfileset dir="fits-all-classes">
<include name="**/*.class" />
</zipgroupfileset>
</jar>
</target>
<!-- ===================== Create Jar Target ========================== -->
<target name="jar5" depends="compile" description="Create one big jarfile.">
<jar jarfile="fits-complete-v.jar">
<zipgroupfileset dir="fits-all-classes">
<include name="**/*.class" />
</zipgroupfileset>
<manifest>
<attribute name="Main-Class" value="hul.harvard.edu.ois.fits.Fits" />
</manifest>
</jar>
</target>
<!-- ===================== Create Jar Target ========================== -->
<target name="jar6" depends="compile">
<jar destfile="./fits-complete-vi.jar.jar" basedir="./fits-all-classes/" includes="**/*.class" />
</target>
</project>