-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdependencyBuilder.xml
More file actions
510 lines (425 loc) · 24.8 KB
/
dependencyBuilder.xml
File metadata and controls
510 lines (425 loc) · 24.8 KB
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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
<project xmlns:if="ant:if" xmlns:unless="ant:unless">
<description>
A script for recursively downloading and building
depedencies with Maven from GitHub repositories.
</description>
<property name="builder.default.githubGroup" value="optimizationBenchmarking" unless:set="builder.default.githubGroup" />
<!-- This script provides macros to recursively download,
build, and install the latest versions of Maven projects
from GitHub.
This is an example 'build.xml' file for the recursive
downloading and building of Maven projects from GitHub
repositories. You can put a 'build.xml' like this into
the base dir of your Maven project. It is executed like
'ant'
OR 'ant -Djdk=PATH/TO/JDK' (to specify the path to the JDK)
OR 'ant -Dmaven=PATH/TO/MAVEN' (to specify the path to Maven)
OR 'ant -DskipTests=true' (to skip the tests)
OR 'ant -DpassToMaven=XXXX' (pass XXX as "-DXXX" to Maven (recursively))
OR any combination of the above
The target 'build' will be executed, which first downloads
a help script ('dependencyBuilder.xml'). In the 'build'
target, you specify the main project (in this example,
'utils-graphics') which you want to build, i.e., the project
in whose root folder you put the 'build.xml' script, as
'githubProject' attribute of the 'buildWithDependencies'
macro.
This macro takes another element, 'dependencies', where
can specify nested 'dependency' tags defining GitHub
projects which need to be installed in order to compile
the root project. In this example, there is one such
required project, 'utils-base'.
Both the 'buildWithDependencies' as well as the
'dependency' tag accept two attributes 'githubProject'
and 'githubGroup'. Together, they allow you to select
and project on GitHub. If 'githubGroup' is not
specified, it defaults to 'optimizationBenchmarking'.
The 'buildWithDependencies' macro is intended to work
recursively, i.e., if the required project, too,
defines a 'build.xml' file, this file will be executed
with Ant. It may then download and build additional
dependencies. A dependency required by multiple
projects is only built and installed once. If no
'build.xml' file is specified, the project will be
built with Maven.
Example 'build.xml':
<project basedir="." default="build">
<import>
<url url="https://raw.githubusercontent.com/optimizationBenchmarking/utils-build/master/dependencyBuilder.xml" />
</import>
<target name="build">
<sequential>
<buildWithDependencies githubProject="utils-graphics">
<dependencies>
<dependency githubProject="utils-base" />
</dependencies>
</buildWithDependencies>
</sequential>
</target>
</project>
This script tries to:
1. Check if the script was invoked as the root of a dependency
building process or as builder for a dependency.
2. Setup the basic PATH and CLASS_PATH
3. Set the path to Maven
4. Set the JAVA_HOME path
5. Macro to Run Maven to build and install a project.
6. Macro to remove plugins in dependency Maven poms to to speed-up builds
7. Macro to download, build, and install dependencies
8. Macro which checks if we need to execute the above
macro for a given dependency.
9. Macro to build and install a root project
-->
<!-- 1. Are we the root of a dependency tree?
Is this a root invocation of the builder? Only the tests of the root
invocation will be executed. We may not be root if this script was
recursively invoked in order to build a dependency. -->
<property name="builder.isRoot" value="true" unless:set="builder.isRoot" />
<property name="builder.performTests" value="false" if:true="${skipTests}" unless:set="builder.performTests" />
<property name="builder.performTests" value="${builder.isRoot}" unless:set="builder.performTests" />
<!-- The optional argument to be passed to Maven. -->
<property name="builder.passToMaven" value="-D${passToMaven}" if:set="passToMaven" unless:set="builder.passToMaven" />
<!-- First we load the environment into a property set in order to access
specific paths. -->
<property environment="builder.env" unless:set="builder.env" />
<!-- 2. Setup PATH and CLASS_PATH
We now collect the PATH, JAVA_HOME, ANT_HOME, MAVEN_HOME, and potential
other paths to programs. -->
<condition property="builder.isWindows" value="true" unless:set="builder.isWindows">
<os family="windows" />
</condition>
<property name="builder.isWindows" value="false" unless:set="builder.isWindows" />
<available property="builder.path.winProgs" file="C:/Program Files" type="dir" value="C:/Program Files" unless:set="builder.path.winProgs" if:true="${builder.isWindows}" />
<path id="builder.path.paths" cache="true" unless:set="builder.path.paths">
<pathelement path="${builder.env.PATH}" if:set="builder.env.PATH" />
<pathelement path="${builder.env.Path}" if:set="builder.env.Path" />
<pathelement path="${builder.env.JAVA_HOME}" if:set="builder.env.JAVA_HOME" />
<pathelement path="${builder.env.ANT_HOME}" if:set="builder.env.ANT_HOME" />
<pathelement path="${ant.home}" if:set="ant.home" />
<pathelement path="${builder.env.MAVEN_HOME}" if:set="builder.env.MAVEN_HOME" />
<pathelement path="${builder.env.ProgramFiles}" if:set="builder.env.ProgramFiles" if:true="${builder.isWindows}" />
<pathelement path="${builder.env.ProgramFiles(x86)}" if:set="builder.env.ProgramFiles(x86)" if:true="${builder.isWindows}" />
<pathelement path="${builder.env.ProgramW6432}" if:set="builder.env.ProgramW6432" if:true="${builder.isWindows}" />
<pathelement path="${builder.path.winProgs}" if:set="builder.path.winProgs" if:true="${builder.isWindows}" />
<pathelement path="${java.home}/.." if:set="java.home" />
</path>
<!-- We also need this path as comma-separated list in a property. -->
<pathconvert property="builder.path.property" setonempty="false" pathsep="," unless:set="builder.path.property">
<path refid="builder.path.paths" />
</pathconvert>
<!-- We also try to define the class path. -->
<path id="builder.classpath" cache="true">
<pathelement path="${java.class.path}/" if:set="java.class.path" />
<pathelement path="${builder.env.CLASS_PATH}" if:set="builder.env.CLASS_PATH" />
</path>
<!-- 3. Detect Maven
The following steps will be taken to find the Maven installation.
3.1. The user can specify the path to Maven by supplying
the command line argument -Dmaven=PATH/TO/MAVEN
3.2. If no such path is supplied, we try to find a Maven
binary directly in one of the folders in the PATH.
3.3. If that does not work, we try to search the folders in
PATH recursively for a Maven binary.
3.4. If that does not work either, we assume that the
Maven command is simply 'mvn' and hope that this,
somehow, magically, works.
3.5. Only in case 2.4, builder.maven.searchPATH is set to 'true'.
Otherwise, i.e., if we have the full Maven path, it is set
to 'false'.
3.6. Setup builder.maven.home to the folder containing the
Maven executable, or MAVEN_HOME if builder.maven.searchPATH
is true.
-->
<!-- 3.1 User-supplied Maven Path -->
<property name="builder.maven.path" location="${maven}" if:set="maven" unless:set="builder.maven.path" />
<!-- 3.2. Find Maven executables in PATH -->
<pathconvert property="builder.maven.path" setonempty="false" unless:set="builder.maven.path" if:set="builder.path.property" if:true="${builder.isWindows}">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="mvn.cmd" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<pathconvert property="builder.maven.path" setonempty="false" unless:set="builder.maven.path" if:set="builder.path.property" if:true="${builder.isWindows}">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="mvn.bat" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<pathconvert property="builder.maven.path" setonempty="false" unless:set="builder.maven.path" if:set="builder.path.property" if:true="${builder.isWindows}">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="mvn.exe" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<pathconvert property="builder.maven.path" setonempty="false" unless:set="builder.maven.path" if:set="builder.path.property" unless:true="${builder.isWindows}">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="mvn" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<!-- 3.3. Find Maven recursively in PATH. Takes much runtime! -->
<pathconvert property="builder.maven.path" setonempty="false" unless:set="builder.maven.path" if:set="builder.path.property" if:true="${builder.isWindows}">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="**/mvn.cmd" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<pathconvert property="builder.maven.path" setonempty="false" unless:set="builder.maven.path" if:set="builder.path.property" if:true="${builder.isWindows}">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="**/mvn.bat" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<pathconvert property="builder.maven.path" setonempty="false" unless:set="builder.maven.path" if:set="builder.path.property" if:true="${builder.isWindows}">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="**/mvn.exe" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<pathconvert property="builder.maven.path" setonempty="false" unless:set="builder.maven.path" if:set="builder.path.property" unless:true="${builder.isWindows}">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="**/mvn" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<!-- 3.4. We give up and try 'mvn' and hope that it will somehow, magically, be found. -->
<property name="builder.maven.path" value="mvn" unless:set="builder.maven.path" />
<!-- 3.5. Should $PATH be searched for a maven installation?
This will be "true" if and only if builder.maven.path is not "mvn",
otherwise it is "false". -->
<condition property="builder.maven.searchPATH" value="true" unless:set="builder.maven.searchPATH">
<equals arg1="${builder.maven.path}" arg2="mvn" />
</condition>
<condition property="builder.maven.searchPATH" value="false" unless:set="builder.maven.searchPATH">
<not>
<equals arg1="${builder.maven.path}" arg2="mvn" />
</not>
</condition>
<!-- 3.6. Setup MAVEN_HOME. -->
<dirname property="builder.maven.home" file="${builder.maven.path}" unless:set="builder.maven.home" unless:true="${builder.maven.searchPATH}" />
<property name="builder.maven.home" location="${builder.env.MAVEN_HOME}" unless:set="builder.maven.home" if:set="builder.env.MAVEN_HOME" />
<!-- 4. Setup JAVA_HOME
4.1. The user can specify a JDK/JAVA_HOME to use via -Djdk=/PATH/TO/JDK.
4.2. If the environment has a JAVA_HOME variable, its value is used.
4.3. If that does not work, try to find tools.jar in CLASSPATH
4.4. If that does not work, try to find tools.jar in PATH
4.5. If that does not work, try to find tools.jar in PATH/lib
4.6. If that does not work, try to recursively find tools.jar in PATH
4.7. If either of 4.3 to 4.6 succeeds, we can deduce the path to
the JDK, i.e., JAVA_HOME
4.8. Otherwise, use java.home (which may point to a JRE instead of a
JDK.
Store the path in builder.java.home. -->
<!-- 4.1. Did the user specify the JDK as parameter? -->
<property name="builder.java.home" location="${jdk}" if:set="jdk" unless:set="builder.java.home" />
<!-- 4.2. Check if there is a JAVA_HOME -->
<property name="builder.java.home" location="${builder.env.JAVA_HOME}" if:set="builder.env.JAVA_HOME" unless:set="builder.java.home" />
<!-- 4.3. Try to find tools.jar in CLASSPATH
tools.jar is always in the lib folder of a JDK. If we can find
it, we also have a JDK. -->
<property name="builder.java.tools.jar" value="" if:set="builder.java.home" />
<pathconvert property="builder.java.tools.jar" setonempty="false" unless:set="builder.java.tools.jar">
<first>
<restrict>
<name name="**/tools.jar" />
<path refid="builder.classpath" />
</restrict>
</first>
</pathconvert>
<!-- 4.4. Try to find tools.jar in PATH -->
<pathconvert property="builder.java.tools.jar" setonempty="false" unless:set="builder.java.tools.jar" if:set="builder.path.property">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="tools.jar" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<!-- 4.5. Try to find tools.jar in PATH/lib -->
<pathconvert property="builder.java.tools.jar" setonempty="false" unless:set="builder.java.tools.jar" if:set="builder.path.property">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="/lib/tools.jar" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<!-- 4.6. Try to find tools.jar recursively in PATH -->
<pathconvert property="builder.java.tools.jar" setonempty="false" unless:set="builder.java.tools.jar" if:set="builder.path.property">
<first>
<multirootfileset basedirs="${builder.path.property}" erroronmissingdir="false">
<include name="**/tools.jar" />
<readable />
<type type="file" />
</multirootfileset>
</first>
</pathconvert>
<!-- 4.7. Deduce JAVA_HOME from tools.jar path
If we got tools.jar, then its path will be like /PATH/TO/JDK/lib/tools.jar
so we can deduce JAVA_HOME from it. -->
<dirname property="builder.java.lib" file="${builder.java.tools.jar}" if:set="builder.java.tools.jar" unless:blank="builder.java.tools.jar" unless:set="builder.java.home" />
<dirname property="builder.java.home" file="${builder.java.lib}" if:set="builder.java.lib" unless:set="builder.java.home" />
<!-- 4.8. If that did not work either, use java.home -->
<dirname property="builder.java.home" file="${java.home}" if:set="java.home" unless:set="builder.java.home" />
<!-- 5. Macro to Run Maven to build and install a project.
The attribute 'dir' identifies the folder in which the pom.xml is
located, i.e., the root folder of the project. Maven will be
invoked in that folder.
The attribute 'tests' is true only for the root project, the
root of the dependency tree. Only for this project, we will
actually execute tests and build JavaDoc. For all other projects,
i.e., the required dependencies, neither will we execute tests
nor will be build JavaDoc. -->
<macrodef name="mavenRun">
<attribute name="dir" />
<attribute name="tests" default="false" />
<sequential>
<exec executable="${builder.maven.path}" dir="@{dir}" searchpath="${builder.maven.searchPATH}" failonerror="true" failifexecutionfails="true">
<arg value="-Dmaven.javadoc.skip=true" unless:true="@{tests}" />
<arg value="-Dmaven.test.skip.exec=true" unless:true="@{tests}" />
<arg value="${builder.passToMaven}" if:set="builder.passToMaven" />
<arg value="--fail-at-end" />
<arg value="-B" />
<arg value="clean" />
<arg value="compile" />
<arg value="package" />
<arg value="test" if:true="@{tests}" />
<arg value="install" />
<env key="JAVA_HOME" value="${builder.java.home}" if:set="builder.java.home" />
<env key="ANT_HOME" value="${ant.home}" if:set="ant.home" />
<env key="MAVEN_HOME" value="${builder.maven.home}" if:set="builder.maven.home" />
</exec>
</sequential>
</macrodef>
<!-- 6. This macro edits a maven pom.xml file to remove useless plugins.
The maven-shade-plugin, for instance is used to build fat jars which
include all dependencies directly. Doing this makes only sense for the
main project and we can skip this step for all dependency projects. -->
<macrodef name="disableUselessDependencyPlugins">
<attribute name="dir" />
<sequential>
<echo unless:set="builder.disableUselessDependencyPlugins.xslt">The XSLT for trimming down the Maven pom.xml files of the dependencies has not yet been downloaded. I will do that now.</echo>
<tempfile unless:set="builder.disableUselessDependencyPlugins.xslt" destDir="${java.io.tmpdir}" property="@{dir}.builder.disableUselessDependencyPlugins.xslt" prefix="dependencyTrimmer" suffix=".xslt" />
<copy unless:set="builder.disableUselessDependencyPlugins.xslt" tofile="${@{dir}.builder.disableUselessDependencyPlugins.xslt}">
<resources>
<url url="https://raw.githubusercontent.com/optimizationBenchmarking/utils-build/master/dependencyMavenPomReducer.xslt" />
</resources>
</copy>
<echo unless:set="builder.disableUselessDependencyPlugins.xslt">Finished downloading the XSLT for trimming down the Maven pom.xml files of the dependencies to '${@{dir}.builder.disableUselessDependencyPlugins.xslt}'.</echo>
<property name="builder.disableUselessDependencyPlugins.xslt" location="${@{dir}.builder.disableUselessDependencyPlugins.xslt}" />
<property name="@{dir}.disableShade.pom.xml" location="@{dir}/pom.xml" />
<echo>Editing Maven pom ('${@{dir}.disableShade.pom.xml}') to improve speed of dependency building.</echo>
<tempfile property="@{dir}.disableShade.temp.file" destDir="${java.io.tmpdir}" prefix="pom" suffix=".xml" />
<xslt in="${@{dir}.disableShade.pom.xml}" out="${@{dir}.disableShade.temp.file}" style="${builder.disableUselessDependencyPlugins.xslt}" />
<move file="${@{dir}.disableShade.temp.file}" tofile="${@{dir}.disableShade.pom.xml}" overwrite="true" />
<echo>Finished editing Maven pom ('${@{dir}.disableShade.pom.xml}') for speeding up dependency builds.</echo>
</sequential>
</macrodef>
<!-- 7. Macro to download, build, and install dependencies
This internal macro downloads, builds, and installs a dependency from a
specified GitHub group and project. -->
<macrodef name="doDependency">
<attribute name="githubGroup" default="${builder.default.githubGroup}" />
<attribute name="githubProject" />
<sequential>
<echo>Beginning to build dependency @{githubGroup}:@{githubProject}.</echo>
<property name="@{githubGroup}-@{githubProject}-dir" location="${builder.temp.root}/dep-@{githubGroup}-@{githubProject}" />
<mkdir dir="${@{githubGroup}-@{githubProject}-dir}" />
<echo>Using folder "${@{githubGroup}-@{githubProject}-dir}" for dependency @{githubGroup}:@{githubProject}.</echo>
<property name="@{githubGroup}-@{githubProject}-archive" location="${@{githubGroup}-@{githubProject}-dir}/master.zip" />
<get src="https://codeload.github.com/@{githubGroup}/@{githubProject}/zip/master" dest="${@{githubGroup}-@{githubProject}-archive}" retries="5" />
<property name="@{githubGroup}-@{githubProject}-project" location="${@{githubGroup}-@{githubProject}-dir}/project" />
<mkdir dir="${@{githubGroup}-@{githubProject}-project}" />
<unzip src="${@{githubGroup}-@{githubProject}-archive}" dest="${@{githubGroup}-@{githubProject}-project}" />
<echo>Archive "${@{githubGroup}-@{githubProject}-archive}" has been unpacked into folder ${@{githubGroup}-@{githubProject}-project}.</echo>
<property name="@{githubGroup}-@{githubProject}-build" location="${@{githubGroup}-@{githubProject}-project}/@{githubProject}-master" />
<echo>The sources of the project should now be inside folder "${@{githubGroup}-@{githubProject}-build}".</echo>
<disableUselessDependencyPlugins dir="${@{githubGroup}-@{githubProject}-build}" />
<property name="@{githubGroup}-@{githubProject}-antFile" location="${@{githubGroup}-@{githubProject}-build}/build.xml" />
<available property="@{githubGroup}-@{githubProject}-antFileExists" file="${@{githubGroup}-@{githubProject}-antFile}" />
<echo message="Found file '${@{githubGroup}-@{githubProject}-antFile}', attempting recursive Ant build." if:true="${@{githubGroup}-@{githubProject}-antFileExists}" />
<echo message="Did not find file '${@{githubGroup}-@{githubProject}-antFile}', performing direct Maven build." unless:true="${@{githubGroup}-@{githubProject}-antFileExists}" />
<mavenRun dir="${@{githubGroup}-@{githubProject}-build}" tests="false" unless:true="${@{githubGroup}-@{githubProject}-antFileExists}" />
<subant target="build" if:true="${@{githubGroup}-@{githubProject}-antFileExists}">
<fileset dir="${@{githubGroup}-@{githubProject}-build}" includes="build.xml" />
<property name="builder.env" value="${builder.env}" />
<property name="builder.maven.path" value="${builder.maven.path}" />
<property name="builder.temp.root" value="${builder.temp.root}" />
<property name="builder.temp.done" value="${builder.temp.done}" />
<property name="builder.java.home" value="${builder.java.home}" if:set="builder.java.home" />
<property name="builder.maven.home" value="${builder.maven.home}" if:set="builder.maven.home" />
<property name="builder.isWindows" value="${builder.isWindows}" if:set="builder.isWindows" />
<property name="builder.passToMaven" value="${builder.passToMaven}" if:set="builder.passToMaven" />
<property name="builder.isRoot" value="false" />
<property name="builder.disableUselessDependencyPlugins.xslt" value="${builder.disableUselessDependencyPlugins.xslt}" if:set="builder.disableUselessDependencyPlugins.xslt" />
</subant>
<echo>Finished building dependency @{githubGroup}:@{githubProject}.</echo>
</sequential>
</macrodef>
<!-- 8. Macro which checks if we need to execute 'doDependency' for a given dependency.
This macro makes sure that a specified dependency has been built and
installed. It will invoke 'doDependency' if that has not yet been
done. -->
<macrodef name="dependency">
<attribute name="githubGroup" default="${builder.default.githubGroup}" />
<attribute name="githubProject" />
<sequential>
<available property="@{githubGroup}-@{githubProject}-done" value="true" file="${builder.temp.done}/@{githubGroup}-@{githubProject}.done" />
<touch file="${builder.temp.done}/@{githubGroup}-@{githubProject}.done" />
<doDependency githubGroup="@{githubGroup}" githubProject="@{githubProject}" unless:true="${@{githubGroup}-@{githubProject}-done}" />
<echo message="Dependency @{githubGroup}:@{githubProject} has already been built." if:true="${@{githubGroup}-@{githubProject}-done}" />
</sequential>
</macrodef>
<!-- 9. Macro to build and install a root project -->
<macrodef name="buildWithDependencies">
<attribute name="githubGroup" default="${builder.default.githubGroup}" />
<attribute name="githubProject" />
<element name="dependencies" optional="true" />
<sequential>
<echo>Beginning to build project @{githubGroup}:@{githubProject}.</echo>
<echo message="builder.isRoot set to ${builder.isRoot}." if:set="builder.isRoot" />
<echo message="builder.maven.path is set to '${builder.maven.path}'." if:true="${builder.isRoot}" />
<echo message="builder.java.home is set to '${builder.java.home}'." if:true="${builder.isRoot}" />
<echo message="ant.home is set to '${ant.home}'." if:true="${builder.isRoot}" />
<echo message="builder.performTests is set to '${builder.performTests}'." />
<echo message="skipTests is set to '${skipTests}'." if:set="skipTests" />
<echo message="Argument passed to Maven: '${builder.passToMaven}'." if:set="builder.passToMaven" />
<tempfile property="builder.temp.root" destDir="${java.io.tmpdir}" prefix="builder" if:true="${builder.isRoot}" />
<mkdir dir="${builder.temp.root}" if:true="${builder.isRoot}" />
<tempfile property="builder.temp.done" destDir="${builder.temp.root}" prefix="builder" if:true="${builder.isRoot}" />
<mkdir dir="${builder.temp.done}" if:true="${builder.isRoot}" />
<touch file="${builder.temp.done}/@{githubGroup}-@{githubProject}.done" />
<dependencies />
<mavenRun dir="${basedir}" tests="${builder.performTests}" />
<delete dir="${builder.temp.root}" deleteonexit="true" performGCOnFailedDelete="true" if:true="${builder.isRoot}" />
<delete file="${builder.disableUselessDependencyPlugins.xslt}" if:set="builder.disableUselessDependencyPlugins.xslt" if:true="${builder.isRoot}" />
<echo>Finished to building project @{githubGroup}:@{githubProject} with builder.isRoot set to ${builder.isRoot}.</echo>
</sequential>
</macrodef>
</project>