-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
362 lines (300 loc) · 15.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
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
359
360
361
362
<?xml version="1.0" encoding="UTF-8"?>
<project name="SRO-RTDP" default="compile" basedir=".">
<!-- environmental variables -->
<property environment="env"/>
<!-- Version -->
<property name="rtdp.version" value="0.9" />
<!-- Debug -->
<property name="javac.debug" value="on" />
<!-- Directories/Files -->
<property name="src.dir" value="rtdp/java" />
<property name="build.dir" value="build" />
<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="jarName" value="rtdp-${rtdp.version}.jar" />
<property name="allJarNames" value="rtdp-*.jar" />
<property name="jarPath" value="${build.lib}/${jarName}" />
<property name="local.jars" value="${src.dir}/jars" />
<property name="disJarName" value="disruptor-4.0.0.jar" />
<property name="disJarPath" value="${local.jars}/${disJarName}" />
<property name="cmsgJarName" value="cMsg-6.0.jar" />
<property name="cmsgJarPath" value="${local.jars}/${cmsgJarName}" />
<property name="emuJarName" value="emu-3.3.jar" />
<property name="emuJarPath" value="${local.jars}/${emuJarName}" />
<property name="evioJarName" value="jevio-6.0.jar" />
<property name="evioJarPath" value="${local.jars}/${evioJarName}" />
<property name="lz4JarName" value="lz4-java-1.8.0.jar" />
<property name="lz4JarPath" value="${local.jars}/${lz4JarName}" />
<!-- 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 [-Dprefix=dir] <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 RTDP_INSTALL if defined." />
<echo message=" Also install scripts into the bin directory" />
<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 RTDP_INSTALL 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 RTDP_INSTALL environmental variable defined -->
<condition property="codaDefined">
<isset property="env.RTDP_INSTALL"/>
</condition>
<!-- Test to see if no installation directory defined -->
<condition property="noInstallDir">
<and>
<not>
<isset property="prefix"/>
</not>
<not>
<isset property="env.RTDP_INSTALL"/>
</not>
</and>
</condition>
</target>
<!-- ************************************************************* -->
<!-- if $RTDP_INSTALL is set, use that for classpath -->
<target name="RTDP_cp" depends="installCheck" if="codaDefined">
<path id="classpath">
<!-- use jars from this distribution first -->
<fileset dir="${local.jars}" >
<include name="*.jar" />
</fileset>
<!-- look in $RTDP_INSTALL next -->
<fileset dir="${env.RTDP_INSTALL}/common/jar" >
<include name="*.jar" />
</fileset>
</path>
<echo message="Compile with jars in $RTDP_INSTALL/common/jar" />
</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="prepareRtpDir"/>
</target>
<target name="preparePrefixDir" if="prefixDefined">
<mkdir dir="${prefix}/jar" />
<mkdir dir="${prefix}/bin" />
</target>
<target name="prepareRtpDir" if="codaDefined">
<mkdir dir="${env.RTDP_INSTALL}/common/jar" />
<mkdir dir="${env.RTDP_INSTALL}/common/bin" />
<mkdir dir="${env.RTDP_INSTALL}/Linux-i686/bin" />
<mkdir dir="${env.RTDP_INSTALL}/Linux-x86_64/bin" />
</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="RTDP_cp,prepare" description="Compiles all source code.">
<javac sourcepath="" srcdir="${src.dir}" destdir="${build.classes}" debug="${javac.debug}" optimize="yes" >
<include name="org/jlab/epsci/rtdp/*.java"/>
<!-- Only way to exclude a file to set the sourcepath, then specify include as well as exclude
<exclude name="**/DataChannelImplUdpStream.java" />
<exclude name="**/DataTransportImplUdpStream.java" /> -->
<classpath refid="classpath" />
</javac>
<copy overwrite="true" todir="${build.classes}">
<fileset dir="${src.dir}">
<include name="**/*.properties"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<include name="**/*.gif"/>
<include name="**/*.xml"/>
</fileset>
</copy>
</target>
<!-- ************************************************************* -->
<!-- Javadoc -->
<target name="javadoc" description="Create javadoc.">
<mkdir dir="${doc.dir}" />
<javadoc packagenames="org.jlab.epsci.rtdp.*"
sourcepath="java"
access="public"
destdir="${doc.dir}"
use="true" >
<classpath refid="classpath" />
</javadoc>
</target>
<!-- Javadoc for developer -->
<target name="developdoc" description="Create javadoc for developer.">
<mkdir dir="${doc.dir}" />
<javadoc packagenames="org.jlab.epsci.rtdp.*"
sourcepath="java"
access="package"
destdir="${doc.dir}"
use="true" >
<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.">
<delete file="${jarPath}"/>
<jar jarfile="${jarPath}" manifest="rtdp/java/org/jlab/epsci/manifest.mf">
<fileset dir="${build.classes}" excludes="*.class" >
<include name="org/jlab/epsci/**/*.class"/>
<include name="**/*.properties"/>
<include name="**/*.png"/>
<include name="**/*.jpg"/>
<include name="**/*.gif"/>
<include name="**/*.xml"/>
</fileset>
</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="installInRTDP"/>
</target>
<!-- Install in prefix -->
<target name="installInPrefix" if="prefixDefined">
<echo>Install ${jarName} into ${prefix}/jar </echo>
<echo>Install ${disJarName} into ${prefix}/jar </echo>
<echo>Install ${cmsgJarName} into ${prefix}/jar </echo>
<echo>Install ${emuJarName} into ${prefix}/jar </echo>
<echo>Install ${evioJarName} into ${prefix}/jar </echo>
<echo>Install ${lz4JarName} into ${prefix}/jar </echo>
<delete>
<fileset dir="${prefix}/jar" includes="${allJarNames}" />
<fileset dir="${prefix}/jar" includes="${disJarName}" />
<fileset dir="${prefix}/jar" includes="${cmsgJarName}" />
<fileset dir="${prefix}/jar" includes="${emuJarName}" />
<fileset dir="${prefix}/jar" includes="${evioJarName}" />
<fileset dir="${prefix}/jar" includes="${lz4JarName}" />
</delete>
<copy file="${jarPath}" todir="${prefix}/jar"/>
<copy file="${disJarPath}" todir="${prefix}/jar"/>
<copy file="${cmsgJarPath}" todir="${prefix}/jar"/>
<copy file="${emuJarPath}" todir="${prefix}/jar"/>
<copy file="${evioJarPath}" todir="${prefix}/jar"/>
<copy file="${lz4JarPath}" todir="${prefix}/jar"/>
</target>
<!-- Install in $RTDP_INSTALL -->
<target name="installInRTDP" unless="prefixDefined" if="codaDefined">
<echo>Install ${jarName} into ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Install ${disJarName} into ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Install ${cmsgJarName} into ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Install ${emuJarName} into ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Install ${evioJarName} into ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Install ${lz4JarName} into ${env.RTDP_INSTALL}/common/jar</echo>
<delete>
<fileset dir="${env.RTDP_INSTALL}/common/jar" includes="${allJarNames}" />
<fileset dir="${env.RTDP_INSTALL}/common/jar" includes="${disJarName}" />
<fileset dir="${env.RTDP_INSTALL}/common/jar" includes="${cmsgJarName}" />
<fileset dir="${env.RTDP_INSTALL}/common/jar" includes="${emuJarName}" />
<fileset dir="${env.RTDP_INSTALL}/common/jar" includes="${evioJarName}" />
<fileset dir="${env.RTDP_INSTALL}/common/jar" includes="${lz4JarName}" />
</delete>
<copy file="${jarPath}" todir="${env.RTDP_INSTALL}/common/jar"/>
<copy file="${disJarPath}" todir="${env.RTDP_INSTALL}/common/jar"/>
<copy file="${cmsgJarPath}" todir="${env.RTDP_INSTALL}/common/jar"/>
<copy file="${emuJarPath}" todir="${env.RTDP_INSTALL}/common/jar"/>
<copy file="${evioJarPath}" todir="${env.RTDP_INSTALL}/common/jar"/>
<copy file="${lz4JarPath}" todir="${env.RTDP_INSTALL}/common/jar"/>
</target>
<!-- No installation directory defined -->
<target name="error" if="noInstallDir">
<fail message="RTDP_INSTALL 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="uninstallFromRTDP"/>
</target>
<!-- Uninstall from prefix -->
<target name="uninstallFromPrefix" if="prefixDefined">
<echo>Remove ${jarName} from ${prefix}</echo>
<echo>Remove ${disJarName} from ${prefix}</echo>
<echo>Remove ${cmsgJarName} from ${prefix}</echo>
<echo>Remove ${emuJarName} from ${prefix}</echo>
<echo>Remove ${evioJarName} from ${prefix}</echo>
<echo>Remove ${lz4JarName} from ${prefix}</echo>
<delete file="${prefix}/jar/${jarName}"/>
<delete file="${prefix}/jar/${disJarName}"/>
<delete file="${prefix}/jar/${cmsgJarName}" />
<delete file="${prefix}/jar/${emuJarName}" />
<delete file="${prefix}/jar/${evioJarName}" />
<delete file="${prefix}/jar/${lz4JarName}" />
</target>
<!-- Uninstall from $RTDP_INSTALL -->
<target name="uninstallFromRTDP" unless="prefixDefined" if="codaDefined">
<echo>Remove ${jarName} from ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Remove ${disJarName} from ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Remove ${cmsgJarName} from ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Remove ${emuJarName} from ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Remove ${evioJarName} from ${env.RTDP_INSTALL}/common/jar</echo>
<echo>Remove ${lz4JarName} from ${env.RTDP_INSTALL}/common/jar</echo>
<delete file="${env.RTDP_INSTALL}/common/jar/${jarName}"/>
<delete file="${env.RTDP_INSTALL}/common/jar/${disJarName}"/>
<delete file="${env.RTDP_INSTALL}/common/jar/${cmsgJarName}" />
<delete file="${env.RTDP_INSTALL}/common/jar/${emuJarName}" />
<delete file="${env.RTDP_INSTALL}/common/jar/${evioJarName}" />
<delete file="${env.RTDP_INSTALL}/common/jar/${lz4JarName}" />
</target>
<!-- No installation directory defined to uninstall from -->
<target name="error2" if="noInstallDir">
<fail message="Installation directory not defined, jar NOT installed" />
</target>
</project>