forked from mattcasters/VerticaBulkLoader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
457 lines (384 loc) · 16.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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
<project name="VerticaBulkLoader" default="default" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
VerticaBulkLoader plugin build file
</description>
<tstamp prefix="start"/>
<property name="basedir"
value="."
description="Base directory for all project artifacts (jar, zip, tar.gz, etc...)" />
<property name="dist.dir"
value="${basedir}/dist"
description="Dist dir"/>
<property name="bin.dir"
value="${basedir}/bin"
description="Base directory for all non-dist build output" />
<property name ="subfloor.resources.dir"
value ='${basedir}/.build'/>
<property name="antcontrib.build.cache.dir"
value="${subfloor.resources.dir}/ant-contrib"
description="Directory where the Ant-Contrib jar (and dependencies) is placed after it is auto-downloaded by the build" />
<property name="subfloor.tmp.dir"
value = "${subfloor.resources.dir}/tmp"/>
<property name="ivy.url"
value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.jar"
description="The URL to the current release of Apache IVY" />
<property name="ivy.settingsurl"
value="file:${basedir}/ivysettings.xml"
description="URL to the (common) ivysettings.xml. This file is required by the build to configure IVY. Note you must escape the ':' if this property exists in a .properties file" />
<property name="ivyfile"
value="ivy.xml"
description="The name of the IVY xml file defining your project's dependencies" />
<property name="ivy.artifact.group"
value="mycompanyname"
description="IVY metadata describing the originating company or organization" />
<property name="ivy.artifact.pomfile"
value="${dist.dir}/pom.xml"
description="The path to the Maven pom file to deploy with the artifact" />
<property name="ivy.artifact.ivyfilename"
value="ivy.xml"
description="The name of the IVY xml file to deploy with the artifact" />
<property name="ivy.artifact.ivypathname"
value="${dist.dir}/ivy.xml"
description="The full path to the IVY xml file to deploy with the artifact" />
<property name="ivy.reports.dir"
value="${bin.dir}/reports/ivy"
description="Base directory that holds all IVY dependency report files" />
<property name="ivy.configs" value="*" description="Set of configs used for IVY reporting and checking operations" />
<property file="override.properties"/>
<property file="build.properties"
description="Properties customized for your particular project belong in this file." />
<!-- system properties to use -->
<property name= "cr" value="${line.separator}"/>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="classes" location="classes"/>
<property name="lib" location="lib"/>
<property name="testlib" location="test-lib"/>
<property name="dist" location="dist"/>
<property name="libext" location="libext"/>
<target name="init" description="create timestamp and directories">
<echo>Init...</echo>
<tstamp/>
<mkdir dir="${classes}"/>
<mkdir dir="${lib}"/>
<mkdir dir="${dist}"/>
</target>
<!--
==========================
Compile the code
==========================
-->
<target name="compile" depends="init, resolve" description="compile the source " >
<echo>Compiling VerticaBulkLoader...</echo>
<javac debug="true" debuglevel="lines,vars,source" srcdir="${src}"
destdir="${classes}">
<classpath id="cpath">
<fileset dir="${lib}" includes="*.jar"/>
<fileset dir="${libext}" includes="*.jar"/>
</classpath>
</javac>
</target>
<!-- ==========================
Copy additional files
==========================
-->
<target name="copy" depends="compile" description="copy images etc to classes directory" >
<echo>Copying images etc to classes directory...</echo>
<copy todir="${classes}">
<fileset
dir="${src}"
includes="**/*.png,**/*.xml,**/*.properties"/>
</copy>
</target>
<!--
==========================
library
==========================
-->
<target name="jar" depends="compile, copy" description="generate the VerticaBulkLoader library jar">
<echo>Generating the VerticaBulkLoader library jar ...</echo>
<jar
jarfile="${bin.dir}/verticabulkloadplugin.jar"
basedir="${classes}"
includes="**/*"/>
</target>
<!--
==========================
distrib for plugin
==========================
-->
<target name="dist" depends="jar" description="Create the distribution package..." >
<echo>Copying libraries to dist directory...</echo>
<copy todir="${dist}">
<fileset
dir="${bin.dir}"
includes="**/*.jar"/>
</copy>
<zip destfile="${dist}/${ivy.artifact.id}-${project.revision}.zip">
<zipfileset dir="${bin.dir}" includes="**/*.jar"/>
</zip>
</target>
<!--
==========================
deploy to Kettle
==========================
-->
<target name="deploy" depends="dist" description="Deploy distribution..." >
<echo>deploying plugin...</echo>
<copy todir="${deploydir1}">
<fileset
dir="${distrib}"
includes="**/*.*"/>
<fileset
dir="${libext}"
includes="**/*.*"/>
</copy>
<copy todir="${deploydir2}">
<fileset
dir="${distrib}"
includes="**/*.*"/>
<fileset
dir="${libext}"
includes="**/*.*"/>
</copy>
</target>
<!--
==========================
Default target: all
==========================
-->
<target name="default" depends="deploy" description="default = build all"/>
<!--
==========================
C L E A N
==========================
-->
<target name="clean" description="clean up generated files" >
<delete dir="${classes}"/>
<delete dir="${lib}"/>
</target>
<!--
Yvy related stuff
-->
<!--=======================================================================
install-antcontrib
(Fetches and) installs ant-contrib tasks.
====================================================================-->
<target name="install-antcontrib" depends="antcontrib.download-check">
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<fileset dir="${antcontrib.build.cache.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</taskdef>
</target>
<!--=======================================================================
antcontrib.download-check
Fetches ant-contrib from sourceforge if it is not already present
====================================================================-->
<target name="antcontrib.download-check">
<condition property="antcontrib.available">
<and>
<available file="${antcontrib.build.cache.dir}" />
<available classname="net.sf.antcontrib.logic.IfTask">
<classpath>
<fileset dir="${antcontrib.build.cache.dir}">
<include name="*.jar" />
</fileset>
</classpath>
</available>
</and>
</condition>
<antcall target="antcontrib.download" />
</target>
<!--=======================================================================
antcontrib.download
Fetches ant-contrib from sourceforge
====================================================================-->
<target name="antcontrib.download" unless="antcontrib.available">
<mkdir dir="${subfloor.tmp.dir}" />
<get src="http://downloads.sourceforge.net/ant-contrib/ant-contrib-1.0b3-bin.zip"
dest="${subfloor.tmp.dir}/antcontrib.zip"
usetimestamp="true" />
<unzip src="${subfloor.tmp.dir}/antcontrib.zip" dest="${subfloor.tmp.dir}">
<patternset>
<include name="**/*.jar" />
</patternset>
</unzip>
<copy todir="${antcontrib.build.cache.dir}">
<fileset dir="${subfloor.tmp.dir}/ant-contrib">
<include name="**/*.jar" />
</fileset>
</copy>
</target>
<target name="install-ivy" depends="install-antcontrib">
<if>
<istrue value="${ivy.isinstalled}" />
<then>
<echo message="Skipping IVY install. IVY has already been configured by the build" />
</then>
<else>
<download-antlib name="ivy" url="${ivy.url}" classname="org.apache.ivy.ant.IvyTask" extension="jar" />
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant">
<classpath>
<fileset dir="${subfloor.resources.dir}/ivy">
<include name="*.jar" />
</fileset>
</classpath>
</taskdef>
<ivy:settings url="${ivy.settingsurl}" />
<property name="ivy.isinstalled" value="true" />
</else>
</if>
</target>
<!--=======================================================================
ivy.check-releasable
Verifies that there are no SNAPSHOT dependencies defined in the ivy xml.
If there are SNAPSHOTS, fail the release build.
====================================================================-->
<target name="ivy.check-releasable" depends="install-ivy, install-antcontrib">
<if>
<istrue value="${release}" />
<then>
<sequential>
<ivy:artifactproperty conf="${ivy.configs}" name="dep.[module]/[artifact]-[revision]" value="[revision]" />
<propertyselector property="violators" match="dep\..*SNAPSHOT.*" select="\0" casesensitive="false" />
<fail if="violators"
message="Release not possible, you have dependencies on non-released artifacts: ${violators}" />
</sequential>
</then>
</if>
</target>
<!--=======================================================================
resolve
Using ivy and the dependencies for the project (defined in the ivy.xml
file), this task will retrieve the needed files and place them into
the defined directories.
====================================================================-->
<target name="resolve"
depends="resolve-default, resolve-test, ivy.check-releasable"
description="Retrieves all the dependent libraries" />
<target name="resolve-init" unless="resolve-init.skip" depends="install-ivy">
<!-- If this is the 1st time through resolve-init, then we need to clean up the jars
-->
<antcall target="clean-jars" />
<property name="resolve-init.skip" value="" />
</target>
<target name="resolve-default" depends="resolve-default.default,resolve-default.composite"/>
<!--
This target resolves the default IVY configuration as a composite of child configurations.
You should set ivy.default.sub-configs in your build.properties only if you want your default
configuration to be treated as a composite of two or more child configurations.
To turn this on, set ivy.default.sub-configs property in your build.properties, e.g.
ivy.default.sub-configs=external,internal
Note: the parent config "default" proper will not be resolved
-->
<target name="resolve-default.composite" depends="install-antcontrib,resolve-init" if="ivy.default.sub-configs">
<for list="${ivy.default.sub-configs}" param="conf">
<sequential>
<ivy:resolve file="${ivyfile}" conf="default_@{conf}" />
<ivy:retrieve conf="default_@{conf}" pattern="${lib}/@{conf}/[module]-[revision](-[classifier]).[ext]" />
</sequential>
</for>
</target>
<target name="resolve-default.default" depends="resolve-init" unless="ivy.default.sub-configs">
<ivy:resolve file="${ivyfile}" conf="default" />
<ivy:retrieve conf="default" pattern="${lib}/[module]-[revision](-[classifier]).[ext]" />
</target>
<target name="resolve-test" depends="resolve-init">
<ivy:resolve file="${ivyfile}" conf="test" />
<ivy:retrieve conf="test" pattern="${testlib}/[module]-[revision](-[classifier]).[ext]" />
</target>
<target name="resolve-codegen" depends="resolve-init">
<ivy:resolve file="${ivyfile}" conf="codegen" />
<ivy:retrieve conf="codegen" pattern="${lib}/[module]-[revision](-[classifier]).[ext]" />
</target>
<target name="resolve-runtime" depends="resolve-init">
<ivy:resolve file="${ivyfile}" conf="runtime" />
<ivy:retrieve conf="runtime" pattern="${lib}/[module]-[revision](-[classifier]).[ext]" />
</target>
<!--=======================================================================
ivy-clean-cache
Cleans the IVY cache. You are erasing IVY's memory. Run this if you
want to force IVY to go fetch all your project dependencies from scratch.
WARNING: this will affect all IVY projects, not just the current workspace
====================================================================-->
<target name="ivy-clean-cache" depends="install-ivy">
<ivy:cleancache />
</target>
<!--=======================================================================
ivy-clean-local
Completely cleans your local repository of any files published locally
by way of publish-local.
WARNING: this is a global action and will affect other IVY projects
currently referencing a locally published dependency
====================================================================-->
<target name="ivy-clean-local" depends="install-ivy">
<delete dir="${ivy.local.default.root}/" />
</target>
<!--=======================================================================
clean-jars
Removes all the libraries that have been downloaded for this project
using the ivy dependencies.
====================================================================-->
<target name="clean-jars">
<delete dir="${lib}" />
<delete dir="${testlib}" />
</target>
<!--=======================================================================
Macro which will download the specified library.
NOTE: any task using this macro must depend on "install-antcontrib"
parameters:
name - The name of the library (the filename w/o extension)
url - The URL from which the library will be downloaded
resource - The name of the resource which should be loaded
as a task definition
classname - A class file name which can be used to detect if the
property library exists
extension - The extension of the library being downloaded
(defaults to zip)
====================================================================-->
<macrodef name="download-antlib">
<attribute name="name" />
<attribute name="url" />
<attribute name="classname" />
<attribute name="extension" default="zip" />
<sequential>
<mkdir dir="${subfloor.resources.dir}/@{name}/" />
<!-- if the library does not exist, we must download it -->
<if>
<not>
<and>
<available file="${subfloor.resources.dir}/@{name}" />
<available classname="@{classname}">
<classpath>
<fileset dir="${subfloor.resources.dir}/@{name}">
<include name="**/*.jar" />
</fileset>
</classpath>
</available>
</and>
</not>
<then>
<!-- if it is a zip file, unzip it ... otherwise if a jar, just download it -->
<if>
<equals arg1="zip" arg2="@{extension}" />
<then>
<!-- download the source file to a temp directory -->
<echo message="downloading library @{name} [@{name}.@{extension} from @{url}]" />
<mkdir dir="${subfloor.tmp.dir}" />
<get src="@{url}" dest="${subfloor.tmp.dir}/@{name}.@{extension}" usetimestamp="true" />
<unzip src="${subfloor.tmp.dir}/@{name}.@{extension}"
dest="${subfloor.resources.dir}/@{name}"
overwrite="true" />
</then>
<else>
<get src="@{url}" dest="${subfloor.resources.dir}/@{name}/@{name}.@{extension}" usetimestamp="true" />
</else>
</if>
</then>
</if>
</sequential>
</macrodef>
</project>