forked from apache/datasketches-pig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
executable file
·299 lines (262 loc) · 12.1 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"?>
<!--
********************************************************************************
Build file for Sketch library
********************************************************************************
Assumes the following directory structure:
<basedir> //this directory
All source files are copied to an intermediate dir structure with the first
targets: "precopy1" and "precopy2".
This means all source dir are untouched.
Build Directories
<basedir>/build //Volatile directory for build process
<basedir>/jarsIn //dependant jars
Intermediate Directories
<basedir>/build/bin //javadoc compiler output and resource destination
<basedir>/build/src //Move all source here
<basedir>/build/jars //Move all dependent jars here
<basedir>/build/scripts //Move all scripts here, this build file will be moved here.
<basedir>/build/javadoc //Javadoc output and javadoc resources
// move all html & related here after the javadoc
// used for creating javaddoc.zip
Output Directories
<basedir>/build/out //Used for creating the distribution zip
<basedir>/build/out/jars //created jars
<basedir>/build/out/zips //javadoc.zip, src.zip
<basedir>/build/out/scripts //startup scripts & build.html
-->
<!-- set basedir -->
<project name="Sketch" default="build" basedir=".">
<description>
Build file for Sketch Library
</description>
<!-- project name properties -->
<property name="TitlePrefix" value="Pig Sketch Library" />
<property name="outputFileNamePrefix" value="sketches-pig" />
<property name="year" value="2012-2015" />
<!-- PROJECT INPUT PATHS, copied to intermediate paths -->
<property name="SrcJavadocPath" value="${basedir}/src/main/javadoc" />
<property name="SrcJavadocResourcePath" value="${basedir}/src/main/javadoc/resources" />
<property name="MavenMainPath" value="${basedir}/src/main/java" />
<property name="MavenTestPath" value="${basedir}/src/test/java" />
<property name="RelJavaPackagePath" value="com/yahoo/sketches" />
<property name="SrcMainCommon" value="${MavenMainPath}/${RelJavaPackagePath}" />
<property name="SrcTestCommon" value="${MavenTestPath}/${RelJavaPackagePath}" />
<!-- PROJECT BUILD PATH & FILE -->
<property name="BuildPath" value="${basedir}/build" />
<property name="BuildFile" value="${basedir}/build.xml" />
<!-- PROJECT INTERMEDIATE PATHS, created in -init -->
<property name="IntMainPath" value="${BuildPath}/${MavenMainPath}" />
<property name="IntTestPath" value="${BuildPath}/${MavenTestPath}" />
<property name="IntBinPath" value="${BuildPath}/bin" />
<property name="IntJavadocPath" value="${BuildPath}/javadoc" />
<property name="IntJavadocResourcesPath" value="${BuildPath}/javadoc/resources" />
<property name="IntScriptsPath" value="${BuildPath}/scripts" />
<property name="IntJarsPath" value="${BuildPath}/jarsIn" />
<!-- PROJECT OUTPUT PATHS, created in -init -->
<property name="OutPath" value="${BuildPath}/out" />
<property name="JarsOutPath" value="${OutPath}/jars" />
<property name="ZipsOutPath" value="${OutPath}/zips" />
<property name="ScriptsOutPath" value="${OutPath}/scripts" />
<!-- OVERVIEW HANDLING -->
<property name="OverviewFileName" value="overview.html" />
<!-- project dependency jar paths -->
<property name="TestNGJar" value="jarsIn/testng-6.8.8.jar" />
<property name="PigJar" value="jarsIn/pig-0.12.1.jar" />
<property name="SketchesCoreJar" value="jarsIn/sketches-core.jar" />
<!-- FILESETS -->
<!-- classpaths -->
<path id="ProjClasspath">
<pathelement location="${TestNGJar}" />
<pathelement location="${PigJar}" />
<pathelement location="${SketchesCoreJar}" />
</path>
<!-- compiler properties -->
<property name="comp.debug" value="on"/>
<property name="comp.source.ver" value="1.8" />
<property name="comp.compiler.ver" value="javac1.8" />
<property name="comp.target.ver" value="1.8" />
<property name="comp.fork" value="true" />
<!-- javadoc properties -->
<property name="jdoc.int.overview" value="${IntJavadocPath}/${OverviewFileName}" /> <!-- copy to here before javadoc -->
<property name="jdoc.windowTitle" value="${TitlePrefix} API" />
<property name="jdoc.use" value="true" />
<property name="jdoc.breakiterator" value="true" />
<property name="jdoc.source.ver" value="1.8" />
<property name="jdoc.verbose" value="false" />
<property name="jdoc.author" value="true" />
<property name="jdoc.version" value="true" />
<property name="jdoc.public" value="true" />
<property name="jdoc.protected" value="true" />
<property name="jdoc.private" value="true" />
<property name="jdoc.header" value="Sketch Library V4" />
<property name="jdoc.docfilessubdirs" value="true" />
<!--
********************************************************************************
proj Targets
********************************************************************************
-->
<!--PRECOPY1 -->
<target name="precopy1"
depends="-init"
description="Copy remote dependant jarsIn to build jar directory" >
<copy file="${PigJar}" todir="${IntJarsPath}" />
<copy file="${TestNGJar}" todir="${IntJarsPath}" />
<copy file="${SketchesCoreJar}" todir="${IntJarsPath}" />
</target>
<!--PRECOPY2 -->
<target name="precopy2"
depends="precopy1"
description="Copy all sources to intermediate directories" >
<!-- Create directories -->
<mkdir dir="${IntMainPath}/${RelJavaPackagePath}" />
<mkdir dir="${IntTestPath}/${RelJavaPackagePath}" />
<!-- Copy sources and directories below as well -->
<copy todir="${IntMainPath}/${RelJavaPackagePath}" >
<fileset dir="${SrcMainCommon}" />
</copy>
<copy todir="${IntTestPath}/${RelJavaPackagePath}" >
<fileset dir="${SrcTestCommon}" />
</copy>
<!-- build file -->
<copy file="${BuildFile}"
todir="${ScriptsOutPath}" />
</target>
<!-- COMPILE -->
<target name="compile"
depends="precopy2"
description="Compile all ${TitlePrefix} Java classes" >
<javac srcdir="${IntMainPath}:${IntTestPath}"
destdir="${IntBinPath}"
source="${comp.source.ver}"
compiler="${comp.compiler.ver}"
target="${comp.target.ver}"
fork="${comp.fork}"
debug="${comp.debug}"
includeantruntime="false" >
<classpath refid="ProjClasspath"/>
<!-- compilerarg value="-Xlint:unchecked" / -->
</javac>
<echo message="Compile Done."/>
</target>
<!-- jar classes -->
<target name="jar_classes"
depends="compile"
description="Pack all class files into a Jar file">
<delete file="${JarsOutPath}/${outputFileNamePrefix}.jar"/>
<jar jarfile="${JarsOutPath}/${outputFileNamePrefix}.jar">
<manifest>
<attribute name="Build-Date" value="${TODAY}"/>
</manifest>
<fileset dir="${IntBinPath}">
<include name="**" />
</fileset>
</jar>
<echo message="Classes jarred" />
</target>
<!-- zip source -->
<target name="zip_src"
depends="precopy2"
description="Pack all source files into a Zip file" >
<delete file="${ZipsOutPath}/${outputFileNamePrefix}_src.zip" />
<zip destfile="${ZipsOutPath}/${outputFileNamePrefix}_src.zip" >
<zipfileset dir="${IntMainPath}" includes="**" prefix="src" />
</zip>
</target>
<!-- Create javadocs & copy javadoc resources -->
<target name="javadoc"
depends="precopy2"
description="Create ${TitlePrefix} javadocs">
<delete dir="${IntJavadocPath}" />
<mkdir dir="${IntJavadocPath}" />
<copy file="${SrcJavadocPath}/${OverviewFileName}" todir="${IntJavadocPath}" />
<javadoc
sourcepath="${IntMainPath}"
destdir="${IntJavadocPath}"
use="${jdoc.use}"
breakiterator="${jdoc.breakiterator}"
source="${jdoc.source.ver}"
verbose="${jdoc.verbose}"
author="${jdoc.author}"
version="${jdoc.version}"
windowtitle="${jdoc.windowTitle}"
overview="${jdoc.int.overview}"
public="${jdoc.public}"
header="${jdoc.header}" >
<classpath refid="ProjClasspath"/>
<arg value="-Xdoclint:all"/>
</javadoc>
<!-- Copy maven resource files to javadoc dir -->
<copy todir="${IntJavadocResourcesPath}" >
<fileset dir="${SrcJavadocResourcePath}" />
</copy>
<!-- View options:
public="${jdoc.public}"
protected="${jdoc.protected}"
private="${jdoc.private}"
-->
</target>
<!-- COPY Misc files to out directories
<target name="copyDocs"
depends="precopy2"
description="Copy Data, scripts, misc to out directories." >
</target> -->
<!-- zip javadoc -->
<target name="zip_javadoc"
depends="javadoc"
description="Pack the javadocs into a Zip file" >
<delete file="${ZipsOutPath}/${outputFileNamePrefix}_javadoc.zip" />
<zip destfile="${ZipsOutPath}/${outputFileNamePrefix}_javadoc.zip" >
<zipfileset dir="${IntJavadocPath}"
includes="**" prefix="javadoc" />
</zip>
</target>
<!-- zip All -->
<target name="zip_All"
depends="precopy2, jar_classes, zip_src, zip_javadoc"
description="Pack the jar and zips into this distribution Zip file">
<delete file="${ZipsOutPath}/${outputFileNamePrefix}.zip" />
<zip destfile="${ZipsOutPath}/${outputFileNamePrefix}.zip" >
<zipfileset dir="${OutPath}"
includes="**" />
</zip>
</target>
<target name="build"
depends="zip_All"
description="Build ${TitlePrefix}">
</target>
<!-- CLEAN -->
<target name="clean" >
<delete dir="${BuildPath}" />
</target>
<!--
*******************************************************************************
Internal Targets
*******************************************************************************
-->
<!-- Internal build target; not for external use -->
<target name="-init">
<!-- set timestamp and print time -->
<tstamp>
<format property="TODAY" pattern="d-MMMM-yyyy.hh:mm:ss aa" locale="en"/>
<format property="DSTAMP" pattern="d-MMMM-yyyy" locale="en"/>
<format property="TSTAMP" pattern="hh:mm:ss aa" locale="en"/>
</tstamp>
<delete dir="${BuildPath}" />
<!-- build directories -->
<mkdir dir="${BuildPath}" />
<mkdir dir="${IntMainPath}" />
<mkdir dir="${IntTestPath}" />
<mkdir dir="${IntBinPath}" />
<mkdir dir="${IntJavadocPath}" />
<mkdir dir="${IntJavadocResourcesPath}" />
<mkdir dir="${IntScriptsPath}" />
<mkdir dir="${IntJarsPath}" />
<mkdir dir="${OutPath}" />
<mkdir dir="${JarsOutPath}" />
<mkdir dir="${ZipsOutPath}" />
<mkdir dir="${ScriptsOutPath}" />
<echo message="Build time: ${TODAY}"/>
<echo message="Initialized" />
</target>
</project>