-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
312 lines (255 loc) · 12.6 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="jevio" default="compile" basedir=".">
<!-- environmental variables -->
<property environment="env"/>
<!-- Version -->
<property name="evio.version" value="6.0" />
<!-- Debug -->
<property name="javac.debug" value="on" />
<!-- Directories/Files -->
<property name="src.dir" value="java/org/jlab/coda" />
<property name="build.dir" value="jbuild" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.lib" value="${build.dir}/lib" />
<property name="doc.dir" value="doc/javadoc" />
<property name="local.jars" value="java/jars" />
<property name="jarName" value="jevio-${evio.version}.jar" />
<property name="allJarNames" value="jevio-*.jar" />
<property name="jarPath" value="${build.lib}/${jarName}" />
<property name="lz4JarName" value="lz4-java.1.8.0.jar" />
<property name="lz4JarPath" value="${local.jars}/${lz4JarName}" />
<property name="compJarName" value="AHACompressionAPI.jar" />
<property name="compJarPath" value="${local.jars}/${compJarName}" />
<property name="disruptorJarName8" value="disruptor-3.4.3.jar" />
<property name="disruptorJarName15" value="disruptor-4.0.0.jar" />
<property name="disruptorJarPath8" value="${local.jars}/${disruptorJarName8}" />
<property name="disruptorJarPath15" value="${local.jars}/${disruptorJarName15}" />
<!-- Set Classpath, ignore caller's classpath -->
<property name="build.sysclasspath" value="ignore" />
<!-- By default use local jars in classpath -->
<path id="classpath">
<fileset dir="${local.jars}" >
<include name="*.jar" />
</fileset>
</path>
<!-- Targets -->
<!-- Help -->
<target name="help">
<echo message="Usage: ant [ant options] <target1> [target2 | target3 | ...]" />
<echo message="" />
<echo message=" targets:" />
<echo message=" help - print out usage" />
<echo message=" env - print out build file variables' values" />
<echo message=" compile - compile java files" />
<echo message=" clean - remove class files" />
<echo message=" cleanall - remove all generated files" />
<echo message=" jar - compile and create jar file" />
<echo message=" install - create jar file and install into 'prefix'" />
<echo message=" if given on command line by -Dprefix=dir'," />
<echo message=" else install into CODA if defined" />
<echo message=" uninstall - remove jar file previously installed into 'prefix'" />
<echo message=" if given on command line by -Dprefix=dir'," />
<echo message=" else installed into CODA if defined" />
<echo message=" all - clean, compile and create jar file" />
<echo message=" javadoc - create javadoc documentation" />
<echo message=" developdoc - create javadoc documentation for developer" />
<echo message=" undoc - remove all javadoc documentation" />
<echo message=" prepare - create necessary directories" />
</target>
<!-- Environment -->
<target name="env">
<echo message="Ant environment:" />
<echo message="" />
<echo message=" src.dir = ${src.dir}" />
<echo message=" build.dir = ${build.dir}" />
<echo message=" build.lib = ${build.lib}" />
<echo message=" build.classes = ${build.classes}" />
<echo message=" doc.dir = ${doc.dir}" />
<echo message=" javac.debug = ${javac.debug}" />
<echo message=" classpath = ${env.CLASSPATH}" />
</target>
<!-- ************************************************************* -->
<target name="installCheck" >
<!-- Test to see if -Dprefix=<dir> used on command line -->
<condition property="prefixDefined">
<isset property="prefix"/>
</condition>
<!-- Test to see if CODA environmental variable defined -->
<condition property="codaDefined">
<isset property="env.CODA"/>
</condition>
<!-- Test to see if no installation directory defined -->
<condition property="noInstallDir">
<and>
<not>
<isset property="prefix"/>
</not>
<not>
<isset property="env.CODA"/>
</not>
</and>
</condition>
</target>
<!-- ************************************************************* -->
<!-- if $CODA is set, use that for classpath -->
<target name="CODA_cp" depends="installCheck" if="codaDefined">
<path id="classpath">
<fileset dir="${env.CODA}/common/jar" >
<include name="*.jar" />
</fileset>
<fileset dir="${local.jars}" >
<include name="*.jar" />
</fileset>
</path>
<echo message="Compile with jars in $CODA/common/jar first, then ${local.jars}" />
</target>
<!-- ************************************************************* -->
<!-- Prepare things by creating directories -->
<target name="prepare" depends="installCheck" >
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.lib}" />
<antcall target="preparePrefixDir"/>
<antcall target="prepareCodaDir"/>
</target>
<target name="preparePrefixDir" if="prefixDefined">
<mkdir dir="${prefix}/jar" />
</target>
<target name="prepareCodaDir" if="codaDefined">
<mkdir dir="${env.CODA}/common/jar" />
</target>
<!-- Clean by removing class files -->
<target name="clean" description="Remove all class files">
<delete failonerror="no" >
<fileset dir="${build.classes}" includes="**/*.class" />
</delete>
</target>
<!-- Clean by removing build & doc directories -->
<target name="cleanall" depends="clean" description="Remove all generated files.">
<delete dir="${build.dir}" failonerror="no" />
<delete dir="${doc.dir}" failonerror="no" />
</target>
<!-- Compile all source -->
<target name="compile" depends="CODA_cp,prepare" description="Compiles all source code.">
<javac destdir="${build.classes}" debug="${javac.debug}" optimize="yes" >
<classpath refid="classpath" />
<src path="${src.dir}" />
</javac>
</target>
<!-- Javadoc, turn off html related warnings/errors -->
<target name="javadoc" description="Create javadoc.">
<mkdir dir="${doc.dir}" />
<javadoc packagenames="org.jlab.coda.*"
excludepackagenames="org.jlab.coda.jevio.test"
sourcepath="java"
access="public"
destdir="${doc.dir}"
use="true"
additionalparam="-Xdoclint:all,-html">
<classpath refid="classpath" />
</javadoc>
</target>
<!-- Javadoc for developer, turn off html related warnings/errors -->
<target name="developdoc" description="Create javadoc for developer.">
<mkdir dir="${doc.dir}" />
<javadoc packagenames="org.jlab.coda.*"
excludepackagenames="org.jlab.coda.jevio.test"
sourcepath="java"
access="package"
destdir="${doc.dir}"
use="true"
additionalparam="-Xdoclint:all,-html">
<classpath refid="classpath" />
</javadoc>
</target>
<!-- Removing Javadoc -->
<target name="undoc" description="remove all javadoc.">
<delete dir="${doc.dir}" />
</target>
<!-- Create Jar file -->
<target name="jar" depends="compile" description="Generates jar file.">
<jar jarfile="${jarPath}" manifest="${src.dir}/jevio/manifest.mf">
<fileset dir="${build.classes}" excludes="*.class" />
</jar>
</target>
<!-- Clean, compile, and create jar -->
<target name="all" depends="clean,jar" description="Cleans, compile, then builds jar file." />
<!-- Install Jar file -->
<target name="install" depends="jar,installCheck" description="Installs jar file.">
<antcall target="error"/>
<antcall target="installInPrefix"/>
<antcall target="installInCODA"/>
</target>
<!-- Install in prefix -->
<target name="installInPrefix" if="prefixDefined">
<echo>Install ${jarName} into ${prefix}</echo>
<echo>Install ${lz4JarName} into ${prefix}</echo>
<echo>Install ${compJarName} into ${prefix}</echo>
<echo>Install ${disruptorJarName8} into ${prefix}</echo>
<echo>Install ${disruptorJarName15} into ${prefix}</echo>
<delete>
<fileset dir="${prefix}/jar" includes="${allJarNames}" />
</delete>
<copy file="${jarPath}" todir="${prefix}/jar"/>
<copy file="${lz4JarPath}" todir="${prefix}/jar"/>
<copy file="${compJarPath}" todir="${prefix}/jar"/>
<copy file="${disruptorJarPath8}" todir="${prefix}/jar" failonerror="false" />
<copy file="${disruptorJarPath15}" todir="${prefix}/jar" failonerror="false" />
</target>
<!-- Install in $CODA -->
<target name="installInCODA" unless="prefixDefined" if="codaDefined">
<echo>Install ${jarName} into ${env.CODA}/common/jar</echo>
<echo>Install ${lz4JarName} into ${env.CODA}/common/jar</echo>
<echo>Install ${compJarName} into ${env.CODA}/common/jar</echo>
<echo>Install ${disruptorJarName8} into ${env.CODA}/common/jar</echo>
<echo>Install ${disruptorJarName15} into ${env.CODA}/common/jar</echo>
<delete>
<fileset dir="${env.CODA}/common/jar" includes="${allJarNames}" />
</delete>
<copy file="${jarPath}" todir="${env.CODA}/common/jar"/>
<copy file="${lz4JarPath}" todir="${env.CODA}/common/jar"/>
<copy file="${compJarPath}" todir="${env.CODA}/common/jar"/>
<copy file="${disruptorJarPath8}" todir="${env.CODA}/common/jar" failonerror="false" />
<copy file="${disruptorJarPath15}" todir="${env.CODA}/common/jar" failonerror="false" />
</target>
<!-- No installation directory defined -->
<target name="error" if="noInstallDir">
<fail message="CODA env var not defined and -Dprefix not used, jar NOT installed" />
</target>
<!-- Uninstall Jar file -->
<target name="uninstall" depends="installCheck" description="Uninstalls jar file.">
<antcall target="error2"/>
<antcall target="uninstallFromPrefix"/>
<antcall target="uninstallFromCODA"/>
</target>
<!-- Uninstall from prefix -->
<target name="uninstallFromPrefix" if="prefixDefined">
<echo>Remove ${jarName} from ${prefix}</echo>
<echo>Remove ${lz4JarName} from ${prefix}</echo>
<echo>Remove ${compJarName} from ${prefix}</echo>
<echo>Remove ${disruptorJarName8} from ${prefix}</echo>
<echo>Remove ${disruptorJarName15} from ${prefix}</echo>
<delete file="${prefix}/jar/${jarName}"/>
<delete file="${prefix}/jar/${lz4JarName}"/>
<delete file="${prefix}/jar/${compJarName}"/>
<delete file="${prefix}/jar/${disruptorJarName8}" failonerror="false" />
<delete file="${prefix}/jar/${disruptorJarName15}" failonerror="false" />
</target>
<!-- Uninstall from $CODA -->
<target name="uninstallFromCODA" unless="prefixDefined" if="codaDefined">
<echo>Remove ${jarName} from ${env.CODA}/common/jar</echo>
<echo>Remove ${lz4JarName} from ${env.CODA}/common/jar</echo>
<echo>Remove ${compJarName} from ${env.CODA}/common/jar</echo>
<echo>Remove ${disruptorJarName8} from ${env.CODA}/common/jar</echo>
<echo>Remove ${disruptorJarName15} from ${env.CODA}/common/jar</echo>
<delete file="${env.CODA}/common/jar/${jarName}"/>
<delete file="${env.CODA}/common/jar/${lz4JarName}"/>
<delete file="${env.CODA}/common/jar/${compJarName}"/>
<delete file="${env.CODA}/common/jar/${disruptorJarName8}" failonerror="false" />
<delete file="${env.CODA}/common/jar/${disruptorJarName15}" failonerror="false" />
</target>
<!-- No installation directory defined to uninstall from -->
<target name="error2" if="noInstallDir">
<fail message="Installation directory not defined, jar NOT installed" />
</target>
</project>