forked from apache/ant-ivyde
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
695 lines (617 loc) · 34.7 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
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
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
This build script expects two properties:
- version.qualifier : defines which version append to the version defined in the manifests.
It will probably be "alpha1", "beta4", "RC1" or even "patch-4".
- baseLocation : the full path to the SDK version of Eclipse in order to build the binary jars.
Properties could be set in the two files :
- build.properties : properties shared between developers, so under version control.
The version.qualifier property should be set there.
- local.build.properties : properties handled by developers, ignored by subversion.
The baseLocation property should be set there.
-->
<project name="ivyde" basedir="." default="build" xmlns:xooki="antlib:xooki" xmlns:ivy="antlib:org.apache.ivy.ant">
<property file="local.build.properties" />
<property file="build.properties" />
<property environment="env" />
<property name="work.dir" value="${basedir}/work" />
<property name="ivy.work.dir" value="${work.dir}/ivy" />
<property name="src.doc.dir" value="${basedir}/doc" />
<property name="dist.dir" value="${basedir}/dist" />
<property name="dist.work.dir" value="${work.dir}/dist" />
<property name="dist.work.doc.dir" value="${dist.work.dir}/doc" />
<property name="doc-eclipse.work.dir" value="${work.dir}/doc-eclipse" />
<property name="eclipse.work.dir" value="${work.dir}/eclipse" />
<property name="eclipse-doc.dir" value="${basedir}/org.apache.ivyde.eclipse/doc" />
<property name="checkstyle.src.dir" value="${basedir}/org.apache.ivyde.eclipse/src/etc/checkstyle" />
<property name="checkstyle.report.dir" value="${basedir}/checkstyle/report" />
<property name="checkstyle.lib" value="${basedir}/checkstyle/lib" />
<property name="rat.dir" value="${work.dir}/rat" />
<target name="init-ivy">
<property name="ivy.version" value="2.2.0-rc1"/>
<property name="ivy.jar.url" value="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"/>
<property name="ivy.jar.dir" value="${work.dir}"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<mkdir dir="${ivy.jar.dir}"/>
<get src="${ivy.jar.url}" dest="${ivy.jar.file}" usetimestamp="true"/>
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="/release" description="Make the build artifacts tagged with the release version">
<tstamp />
<condition property="forceContextQualifier" value="${DSTAMP}${TSTAMP}-RELEASE">
<length string="${version.qualifier}" trim="true" length="0" />
</condition>
<property name="forceContextQualifier" value="${version.qualifier}-${DSTAMP}${TSTAMP}-RELEASE" />
</target>
<target name="dist" depends="generate-eclipse-doc,build,package-binaries,package-sources,checksum" description="Build every artifacts for distribution" />
<target name="clean" description="Remove every build artifacts">
<delete dir="${work.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="check-baseLocation">
<fail message="An Eclipse install is needed to run the build. Set your Eclipse install dir in the 'baseLocation' property." unless="baseLocation" />
</target>
<target name="eclipse-startup-check" depends="check-baseLocation">
<condition property="eclipse.startup">
<available file="${baseLocation}/startup.jar" />
</condition>
</target>
<target name="eclipse-startup-classpath" depends="eclipse-startup-check" if="eclipse.startup">
<property name="eclipse.classpath" value="${baseLocation}/startup.jar" />
</target>
<target name="eclipse-launcher-classpath" depends="eclipse-startup-check" unless="eclipse.startup">
<!-- store path to newest launcher JAR in path id 'newest.equinox.launcher.path.id' -->
<path id="newest.equinox.launcher.path.id">
<first count="1">
<sort>
<fileset dir="${baseLocation}/plugins" includes="**/org.eclipse.equinox.launcher_*.jar" />
<!-- Seems the default order is oldest > newest so we must reverse it.
The 'reverse' and 'date' comparators are in the internal antlib
org.apache.tools.ant.types.resources.comparators.
-->
<reverse xmlns="antlib:org.apache.tools.ant.types.resources.comparators">
<!-- 'date' inherits 'reverse's namespace -->
<date />
</reverse>
</sort>
</first>
</path>
<!-- turn the path into a property -->
<property name="eclipse.classpath" refid="newest.equinox.launcher.path.id" />
</target>
<target name="eclipse-classpath" depends="eclipse-startup-classpath,eclipse-launcher-classpath">
<echo message="Using equinox launcher jar: ${eclipse.classpath}" />
</target>
<target name="compute-version">
<tstamp />
<condition property="forceContextQualifier" value="${DSTAMP}${TSTAMP}-dev">
<length string="${version.qualifier}" trim="true" length="0" />
</condition>
<property name="forceContextQualifier" value="${version.qualifier}-${DSTAMP}${TSTAMP}-dev" />
<loadfile srcfile="org.apache.ivyde.eclipse/META-INF/MANIFEST.MF" property="build.version">
<filterchain>
<linecontainsregexp>
<regexp pattern="Bundle-Version:.*" />
</linecontainsregexp>
<replaceregex pattern="Bundle-Version: (.*)qualifier" replace="\1${forceContextQualifier}" />
<striplinebreaks />
</filterchain>
</loadfile>
<echo message="Building version ${build.version}" />
</target>
<!--
======================================================================================
Build targets
======================================================================================
-->
<target name="build" depends="check-ivy-installed,eclipse-classpath,compute-version" description="Build the plugin distribution binaries">
<java classpath="${eclipse.classpath}" classname="org.eclipse.core.launcher.Main" fork="true" failonerror="true">
<arg value="-clean" />
<arg line="-application org.eclipse.pde.build.Build" />
<sysproperty key="eclipse.consoleLog" value="${eclipse.consoleLog}" />
<sysproperty key="baseLocation" value="${baseLocation}" />
<sysproperty key="builder" path="${basedir}/builder/component" />
<sysproperty key="mapsPath" path="${basedir}/builder/maps" />
<sysproperty key="buildDirectory" path="${eclipse.work.dir}" />
<sysproperty key="DSTAMP" value="${DSTAMP}" />
<sysproperty key="TSTAMP" value="${TSTAMP}" />
<sysproperty key="forceContextQualifier" value="${forceContextQualifier}" />
<sysproperty key="outputUpdateJars" value="true" />
<sysproperty key="build.version" value="${build.version}" />
<sysproperty key="javacDebugInfo" value="true" />
</java>
</target>
<target name="generate-dist-doc-files">
<property name="checkUpToDate" value="true" />
<condition property="overwrite">
<isfalse value="${checkUpToDate}" />
</condition>
<mkdir dir="${dist.work.dir}/apache-ivyde-${build.version}/doc" />
<copy todir="${dist.work.dir}/apache-ivyde-${build.version}/doc" overwrite="${overwrite}">
<fileset dir="${src.doc.dir}">
<include name="style/**" />
<include name="js/**" />
<include name="images/**" />
</fileset>
</copy>
</target>
<target name="generate-dist-doc-html" unless="skip.doc">
<taskdef uri="antlib:xooki" file="${basedir}/doc/xooki/antlib.xml" />
<property name="checkUpToDate" value="true" />
<mkdir dir="${dist.work.dir}/apache-ivyde-${build.version}/doc" />
<xooki:generate destDir="${dist.work.dir}/apache-ivyde-${build.version}/doc" checkUpToDate="${checkUpToDate}" xookidir="${basedir}/doc/xooki">
<fileset dir="${src.doc.dir}">
<include name="**/*.html" />
<exclude name="template*.html" />
<exclude name="**/xooki/**" />
<exclude name="screenshot-projects/**" />
<exclude name="sample/**" />
</fileset>
</xooki:generate>
</target>
<target name="package-binaries" depends="build,generate-p2-category,generate-dist-doc-files,generate-dist-doc-html">
<mkdir dir="${dist.work.dir}/apache-ivyde-${build.version}" />
<unzip src="${eclipse.work.dir}/${build.version}/org.apache.ivyde.feature-${build.version}.zip" dest="${dist.work.dir}/apache-ivyde-${build.version}" />
<unzip src="${eclipse.work.dir}/${build.version}/org.apache.ivyde.eclipse.resolvevisualizer.feature-${build.version}.zip" dest="${dist.work.dir}/apache-ivyde-${build.version}" />
<!-- packaging the zip as a p2 repository -->
<copy todir="${dist.work.dir}/apache-ivyde-${build.version}">
<fileset dir="${eclipse.work.dir}/p2repo" />
</copy>
<copy todir="${dist.work.dir}/apache-ivyde-${build.version}">
<fileset dir="${basedir}">
<include name="LICENSE" />
<include name="NOTICE" />
<include name="CHANGES.txt" />
<include name="README.txt" />
</fileset>
</copy>
<mkdir dir="${dist.dir}" />
<zip destfile="${dist.dir}/apache-ivyde-${build.version}.zip" basedir="${dist.work.dir}" />
<tar destfile="${dist.dir}/apache-ivyde-${build.version}.tar.gz" basedir="${dist.work.dir}" compression="gzip" />
<!-- put the version in a file so it will be easier in the build of the
updatesite on hudson to find out which version it is -->
<echo file="${dist.dir}/version.properties">
ivyde.build.version=${build.version}
</echo>
</target>
<target name="package-sources" depends="compute-version">
<exec executable="svn" dir="${basedir}" outputproperty="svn.info.url">
<arg value="--xml" />
<arg value="info" />
<redirector>
<outputfilterchain>
<containsregex pattern="<url>(.*)</url>" replace="\1" />
</outputfilterchain>
</redirector>
</exec>
<delete dir="${work.dir}/sources" />
<mkdir dir="${work.dir}/sources" />
<exec executable="svn" dir="${work.dir}/sources" >
<arg value="export" />
<arg value="${svn.info.url}" />
<arg value="apache-ivyde-sources-${build.version}" />
</exec>
<mkdir dir="${dist.dir}" />
<zip destfile="${dist.dir}/apache-ivyde-sources-${build.version}.zip" basedir="${work.dir}/sources" />
<tar destfile="${dist.dir}/apache-ivyde-sources-${build.version}.tar.gz" basedir="${work.dir}/sources" compression="gzip" />
</target>
<target name="generate-p2-category" depends="compute-version,eclipse-classpath">
<loadfile property="ASL2-header" srcFile="${basedir}/builder/ASL2-header.xml"/>
<echo file="${work.dir}/category.xml"><![CDATA[<?xml version='1.0' encoding='UTF-8'?>
<site>
<category-def name="org.apache.ivyde.category" label="Apache IvyDE Eclipse plugins" />
<feature url="features/org.apache.ivyde.feature_${build.version}.jar" id="org.apache.ivyde.feature" version="${build.version}">
<category name="org.apache.ivyde.category"/>
</feature>
<feature url="features/org.apache.ivyde.eclipse.resolvevisualizer.feature_${build.version}.jar" id="org.apache.ivyde.eclipse.resolvevisualizer.feature" version="${build.version}">
<category name="org.apache.ivyde.category"/>
</feature>
</site>
]]></echo>
<makeurl file="${eclipse.work.dir}/p2repo" property="p2repo.eclipse.work.dir.url"/>
<makeurl file="${work.dir}/category.xml" property="p2repo.category.url"/>
<java classpath="${eclipse.classpath}" classname="org.eclipse.core.launcher.Main" fork="true" failonerror="true">
<arg line="-clean" />
<arg line="-application org.eclipse.equinox.p2.publisher.CategoryPublisher" />
<arg line="-metadataRepository ${p2repo.eclipse.work.dir.url}" />
<arg line="-categoryDefinition ${p2repo.category.url}" />
<arg line="-categoryQualifier" />
<sysproperty key="eclipse.consoleLog" value="${eclipse.consoleLog}" />
</java>
<!-- as we're at it, let's put the ASL header -->
<replaceregexp match="<repository name='" replace="${ASL2-header}<repository name='" flags="g">
<fileset dir="${eclipse.work.dir}/p2repo" includes="*.xml" />
</replaceregexp>
</target>
<!--
======================================================================================
Targets related to the installation of Ivy in the Eclipse install
======================================================================================
-->
<!-- Get the OSGi version of Ivy in the manifest in the jar -->
<target name="compute-ivy-bundle-version" unless="ivy.bundle.version">
<mkdir dir="${ivy.work.dir}/jar" />
<get src="${ivy.jar.url}" dest="${ivy.work.dir}/ivy.jar" />
<unzip overwrite="true" src="${ivy.work.dir}/ivy.jar" dest="${ivy.work.dir}/jar" />
<loadfile property="ivy.bundle.version" srcFile="${ivy.work.dir}/jar/META-INF/MANIFEST.MF">
<filterchain>
<linecontains>
<contains value="Bundle-Version:" />
</linecontains>
<tokenfilter>
<replaceregex pattern="Bundle-Version: (.*)" replace="\1" flags="gi" />
</tokenfilter>
<striplinebreaks />
</filterchain>
</loadfile>
</target>
<!-- clean up every installed ivy and install the specified one -->
<target name="install-ivy-jar" depends="compute-ivy-bundle-version">
<delete>
<fileset dir="${baseLocation}/plugins/" includes="org.apache.ivy_*.jar" />
</delete>
<get src="${ivy.jar.url}" dest="${baseLocation}/plugins/org.apache.ivy_${ivy.bundle.version}.jar" />
<echo message="Ivy ${ivy.bundle.version} has been installed in ${baseLocation}" />
</target>
<!-- Get the Ivy jar from a zip distribution -->
<target name="get-ivy-jar" unless="ivy.jar.url">
<fail>
You have to specify the Ivy to install with one of the following property:
- 'ivy.version': the version of the official Apache release to download (ex: -Divy.version=2.0.0-rc1) (older than 2.0.0-rc1 is not supported)
- 'ivy.zip.url': the url of the zip distribution (ex: -Divy.zip.url=file:///home/me/ivy-trunk/build/distrib/apache-ivy-2.0.0-rc1-local-20080926154508-bin.zip)
- 'ivy.jar.url': the url of the Ivy jar (ex: -Divy.jar.url=file:///home/me/ivy-trunk/build/artifact/jars/ivy.jar)
<condition>
<not>
<or>
<isset property="ivy.version" />
<isset property="ivy.zip.url" />
</or>
</not>
</condition>
</fail>
<mkdir dir="${ivy.work.dir}/distrib" />
<property name="ivy.zip.url" value="${mirror.url}/ant/ivy/${ivy.version}/apache-ivy-${ivy.version}-bin.zip" />
<get src="${ivy.zip.url}" usetimestamp="true" dest="${basedir}/dependencies/apache-ivy-${ivy.version}-bin.zip" verbose="true" />
<unzip overwrite="true" src="${basedir}/dependencies/apache-ivy-${ivy.version}-bin.zip" dest="${ivy.work.dir}/distrib" />
<path id="ivy.jar.path">
<first count="1">
<fileset dir="${ivy.work.dir}" includes="distrib/apache-ivy-*/ivy-*.jar" />
</first>
</path>
<makeurl property="ivy.jar.url" file="${toString:ivy.jar.path}" />
<echo message="${ivy.jar.url}" />
</target>
<target name="install-ivy" depends="check-baseLocation,get-ivy-jar,install-ivy-jar" description="Install an Ivy bundle into the eclipse install">
<delete dir="${ivy.work.dir}" />
</target>
<target name="list-installed-ivy" depends="check-baseLocation" description="List the Ivy bundle(s) in your Eclipse install">
<path id="ivy.eclipse.paths">
<fileset dir="${baseLocation}/plugins" includes="org.apache.ivy_*.jar" />
</path>
<condition property="ivy.installed">
<resourcecount refid="ivy.eclipse.paths" when="greater" count="0" />
</condition>
<echo message="The Ivy installed in ${baseLocation}: ${toString:ivy.eclipse.paths}" />
</target>
<target name="check-ivy-installed" depends="list-installed-ivy">
<fail message="No Ivy is installed. Please run 'ant install-ivy first'." unless="ivy.installed" />
</target>
<!--
======================================================================================
Targets related to the installation of IvyDE in the Eclipse install
======================================================================================
-->
<target name="clean-installed-ivyde" description="Remove every IvyDE version installed in Eclipse">
<delete>
<fileset dir="${baseLocation}/plugins/" includes="org.apache.ivyde*.jar" />
<fileset dir="${baseLocation}/features/" includes="org.apache.ivyde*.jar" />
</delete>
</target>
<target name="list-installed-ivyde" depends="check-baseLocation" description="List the IvyDE plugin(s) in your Eclipse install">
<path id="ivyde.eclipse.paths">
<fileset dir="${baseLocation}/plugins" includes="org.apache.ivyde*.jar" />
</path>
<echo message="The IvyDE installed in ${baseLocation}: ${toString:ivyde.eclipse.paths}" />
</target>
<target name="install" depends="dist,clean-installed-ivyde" description="Install the IvyDE bundle into the eclipse install">
<unzip src="${dist.dir}/org.apache.ivyde.feature-${build.version}.zip" dest="${baseLocation}" />
</target>
<!--
======================================================================================
Targets related to the checksums of the distribution
======================================================================================
-->
<target name="checksum" description="Compute the checksum for every artifact to distribute">
<checksum algorithm="MD5" fileext=".md5" format="MD5SUM">
<fileset dir="${dist.dir}">
<include name="apache-ivyde-*.zip" />
<include name="apache-ivyde-*.tar.gz" />
</fileset>
</checksum>
<checksum algorithm="SHA" fileext=".sha" format="MD5SUM">
<fileset dir="${dist.dir}">
<include name="apache-ivyde-*.zip" />
<include name="apache-ivyde-*.tar.gz" />
</fileset>
</checksum>
</target>
<target name="verify-checksum" description="Verify the checksums of the artifacts to publish">
<checksum algorithm="MD5" fileext=".md5" format="MD5SUM" verifyproperty="checksum.md5.ok">
<fileset dir="${dist.dir}">
<include name="apache-ivyde-*.zip" />
<include name="apache-ivyde-*.tar.gz" />
</fileset>
</checksum>
<fail message="MD5 Checksum verify failed !">
<condition>
<isfalse value="${checksum.md5.ok}" />
</condition>
</fail>
<echo message="MD5 Checksum verify passed successfully" />
<checksum algorithm="SHA" fileext=".sha" format="MD5SUM" verifyproperty="checksum.sha.ok">
<fileset dir="${dist.dir}">
<include name="apache-ivyde-*.zip" />
<include name="apache-ivyde-*.tar.gz" />
</fileset>
</checksum>
<fail message="SHA Checksum verify failed !">
<condition>
<isfalse value="${checksum.sha.ok}" />
</condition>
</fail>
<echo message="SHA Checksum verify passed successfully" />
</target>
<!--
======================================================================================
Targets related to checkstyle
======================================================================================
-->
<target name="checkstyle" depends="init-ivy" description="Generate checkstyle report">
<ivy:cachepath organisation="checkstyle" module="checkstyle" revision="5.0"
inline="true" conf="default" pathid="checkstyle.classpath" transitive="true" />
<taskdef resource="checkstyletask.properties" classpathref="checkstyle.classpath" />
<mkdir dir="${checkstyle.report.dir}" />
<checkstyle config="${checkstyle.src.dir}/checkstyle-config" failOnViolation="false" failureProperty="checkstyle.failed">
<classpath>
<path refid="checkstyle.classpath" />
</classpath>
<formatter type="xml" toFile="${checkstyle.report.dir}/checkstyle.xml" />
<fileset dir="org.apache.ivyde.eclipse/src/java">
<include name="**/*.java" />
</fileset>
</checkstyle>
</target>
<!--
======================================================================================
Targets related to prepare the build environment of IvyDE on hudson.
======================================================================================
-->
<target name="hudson-prepare" depends="hudson-prepare-eclipse,hudson-prepare-properties,hudson-install-ivy" />
<target name="hudson-prepare-eclipse" depends="hudson-get-eclipse,hudson-unzip-eclipse" />
<target name="hudson-check-download-sdk">
<check-eclipse-download name="${hudson.download.sdk.name}" property="hudson.sdk.downloaded" md5="${hudson.download.sdk.md5}" />
</target>
<target name="hudson-get-sdk" depends="hudson-check-download-sdk" unless="hudson.sdk.downloaded">
<eclipse-download name="${hudson.download.sdk.name}" dropdir="${hudson.download.sdk.dropdir}" />
</target>
<target name="hudson-check-download-wtp">
<check-eclipse-download name="${hudson.download.wtp.name}" property="hudson.wtp.downloaded" md5="${hudson.download.wtp.md5}" />
</target>
<target name="hudson-get-wtp" depends="hudson-check-download-wtp" unless="hudson.wtp.downloaded">
<eclipse-download name="${hudson.download.wtp.name}" dropdir="${hudson.download.wtp.dropdir}" />
</target>
<target name="hudson-check-download-emf">
<check-eclipse-download name="${hudson.download.emf.name}" property="hudson.emf.downloaded" md5="${hudson.download.emf.md5}" />
</target>
<target name="hudson-get-emf" depends="hudson-check-download-emf" unless="hudson.emf.downloaded">
<eclipse-download name="${hudson.download.emf.name}" dropdir="${hudson.download.emf.dropdir}" />
</target>
<target name="hudson-check-download-xsd">
<check-eclipse-download name="${hudson.download.xsd.name}" property="hudson.xsd.downloaded" md5="${hudson.download.xsd.md5}" />
</target>
<target name="hudson-get-xsd" depends="hudson-check-download-xsd" unless="hudson.xsd.downloaded">
<eclipse-download name="${hudson.download.xsd.name}" dropdir="${hudson.download.xsd.dropdir}" />
</target>
<target name="hudson-check-download-gef">
<check-eclipse-download name="${hudson.download.gef.name}" property="hudson.gef.downloaded" md5="${hudson.download.gef.md5}" />
</target>
<target name="hudson-get-gef" depends="hudson-check-download-gef" unless="hudson.gef.downloaded">
<eclipse-download name="${hudson.download.gef.name}" dropdir="${hudson.download.gef.dropdir}" />
</target>
<target name="hudson-check-download-zest">
<check-eclipse-download name="${hudson.download.zest.name}" property="hudson.zest.downloaded" md5="${hudson.download.zest.md5}" />
</target>
<target name="hudson-get-zest" depends="hudson-check-download-zest" unless="hudson.zest.downloaded">
<eclipse-download name="${hudson.download.zest.name}" dropdir="${hudson.download.zest.dropdir}" />
</target>
<target name="hudson-get-eclipse" depends="hudson-get-sdk,hudson-get-wtp,hudson-get-emf,hudson-get-xsd,hudson-get-gef,hudson-get-zest" />
<!-- wrapper of eclipse download urls which have a common pattern -->
<macrodef name="check-eclipse-download">
<attribute name="property" />
<attribute name="name" />
<attribute name="md5" />
<sequential>
<echo file="${basedir}/dependencies/@{name}.zip.md5" message="@{md5}" />
<condition property="@{property}">
<and>
<available file="${basedir}/dependencies/@{name}.zip" />
<checksum file="${basedir}/dependencies/@{name}.zip" algorithm="MD5" />
</and>
</condition>
</sequential>
</macrodef>
<macrodef name="eclipse-download">
<attribute name="name" />
<attribute name="dropdir" />
<sequential>
<mkdir dir="${basedir}/dependencies" />
<delete file="${basedir}/dependencies/@{name}.zip" failonerror="false" />
<get src="${hudson.download.baseurl}?file=/@{dropdir}/@{name}.zip&url=${hudson.download.mirror.url}/@{dropdir}/@{name}.zip&mirror_id=${hudson.download.mirror.id}" dest="${basedir}/dependencies/@{name}.zip" verbose="yes" />
<checksum file="${basedir}/dependencies/@{name}.zip" algorithm="MD5" />
</sequential>
</macrodef>
<target name="hudson-check-unzip-eclipse">
<condition property="hudson.eclipse.unzipped">
<available file="${basedir}/dependencies/${hudson.download.sdk.name}" />
</condition>
</target>
<target name="hudson-unzip-eclipse" depends="hudson-check-unzip-eclipse" unless="hudson.eclipse.unzipped">
<delete dir="${basedir}/dependencies/eclipse" failonerror="false" />
<delete dir="${basedir}/dependencies/${hudson.download.sdk.name}" failonerror="false" />
<unzip src="${basedir}/dependencies/${hudson.download.sdk.name}.zip" dest="${basedir}/dependencies/" />
<unzip src="${basedir}/dependencies/${hudson.download.wtp.name}.zip" dest="${basedir}/dependencies/" />
<unzip src="${basedir}/dependencies/${hudson.download.emf.name}.zip" dest="${basedir}/dependencies/" />
<unzip src="${basedir}/dependencies/${hudson.download.xsd.name}.zip" dest="${basedir}/dependencies/" />
<unzip src="${basedir}/dependencies/${hudson.download.gef.name}.zip" dest="${basedir}/dependencies/" />
<unzip src="${basedir}/dependencies/${hudson.download.zest.name}.zip" dest="${basedir}/dependencies/" />
<move file="${basedir}/dependencies/eclipse" tofile="${basedir}/dependencies/${hudson.download.sdk.name}" />
</target>
<target name="hudson-prepare-properties">
<tstamp />
<property name="baseLocation" value="${basedir}/dependencies/${hudson.eclipse.name}" />
<condition property="hudson.version.qualifier" value="${DSTAMP}${TSTAMP}-hudson-${env.BUILD_NUMBER}">
<length string="${version.qualifier}" trim="true" length="0" />
</condition>
<property name="hudson.version.qualifier" value="${version.qualifier}-${DSTAMP}${TSTAMP}-hudson-${env.BUILD_NUMBER}" />
<echo file="local.build.properties">
baseLocation=${basedir}/dependencies/${hudson.download.sdk.name}
forceContextQualifier=${hudson.version.qualifier}
</echo>
</target>
<target name="hudson-install-ivy-jar" if="hudson.ivy.jar.url">
<ant antfile="build.xml" target="install-ivy">
<property name="ivy.jar.url" value="${hudson.ivy.jar.url}" />
<property name="baseLocation" location="${basedir}/dependencies/${hudson.download.sdk.name}" />
</ant>
</target>
<target name="hudson-install-ivy-release" unless="hudson.ivy.jar.url">
<ant antfile="build.xml" target="install-ivy">
<property name="ivy.version" value="${hudson.ivy.version}" />
<property name="baseLocation" location="${basedir}/dependencies/${hudson.download.sdk.name}" />
</ant>
</target>
<target name="hudson-install-ivy" depends="hudson-install-ivy-jar,hudson-install-ivy-release" />
<!--
======================================================================================
Targets related to the generation of the documentation included in the eclipse plugin
======================================================================================
-->
<target name="generate-eclipse-doc" depends="clean-eclipse-doc,generate-sample-zip,generate-eclipse-doc-html,generate-eclipse-doc-files,generate-eclipse-toc">
</target>
<target name="clean-eclipse-doc">
<delete dir="${doc-eclipse.work.dir}" />
<delete dir="${eclipse-doc.dir}" />
</target>
<target name="generate-sample-zip">
<zip destfile="${src.doc.dir}/sample/webapp-js-repo.zip" basedir="${src.doc.dir}/sample/webapp-js-repo" />
</target>
<target name="generate-eclipse-doc-html" unless="skip.doc">
<taskdef uri="antlib:xooki" file="${basedir}/doc/xooki/antlib.xml" />
<copy todir="${doc-eclipse.work.dir}">
<fileset dir="${src.doc.dir}" />
</copy>
<copy file="${src.doc.dir}/template-eclipse.html" tofile="${doc-eclipse.work.dir}/template.html" overwrite="true" />
<property name="checkUpToDate" value="true" />
<xooki:generate destDir="${eclipse-doc.dir}" checkUpToDate="${checkUpToDate}" xookidir="${basedir}/doc/xooki">
<fileset dir="${doc-eclipse.work.dir}">
<include name="**/*.html" />
<exclude name="template*.html" />
<exclude name="**/xooki/**" />
<exclude name="screenshot-projects/**" />
<exclude name="sample/**" />
</fileset>
</xooki:generate>
</target>
<target name="generate-eclipse-doc-files">
<property name="checkUpToDate" value="true" />
<condition property="overwrite">
<isfalse value="${checkUpToDate}" />
</condition>
<copy todir="${eclipse-doc.dir}" overwrite="${overwrite}">
<fileset dir="${src.doc.dir}">
<include name="style/**" />
<include name="js/**" />
<include name="images/**" />
</fileset>
</copy>
</target>
<target name="generate-eclipse-toc">
<scriptdef name="generate-eclipse-toc" language="javascript">
<attribute name="jsontocfile" />
<attribute name="destFile" />
<![CDATA[
importPackage(java.io);
var tocfile = self.getProject().resolveFile(attributes.get("jsontocfile"))
r = new BufferedReader(new FileReader(tocfile));
var val = "";
while((s = r.readLine()) != null) {
val += s;
}
r.close();
var toc = eval("("+val+")")
var writeTopic = function(o, children, indent) {
for(var c in children) {
o.write(indent + '<topic label="' + children[c].title + '" href="doc/' + children[c].id + '.html">\n');
if (children[c].children && children[c].children.length && children[c].children.length != 0) {
writeTopic(o, children[c].children, indent+' ');
}
o.write(indent+'</topic>\n');
}
};
out = new FileWriter(self.getProject().resolveFile(attributes.get("destfile")));
out.write('<toc label="IvyDE user documentation">\n')
writeTopic(out, toc.children[0].children, ' ');
out.write('</toc>\n');
out.close();
]]>
</scriptdef>
<generate-eclipse-toc jsontocfile="${src.doc.dir}/toc.json" destFile="${eclipse-doc.dir}/toc.xml" />
</target>
<!--
======================================================================================
Targets related to the RAT reports
======================================================================================
-->
<!-- RAT Release Auditing Tool -->
<property name="rat.version" value="0.7" description="Which Version of RAT to use"/>
<target name="rat" description="--> Runs the ReleaseAuditingTool" depends="init-ivy">
<ivy:cachepath organisation="org.apache.rat" module="apache-rat-tasks" revision="${rat.version}"
inline="true" conf="default" pathid="rat.classpath" transitive="true"/>
<typedef resource="org/apache/rat/anttasks/antlib.xml"
uri="antlib:org.apache.rat.anttasks"
classpathref="rat.classpath"/>
<delete dir="${rat.dir}"/>
<mkdir dir="${rat.dir}"/>
<property file="${dist.dir}/version.properties" />
<rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportfile="${rat.dir}/report.txt">
<tarfileset>
<gzipresource>
<file file="${dist.dir}/apache-ivyde-${ivyde.build.version}.tar.gz"/>
</gzipresource>
</tarfileset>
<tarfileset>
<gzipresource>
<file file="${dist.dir}/apache-ivyde-sources-${ivyde.build.version}.tar.gz"/>
</gzipresource>
</tarfileset>
</rat:report>
</target>
</project>