-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
299 lines (264 loc) · 11.9 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
<?xml version="1.0"?>
<!--
The following environment variables are expected to be set:
1) HADOOP_HOME := root of hadoop tree
2) HADOOP_VERSION := version of hadoop (for hadoop-VERSION-core.jar)
3) NETCDF_HOME := Damasc NetCDF library (e.g.
You may have to adjust the names of the Hadoop JAR files listed in the
classpath below depending on the version of Hadoop being used.
-->
<project name="SIDR" default="main">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
<property name="properties.filename" value="file_formats.properties" />
<property name="src.dir" value="src"/>
<property name="doc.dir" value="docs"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="classes.tmp.dir" value="${build.dir}/classes-tmp"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="generator.file" value="edu/ucsc/srl/damasc/hadoop/GenerateMainTool.java" />
<property name="generated.file" value="edu/ucsc/srl/damasc/hadoop/CoreTool.java" />
<property name="generator.main.class" value="edu.ucsc.srl.damasc.hadoop.GenerateMainTool" />
<property name="main-class" value="edu.ucsc.srl.damasc.hadoop.CoreTool" />
<property environment="env"/>
<!--
<condition property="netcdf_path" value="${env.NETCDF_HOME}" else="../../netcdf/netcdf-damasc/netcdf-java/trunk/">
<isset property="env.NETCDF_HOME"/>
</condition>
-->
<path id="classpath">
<pathelement location="${env.HADOOP_HOME}/build/${env.HADOOP_JAR}"/>
<pathelement location="${env.HADOOP_HOME}/build/hadoop-1.0.4-early-results/share/hadoop/lib/commons-logging-1.1.1.jar"/>
<pathelement location="/usr/share/java/ant-contrib.jar"/>
<!-- <pathelement location="${env.NETCDF_HOME}/target/${env.NETCDF_JAR}" /> -->
<pathelement location="${env.NETCDF_HOME}/cdm/target/${env.NETCDF_JAR}" />
<!-- <pathelement location="${env.HDF5JAVA_HOME}/lib/jhdf5.jar" /> -->
<!-- <pathelement location="${env.HADOOP_HOME}/${env.HADOOP_JAR}"/> -->
<!-- <pathelement location="${env.HADOOP_HOME}/contrib/streaming/hadoop-streaming-${env.HADOOP_VERSION}.jar"/> -->
<!-- <pathelement location="${env.HADOOP_HOME}/contrib/streaming/hadoop-streaming-1.1.2.jar"/> -->
<!--<pathelement location="${env.HADOOP_HOME}/${env.HADOOP_JAR}"/>-->
<!-- <pathelement location="${env.HDF5_JAVA_HOME}/lib/${env.HDF5_JAVA_JAR}" /> -->
<!-- <pathelement location="/usr/share/java/hadoop-cephfs.jar" /> -->
<!--
<pathelement location="/home/buck/svn/early_results/lib/commons-logging-1.1.1/commons-logging-1.1.1.jar"/>
-->
</path>
<target name="generate-main" depends="init,write-properties-file">
<mkdir dir="${classes.tmp.dir}"/>
<javac
sourcepath=""
srcdir="${src.dir}"
destdir="${classes.tmp.dir}"
debug="true"
includeantruntime="false">
<include name="${generator.file}" />
<compilerarg value="-Xlint"/>
<classpath refid="classpath"/>
</javac>
<!-- Now execute that class file -->
<echo> Generating CoreTool.java </echo>
<java classname="${generator.main.class}" classpath="${classes.tmp.dir}" >
<arg value="${src.dir}/${generated.file}" />
</java>
</target>
<target name="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${jar.dir}"/>
<mkdir dir="${doc.dir}"/>
</target>
<target name="compile-core" depends="init,write-properties-file,generate-main">
<fileset id="files.to.exclude" dir="${src.dir}" >
<include name="edu/ucsc/srl/damasc/hadoop/io/input/NetCDFFileInputFormat.java" unless="build.netcdf" />
<include name="edu/ucsc/srl/damasc/hadoop/io/output/NetCDFFileOutputFormat.java" unless="build.netcdf" />
<include name="edu/ucsc/srl/damasc/hadoop/io/input/NetCDFRecordReader.java" unless="build.netcdf" />
<include name="edu/ucsc/srl/damasc/hadoop/io/NetCDFTools.java" unless="build.netcdf" />
<include name="edu/ucsc/srl/damasc/hadoop/tools/netcdf/**" unless="build.netcdf" />
<include name="edu/ucsc/srl/damasc/hadoop/io/input/NetCDFHDFSFileInputFormat.java" unless="build.netcdf_hdfs" />
<include name="edu/ucsc/srl/damasc/hadoop/io/input/NetCDFHDFSRecordReader.java" unless="build.netcdf_hdfs" />
<include name="edu/ucsc/srl/damasc/hadoop/io/input/NetCDFHDFSCoordinateVariableRecordReader.java" unless="build.netcdf_hdfs" />
<include name="edu/ucsc/srl/damasc/hadoop/io/NetCDFHDFSTools.java" unless="build.netcdf_hdfs" />
<include name="edu/ucsc/srl/damasc/hadoop/io/NcHdfsRaf.java" unless="build.netcdf_hdfs" />
<include name="edu/ucsc/srl/damasc/hadoop/tools/netcdf_hdfs/**" unless="build.netcdf_hdfs" />
<include name="edu/ucsc/srl/damasc/hadoop/io/input/HDF5FileInputFormat.java" unless="build.hdf5"/>
<include name="edu/ucsc/srl/damasc/hadoop/io/output/HDF5FileOutputFormat.java" unless="build.hdf5"/>
<include name="edu/ucsc/srl/damasc/hadoop/io/input/HDF5RecordReader.java" unless="build.hdf5"/>
<include name="edu/ucsc/srl/damasc/hadoop/HDF5Utils.java" unless="build.hdf5"/>
<include name="edu/ucsc/srl/damasc/hadoop/io/HDF5Tools.java" unless="build.hdf5"/>
<include name="edu/ucsc/srl/damasc/hadoop/tools/hdf5/**" unless="build.hdf5"/>
</fileset>
<!--
<fileset id="files.to.build" dir="${src.dir}" >
<include name="**/*.java" />
<exclude name="edu/ucsc/srl/damasc/hadoop/io/input/NetCDFFileInputFormat.java" unless="build.netcdf" />
<exclude name="edu/ucsc/srl/damasc/hadoop/io/input/NetCDFFileOutputFormat.java" unless="build.netcdf" />
<exclude name="edu/ucsc/srl/damasc/hadoop/io/input/NetCDFRecordReader.java" unless="build.netcdf" />
<exclude name="edu/ucsc/srl/damasc/hadoop/io/NetCDFTools.java" unless="build.netcdf" />
<exclude name="edu/ucsc/srl/damasc/hadoop/tools/netcdf/**" unless="build.netcdf" />
<exclude name="edu/ucsc/srl/damasc/hadoop/io/input/HDF5FileInputFormat.java" unless="build.hdf5"/>
<exclude name="edu/ucsc/srl/damasc/hadoop/io/input/HDF5FileOutputFormat.java" unless="build.hdf5"/>
<exclude name="edu/ucsc/srl/damasc/hadoop/io/input/HDF5RecordReader.java" unless="build.hdf5"/>
<exclude name="edu/ucsc/srl/damasc/hadoop/tools/hdf5/**" unless="build.hdf5"/>
</fileset>
<pathconvert pathsep=":" property="my.file.set" refid="files.to.build">
<map from="/home/buck/svn/scihadoop/hdf5_scihadoop/src/" to=""/>
</pathconvert>
-->
<pathconvert pathsep="," property="my.exclude.set" refid="files.to.exclude">
<!-- <map from="/home/buck/svn/scihadoop/hdf5_scihadoop/src/" to=""/> -->
<map from="${user.dir}/src/" to=""/>
</pathconvert>
<echo message="my.file.set= ${my.file.set}"/>
<echo message="my.exclude.set= ${my.exclude.set}"/>
<echo message="files.to.build = ${files.to.build}"/>
<echo message="files.to.exclude = ${files.to.exclude}"/>
<path id="foo">
<pathelement path="${src.dir}" />
<pathelement path="${lib.dir}" />
</path>
<property name="bar" refid="foo" />
<echo message="bar = ${bar}"/>
<!-- <property name="src.filter.ref" refid="my.file.set" /> -->
<!-- <property name="src.filter.ref2" refid="files.to.build" /> -->
<!-- srcdir="${src.dir}" -->
<javac
sourcepath=""
srcdir="${src.dir}"
destdir="${classes.dir}"
debug="true"
includeantruntime="false"
excludes="${my.exclude.set}" >
<exclude name="${my.exclude.set}" />
<!-- <include name="${my.file.set}" /> -->
<!-- <src name="files.to.build"/> -->
<!-- <src id="${src.filter.ref}" /> -->
<compilerarg value="-Xlint"/>
<classpath refid="classpath"/>
</javac>
</target>
<!-- <target name="netcdf" depends="compile-generate-main-tool,compile-core"> -->
<target name="netcdf">
<property name="build.netcdf" value="true"/>
</target>
<target name="netcdf_hdfs">
<property name="build.netcdf_hdfs" value="true"/>
</target>
<!-- <target name="hdf5" depends="compile-generate-main-tool,compile-core"> -->
<target name="hdf5">
<property name="build.hdf5" value="true"/>
</target>
<target name="debug">
<if>
<isset property="build.netcdf"/>
<then>
<echo> "DO build netcdf" </echo>
</then>
<else>
<echo> "DO NOT build netcdf" </echo>
</else>
</if>
<if>
<isset property="build.netcdf_hdfs"/>
<then>
<echo> "DO build netcdf_hdfs" </echo>
</then>
<else>
<echo> "DO NOT build netcdf_hdfs" </echo>
</else>
</if>
<if>
<isset property="build.hdf5"/>
<then>
<echo> "DO build hdf5" </echo>
</then>
<else>
<echo> "DO NOT build hdf5" </echo>
</else>
</if>
</target>
<target name="jar" depends="compile-core">
<!-- flatten classpath first -->
<!-- convert classpath to a flat list/string for use in manifest task -->
<!--
<pathconvert property="myclasspath" pathsep=" ">
<path refid="classpath" />
</pathconvert>
-->
<pathconvert pathsep=" " property="classpath.manifest" refid="classpath" />
<!-- <property name="myclasspath" refid="classpath"/> -->
<!-- Emit the property to the ant console -->
<echo message="Classpath = ${classpath.manifest}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
<!-- <attribute name="Main-Class" value="edu.ucsc.srl.damasc.hadoop.io.input.TestNetCDFFileInputFormat"/> -->
<attribute name="Class-Path" value="${classpath.manifest}" />
</manifest>
<fileset dir="${classes.dir}" includes="**/*.class" />
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}" >
<classpath>
<path refid="classpath"/>
<path id="application" location="${jar.dir}/${ant.project.name}.jar" />
</classpath>
</java>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${doc.dir}"/>
<delete file="${src.dir}/${generated.file}"/>
<delete file="${properties.filename}"/>
</target>
<target name="main" depends="clean,jar,run"/>
<target name="docs" depends="init">
<javadoc packagenames="src" sourcepath="${src.dir}" destdir="${doc.dir}">
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
</javadoc>
</target>
<target name="write-properties-file">
<if>
<isset property="build.netcdf"/>
<then>
<propertyfile file="${properties.filename}" comment="File Formats to Build">
<entry key="netcdf" type="string" value="true" />
</propertyfile>
</then>
<else>
<propertyfile file="${properties.filename}" comment="File Formats to Build">
<entry key="netcdf" type="string" value="false" />
</propertyfile>
</else>
</if>
<if>
<isset property="build.netcdf_hdfs"/>
<then>
<propertyfile file="${properties.filename}" comment="File Formats to Build">
<entry key="netcdf_hdfs" type="string" value="true" />
</propertyfile>
</then>
<else>
<propertyfile file="${properties.filename}" comment="File Formats to Build">
<entry key="netcdf_hdfs" type="string" value="false" />
</propertyfile>
</else>
</if>
<if>
<isset property="build.hdf5"/>
<then>
<propertyfile file="${properties.filename}" comment="File Formats to Build">
<entry key="hdf5" type="string" value="true" />
</propertyfile>
</then>
<else>
<propertyfile file="${properties.filename}" comment="File Formats to Build">
<entry key="hdf5" type="string" value="false" />
</propertyfile>
</else>
</if>
</target>
</project>