forked from groovy/groovy-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
962 lines (853 loc) · 43.8 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
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
<?xml version="1.0" encoding="UTF-8"?>
<!--
Ant build script for Groovy.
Licensed 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 work is copyright by the author(s) and is part of a greater work collectively copyright by Codehaus on
behalf of the Groovy community. See the NOTICE.txt file distributed with this work for additional information.
Author : Russel Winder
Author : Paul King
$Revision$ ($LastChangedBy$)
$Date$
-->
<project name="Groovy" default="createJars" basedir=".">
<property file="local.build.properties"/>
<property file="build.properties"/>
<property name="ant.requiredVersion" value="1.6.5"/>
<!-- config/ant/build-maven.xml imports config/ant/build-setup.xml where all the paths are defined. -->
<import file="config/ant/build-maven.xml"/>
<import file="config/ant/build-checkstyle.xml"/>
<import file="config/ant/build-cobertura.xml"/>
<condition property="_skipTests_">
<or>
<equals arg1="${test}" arg2="false"/>
<istrue value="${skipTests}"/>
</or>
</condition>
<condition property="_skipExamples_">
<istrue value="${skipExamples}"/>
</condition>
<condition property="_skipDocs_">
<istrue value="${skipDocs}"/>
</condition>
<condition property="_skipOsgi_">
<istrue value="${skipOsgi}"/>
</condition>
<condition property="_skipFetch_">
<istrue value="${skipFetch}"/>
</condition>
<condition property="_skipEmbeddable_">
<istrue value="${skipEmbeddable}"/>
</condition>
<condition property="_forceServerSettings_">
<istrue value="${forceServerSettings}"/>
</condition>
<condition property="groovy.build.vm4">
<contains string="${ant.java.version}" substring="1.4"/>
</condition>
<condition property="groovy.build.vm6">
<contains string="${ant.java.version}" substring="1.6"/>
</condition>
<presetdef name="javac">
<javac memoryMaximumSize="500m"/>
</presetdef>
<target name="-initCoverage">
<condition property="_forceCoverage_">
<and>
<not>
<istrue value="${skipTests}"/>
</not>
<istrue value="${forceCoverage}"/>
</and>
</condition>
</target>
<target name="ensureGrammars" description="Ensure all the Antlr generated files are up to date.">
<mkdir dir="${groovyParserDirectory}"/>
<antlr target="${antlrDirectory}/groovy.g" outputdirectory="${groovyParserDirectory}">
<classpath refid="compilePath"/>
</antlr>
<antlr target="${javaParserDirectory}/java.g" outputdirectory="${javaParserDirectory}">
<classpath refid="compilePath"/>
</antlr>
</target>
<target name="-init" depends="-fetchDependencies"/>
<target name="-banner">
<echo message="Java Runtime Environment version: ${java.version}"/>
<echo message="Java Runtime Environment vendor: ${java.vendor}"/>
<echo message="Ant version: ${ant.version}"/>
<echo message="Operating system name: ${os.name}"/>
<echo message="Operating system architecture: ${os.arch}"/>
<echo message="Operating system version: ${os.version}"/>
<echo message="Base directory: ${basedir}"/>
<echo message="Java Home: ${java.home}"/>
</target>
<target name="-jvm14BuildWarning" if="groovy.build.vm4">
<fail>Aborting!
================================================
ERROR: You must build Groovy with a 1.5+ JDK
================================================
</fail>
</target>
<target name="-checkAntVersion" depends="-excludeLegacyAntVersion"
description="Check that we are running on the required version of Ant."/>
<target name="-excludeLegacyAntVersion">
<!-- antversion didn't exist in early versions of ant so we have
a legacy check to provide a nicer error message in this case -->
<fail message="You are using ant ${ant.version}, please build using ant ${ant.requiredVersion}+">
<condition>
<or>
<contains string="${ant.version}" substring="1.1"></contains>
<contains string="${ant.version}" substring="1.2"></contains>
<contains string="${ant.version}" substring="1.3"></contains>
<contains string="${ant.version}" substring="1.4"></contains>
<contains string="${ant.version}" substring="1.5"></contains>
<and>
<contains string="${ant.version}" substring="1.6"></contains>
<not>
<contains string="${ant.version}" substring="${ant.requiredVersion}"></contains>
</not>
</and>
</or>
</condition>
</fail>
</target>
<!-- add back in if we make 1.7+ minimal required version for build again
<target name="-ensureRequiredAntVersion">
<fail message="You are using ant ${ant.version}, please install using ant ${ant.requiredVersion}+"/>
<condition><not><antversion atleast="${ant.requiredVersion}"/></not></condition>
</fail>
</target>
-->
<target name="compileMain" depends="stagedcompile"
description="Compile the Java and Groovy code in the main source.">
</target>
<target name="stagedcompile" depends="-init,ensureGrammars,-jvm14BuildWarning" unless="uber">
<mkdir dir="${mainClassesDirectory}"/>
<mkdir dir="${toolsClassesDirectory}"/>
<mkdir dir="${mainClassesDirectory}/META-INF"/>
<javac srcdir="${mainSourcePath}" includeantruntime="false" destdir="${mainClassesDirectory}"
deprecation="on" debug="yes" source="1.5" target="1.5" fork="true" classpathref="compilePath">
<exclude name="groovy/ui/**/*.java"/>
</javac>
<java classname="org.codehaus.groovy.tools.DgmConverter" fork="yes" failonerror="true">
<classpath>
<pathelement path="${mainClassesDirectory}"/>
<path refid="compilePath"/>
</classpath>
<arg line="--info"/>
</java>
<antcall inheritrefs="true" target="-stagedcompile-groovy"/>
<antcall target="-includeResources"/>
</target>
<target name="-stagedcompile-groovy" depends="-initGroovyc">
<groovyc srcdir="${mainSourcePath}" destdir="${mainClassesDirectory}"
fork="true" stacktrace="true"
memorymaximumsize="${groovycMain_mx}">
<classpath>
<pathelement path="${mainClassesDirectory}"/>
<path refid="compilePath"/>
</classpath>
<javac deprecation="on" debug="yes" source="1.5" target="1.5"/>
</groovyc>
</target>
<property name="vm5GroovySourceFiles" value="**/*.groovy"/>
<property name="vm5JavaSourceFiles" value="**/*.java"/>
<property name="anotherGroovyExtTestFiles" value="**/*.foogroovy"/>
<property name="vm6GroovySourceFiles" value="groovy/**/vm6/*Test.groovy,org/codehaus/groovy/**/vm6/*Test.groovy"/>
<target name="-initGroovyc">
<path id="groovyMainClasses">
<pathelement path="${mainClassesDirectory}"/>
<path refid="compilePath"/>
</path>
<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="groovyMainClasses"/>
</target>
<target name="compileTest" depends="compileMain,compileTestOnly"
description="Compile the Java and Groovy code in the test source."/>
<target name="-cleanTest">
<delete dir="${testClassesDirectory}"/>
</target>
<target name="compileTestOnly" unless="_skipTests_">
<mkdir dir="${testClassesDirectory}"/>
<antcall inheritrefs="true" target="-compileTest"/>
</target>
<target name="-compileTest" depends="-initGroovyc,-compileTest_vm6">
<copy todir="${testClassesDirectory}">
<fileset dir="${testSourceDirectory}">
<include name="META-INF/services/*"/>
<include name="**/*.html"/><!-- includes groovydoc templates -->
</fileset>
</copy>
<groovyc srcdir="${testSourcePath}"
destdir="${testClassesDirectory}"
includes="${vm5GroovySourceFiles},${vm5JavaSourceFiles},${anotherGroovyExtTestFiles}"
excludes="${vm6GroovySourceFiles}"
fork="true"
stacktrace="true"
memorymaximumsize="${groovycTest_mx}">
<classpath>
<pathelement path="${testClassesDirectory}"/>
<path refid="groovyMainClasses"/>
<path refid="testLibPath"/>
</classpath>
<javac source="1.5" target="1.5" nowarn="on"/>
</groovyc>
</target>
<target name="-compileTest_vm6" if="groovy.build.vm6">
<groovyc srcdir="${testSourcePath}"
destdir="${testClassesDirectory}"
includes="${vm6GroovySourceFiles}"
fork="true"
stacktrace="true"
memorymaximumsize="${groovycTest_mx}">
<classpath>
<pathelement path="${testClassesDirectory}"/>
<path refid="groovyMainClasses"/>
<path refid="testLibPath"/>
</classpath>
<!-- currently not needed, add in if/when required -->
<!--<javac source="1.5" target="1.5" nowarn="on"/>-->
</groovyc>
</target>
<target name="compileExamples" depends="-init,-initGroovyc,compileMain,-includeExamplesResources"
unless="_skipExamples_"
description="Compile the Java and Groovy code in the examples source directory.">
<mkdir dir="${examplesClassesDirectory}"/>
<echo message="Compiling example code."/>
<groovyc srcdir="${examplesSourceDirectory}/webapps/groovlet-examples/WEB-INF/groovy"
destdir="${examplesClassesDirectory}"
fork="true" stacktrace="true"
memorymaximumsize="${groovycExamples_mx}">
<classpath>
<pathelement path="${mainClassesDirectory}"/>
<path refid="compilePath"/>
<path refid="examplesPath"/>
</classpath>
</groovyc>
<javac srcdir="${examplesSourceDirectory}"
destdir="${examplesClassesDirectory}"
source="1.5"
target="1.5"
fork="true">
<classpath>
<pathelement path="${mainClassesDirectory}"/>
<pathelement path="${examplesClassesDirectory}"/>
<path refid="compilePath"/>
<path refid="examplesPath"/>
</classpath>
</javac>
<groovyc srcdir="${examplesSourceDirectory}"
destdir="${examplesClassesDirectory}"
fork="true" stacktrace="true"
memorymaximumsize="${groovycExamples_mx}"
excludes="webapps/groovlet-examples/WEB-INF/groovy/**/*.groovy,org/codehaus/groovy/grails/compiler/injection/**/*.java">
<classpath>
<pathelement path="${mainClassesDirectory}"/>
<pathelement path="${examplesClassesDirectory}"/>
<path refid="compilePath"/>
<path refid="examplesPath"/>
</classpath>
<javac source="1.5" target="1.5"/>
</groovyc>
</target>
<target name="-initializeReports">
<mkdir dir="${reportsDirectory}"/>
</target>
<condition property="_shouldBeHeadless_">
<or>
<istrue value="${java.awt.headless}"/>
<!--<os name="Mac OS X"/>-->
</or>
</condition>
<target name="-testInit" depends="-initHeadless">
<property name="headlessArg" value=""/>
<property name="junitJvmArgs"
value="-Xms${groovyJUnit_ms} -XX:PermSize=${groovyJUnit_permSize} -XX:MaxPermSize=${groovyJUnit_maxPermSize} ${headlessArg} -Dgroovy.testdb.props=${groovy.testdb.props} -DjavadocAssertion.src.dir=./src/main"/>
</target>
<target name="-initHeadless" if="_shouldBeHeadless_">
<property name="headlessArg" value="-Djava.awt.headless=true"/>
<echo message="Setting headless mode ..."/>
</target>
<target name="test"
depends="-banner,-checkAntVersion,-initializeReports,compileTest,-coverageInstrument,-testInit,-testOne,-testAll,-reportTestFailed"
description="Compile and test all the classes (or just one class if testCase property is defined)."/>
<target name="clean-test" depends="clean,test"
description="Clean and compile and test all the classes (or just one class if testCase property is defined)."/>
<condition property="_testOne_">
<and>
<not>
<istrue value="${_skipTests_}"/>
</not>
<isset property="testCase"/>
</and>
</condition>
<target name="-testOne" if="_testOne_" depends="-initGroovyc">
<mkdir dir="${junitRawDirectory}"/>
<junit printsummary="true" fork="true" includeantruntime="false" failureproperty="testFailed"
maxmemory="${groovyJUnit_mx}" dir="${basedir}">
<sysproperty key="apple.awt.UIElement" value="true"/>
<!-- keeps the dock from showing the AWT startup -->
<jvmarg line="${junitJvmArgs}"/>
<test name="${testCase}" todir="${junitRawDirectory}"/>
<formatter type="brief" usefile="false"/>
<classpath>
<pathelement path="${instrumentedClassesDirectory}"/>
<pathelement path="src/test"/>
<!-- TODO temp hack - remove once modules are in place -->
<pathelement path="${bsfSourceDirectory}/test/java"/>
<pathelement path="${jmxSourceDirectory}/test/groovy"/>
<pathelement path="${jmxSourceDirectory}/test/java"/>
<pathelement path="${jsr223SourceDirectory}/test/groovy"/>
<pathelement path="${jsr223SourceDirectory}/test/java"/>
<pathelement path="${groovyTestSourceDirectory}/test/groovy"/>
<pathelement path="${groovyTestSourceDirectory}/test/java"/>
<path refid="groovyMainClasses"/>
<path refid="testLibPath"/>
<pathelement path="${testClassesDirectory}"/>
<path refid="coberturaPath"/>
</classpath>
<assertions>
<enable/>
</assertions>
</junit>
</target>
<condition property="_testAll_">
<and>
<not>
<istrue value="${_skipTests_}"/>
</not>
<not>
<isset property="_testOne_"/>
</not>
</and>
</condition>
<target name="-collectOptionalTests">
<condition property="networkTests.fileset.includes" value="groovy/grape/*Test.class" else="-nothing-">
<istrue value="${junit.network}"/>
</condition>
<fileset id="optionalTests.fileset" dir="${testClassesDirectory}" includes="${networkTests.fileset.includes}"/>
</target>
<target name="-collect15tests" unless="groovy.build.vm6">
<fileset id="ubertests.fileset" dir="${testClassesDirectory}" includes="UberTest*.class" excludes="Uber*VM6.class"/>
</target>
<target name="-collect16tests" if="groovy.build.vm6">
<fileset id="ubertests.fileset" dir="${testClassesDirectory}" includes="UberTest*.class"/>
</target>
<target name="-testAll" if="_testAll_" depends="-collect15tests,-collect16tests,-collectOptionalTests,-initGroovyc">
<mkdir dir="${junitRawDirectory}"/>
<junit printsummary="true" fork="true" includeantruntime="false" failureproperty="testFailed"
maxmemory="${groovyJUnit_mx}" dir="${basedir}">
<jvmarg line="${junitJvmArgs}"/>
<sysproperty key="apple.awt.UIElement" value="true"/>
<!-- keeps the dock from showing the AWT startup -->
<formatter type="xml"/>
<formatter type="plain" unless="noTextReports"/>
<batchtest todir="${junitRawDirectory}">
<fileset refid="ubertests.fileset"/>
<fileset refid="optionalTests.fileset"/>
</batchtest>
<classpath>
<pathelement path="${instrumentedClassesDirectory}"/>
<pathelement path="src/test"/>
<!-- TODO temp hack - remove once modules are in place -->
<pathelement path="${bsfSourceDirectory}/test/java"/>
<pathelement path="${jmxSourceDirectory}/test/groovy"/>
<pathelement path="${jmxSourceDirectory}/test/java"/>
<pathelement path="${jsr223SourceDirectory}/test/groovy"/>
<pathelement path="${jsr223SourceDirectory}/test/java"/>
<pathelement path="${groovyTestSourceDirectory}/test/groovy"/>
<path refid="groovyMainClasses"/>
<path refid="testLibPath"/>
<pathelement path="${testClassesDirectory}"/>
<path refid="coberturaPath"/>
</classpath>
<assertions>
<enable/>
</assertions>
</junit>
<mkdir dir="${junitReportsDirectory}"/>
<junitreport tofile="${junitRawDirectory}/Results.xml">
<fileset dir="${junitRawDirectory}" includes="TEST-*.xml"/>
<report format="frames" todir="${junitReportsDirectory}"/>
</junitreport>
</target>
<target name="-reportTestFailed" depends="-coverageReport" if="testFailed">
<fail message="Test failed, not processing further targets."/>
</target>
<target name="-coverageInstrument" depends="-initCoverage,-coberturaInit" if="_forceCoverage_">
<mkdir dir="${instrumentedClassesDirectory}"/>
<coberturaInstrument classesDirectory="${mainClassesDirectory}"/>
</target>
<target name="-coverageReport" depends="-initCoverage" if="_forceCoverage_">
<coberturaReport reportDirectory="${reportsDirectory}/cobertura"/>
</target>
<target name="-actuallyCreateJars"
depends="-makeManifest,-initializeJars,-createBaseJar,-createEmbeddableJar"
unless="testFailed"/>
<target name="-makeManifest">
<mkdir dir="${mainClassesDirectory}/META-INF"/>
<copy todir="${mainClassesDirectory}/META-INF" file="LICENSE.txt"/>
<makeManifest file="${mainClassesDirectory}/META-INF/MANIFEST.MF"/>
</target>
<macrodef name="makeManifest">
<attribute name="file"/>
<attribute name="bundleEnvironment" default="J2SE-1.5"/>
<sequential>
<manifest file="@{file}">
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Extension-Name" value="groovy"/>
<attribute name="Specification-Title" value="Groovy: a powerful, dynamic language for the JVM"/>
<attribute name="Specification-Version" value="${groovyVersion}"/>
<attribute name="Specification-Vendor" value="The Codehaus"/>
<attribute name="Implementation-Title" value="Groovy: a powerful, dynamic language for the JVM"/>
<attribute name="Implementation-Version" value="${groovyVersion}"/>
<attribute name="Implementation-Vendor" value="The Codehaus"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="Groovy Runtime"/>
<attribute name="Bundle-Description" value="Groovy Runtime"/>
<attribute name="Bundle-Version" value="${groovyBundleVersion}"/>
<attribute name="Bundle-Vendor" value="The Codehaus"/>
<attribute name="Bundle-ClassPath" value="."/>
<attribute name="Bundle-RequiredExecutionEnvironment" value="@{bundleEnvironment}"/>
<attribute name="Eclipse-BuddyPolicy" value="dependent"/>
<attribute name="Eclipse-LazyStart" value="true"/>
<attribute name="DynamicImport-Package" value="*"/>
<attribute name="Main-class" value="groovy.ui.GroovyMain"/>
</manifest>
</sequential>
</macrodef>
<target name="-includeResources" depends="-includeGroovyDocTemplates">
<copy todir="${mainClassesDirectory}">
<fileset dir="${mainSourceDirectory}">
<include name="META-INF/services/*"/>
<include name="groovy/grape/*.xml"/>
<include name="groovy/ui/*.properties"/>
<include name="groovy/ui/**/*.png"/>
<include name="groovy/inspect/swingui/AstBrowserProperties.groovy"/>
<include name="org/codehaus/groovy/tools/shell/**/*.properties"/>
<include name="org/codehaus/groovy/tools/groovydoc/**/*.properties"/>
<include name="org/codehaus/groovy/tools/shell/**/*.xml"/>
<include name="org/codehaus/groovy/antlib.xml"/>
</fileset>
</copy>
<antcall target="-includeReleaseInfo"/>
</target>
<target name="-includeReleaseInfo">
<copy file="${mainSourceDirectory}/META-INF/groovy-release-info.properties"
todir="${mainClassesDirectory}/META-INF" overwrite="true">
</copy>
<tstamp>
<format property="release.date" pattern="dd-MMM-yyyy"/>
<format property="release.time" pattern="hh:mm aa"/>
</tstamp>
<replace file="${mainClassesDirectory}/META-INF/groovy-release-info.properties">
<replacefilter token="##ImplementationVersion##" value="${groovyVersion}"/>
<replacefilter token="##BundleVersion##" value="${groovyBundleVersion}"/>
<replacefilter token="##BuildDate##" value="${release.date}"/>
<replacefilter token="##BuildTime##" value="${release.time}"/>
</replace>
</target>
<target name="-includeExamplesResources" depends="-includeGroovyDocTemplates">
<copy todir="${examplesClassesDirectory}">
<fileset dir="${examplesSourceDirectory}">
<include name="/swing/binding/caricature/resources/*.gif"/>
</fileset>
</copy>
</target>
<target name="-includeGroovyDocTemplates">
<copy todir="${mainClassesDirectory}">
<fileset dir="${mainSourceDirectory}">
<include name="org/codehaus/groovy/tools/groovydoc/gstringTemplates/*/*.*"/>
</fileset>
<fileset dir="${toolsSourceDirectory}">
<include name="org/codehaus/groovy/tools/groovy.ico"/>
</fileset>
</copy>
</target>
<target name="-initializeJars" depends="test" unless="_skipDocs_">
<delete dir="${targetDistDirectory}" quiet="true"/>
<mkdir dir="${targetDistDirectory}"/>
</target>
<target name="-createBaseJar" unless="testFailed">
<!-- TODO temp hack - some containers don't correctly handle package-info class files - remove for now -->
<jar destfile="${targetDistDirectory}/groovy.jar" basedir="${mainClassesDirectory}"
excludes="*.groovy,**/package-info.class" manifest="${mainClassesDirectory}/META-INF/MANIFEST.MF"/>
<jar destfile="${targetDistDirectory}/groovy-${groovyVersion}-sources.jar" basedir="${mainSourceDirectory}">
<!-- TODO temp hack - remove once modules are in place -->
<fileset dir="${bsfSourceDirectory}/main/java"/>
<fileset dir="${jmxSourceDirectory}/main/java"/>
<fileset dir="${jmxSourceDirectory}/main/groovy"/>
<fileset dir="${jsr223SourceDirectory}/main/java"/>
<fileset dir="${groovyTestSourceDirectory}/main/java"/>
<fileset dir="${groovyTestSourceDirectory}/main/groovy"/>
</jar>
</target>
<target name="-jarjarInit" unless="_skipEmbeddable_">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpathref="toolsPath"/>
</target>
<target name="-createEmbeddableJar" depends="-jarjarInit,-actuallyCreateEmbeddableJar" unless="testFailed"/>
<target name="-actuallyCreateEmbeddableJar" unless="_skipEmbeddable_">
<delete dir="${stagingDirectory}" quiet="true"/>
<mkdir dir="${stagingDirectory}"/>
<unzip dest="${stagingDirectory}">
<fileset dir="${runtimeLibDirectory}">
<include name="antlr*.jar"/>
<include name="asm*.jar"/>
<exclude name="asm-attr*.jar"/>
<exclude name="asm-util*.jar"/>
<exclude name="asm-analysis*.jar"/>
</fileset>
</unzip>
<unzip dest="${stagingDirectory}">
<patternset>
<include name="**/org/objectweb/asm/util/AbstractVisitor.class"/>
<include name="**/org/objectweb/asm/util/Trace*"/>
</patternset>
<fileset dir="${runtimeLibDirectory}">
<include name="asm-util*.jar"/>
</fileset>
</unzip>
<unzip dest="${stagingDirectory}">
<fileset dir="${targetDistDirectory}">
<include name="groovy.jar"/>
</fileset>
</unzip>
<copy toDir="${stagingDirectory}/META-INF">
<fileset dir="${basedir}/config/build">
<include name="*LICENSE.txt"/>
</fileset>
</copy>
<!-- add commons-cli -->
<unzip dest="${stagingDirectory}">
<patternset>
<!-- no need for the manifest file, we have our own -->
<exclude name="META-INF/MANIFEST.MF"/>
</patternset>
<globmapper from="META-INF/LICENSE.txt" to="META-INF/CLI-LICENSE.txt"/>
<fileset dir="${runtimeLibDirectory}">
<include name="commons-cli-*.jar"/>
</fileset>
</unzip>
<makeManifest file="${stagingDirectory}/META-INF/MANIFEST.MF"/>
<!-- TODO try to make use of jarjar keep ability -->
<jarjar jarfile="${targetDistDirectory}/groovy-all.jar"
manifest="${stagingDirectory}/META-INF/MANIFEST.MF">
<fileset dir="${stagingDirectory}"
excludes="groovy/util/CliBuilder*.class,groovy/util/OptionAccessor*.class,org/codehaus/groovy/tools/shell/util/HelpFormatter*.class"/>
<rule pattern="antlr.**" result="groovyjarjarantlr.@1"/>
<rule pattern="org.objectweb.**" result="groovyjarjarasm.@1"/>
<rule pattern="org.apache.commons.cli.**" result="groovyjarjarcommonscli.@1"/>
</jarjar>
<jar destfile="${targetDistDirectory}/groovy-all.jar" update="true"
basedir="${stagingDirectory}"
includes="groovy/util/CliBuilder*.class,groovy/util/OptionAccessor*.class,org/codehaus/groovy/tools/shell/util/HelpFormatter*.class"/>
<copy file="${targetDistDirectory}/groovy-${groovyVersion}-sources.jar"
tofile="${targetDistDirectory}/groovy-all-${groovyVersion}-sources.jar"/>
<delete dir="${stagingDirectory}" quiet="true"/>
</target>
<target name="createJars" depends="-checkAntVersion,test,-actuallyCreateJars"
description="Build Groovy and create the jarfiles."/>
<target name="updateJarsForOsgi" unless="_skipOsgi_">
<taskdef resource="aQute/bnd/ant/taskdef.properties" classpathref="toolsPath"/>
<copy todir="${targetDistDirectory}">
<fileset dir="config/bnd" includes="groovy*.bnd"/>
<filterset>
<filter token="GROOVY_BUNDLE_VERSION" value="${groovyBundleVersion}"/>
</filterset>
</copy>
<property name="jarsToWrap" value="groovy.jar,groovy-all.jar"/>
<property name="runtimeJars" refid="runtimePath"/>
<bndwrap definitions="${targetDistDirectory}" output="${targetDistDirectory}" failok="true"
classpath="${runtimeJars}">
<fileset dir="${targetDistDirectory}" includes="${jarsToWrap}"/>
</bndwrap>
<delete dir="${targetDistDirectory}" includes="${jarsToWrap}"/>
<move todir="${targetDistDirectory}">
<fileset dir="${targetDistDirectory}" includes="groovy*.bar"/>
<globmapper from="groovy*.bar" to="groovy*-${groovyVersion}.jar"/>
</move>
<delete dir="${targetDistDirectory}" includes="groovy*.bnd"/>
</target>
<target name="skipOsgi" if="_skipOsgi_">
<move todir="${targetDistDirectory}">
<fileset dir="${targetDistDirectory}" includes="groovy*.jar"/>
<globmapper from="groovy*.jar" to="groovy*-${groovyVersion}.jar"/>
</move>
</target>
<target name="install" depends="createJars,updateJarsForOsgi,skipOsgi" unless="testFailed"
description="Create an installation hierarchy in target/install.">
<!--
FIXME: It's not really a good idea to delete stuff, as it tends to negate Ant's (or other tools)
ability to run faster incremental builds.
-->
<delete dir="${installDirectory}" quiet="true"/>
<mkdir dir="${installDirectory}"/>
<!-- Install license files -->
<copy todir="${installDirectory}">
<fileset dir="${basedir}">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</fileset>
</copy>
<unzip dest="${installDirectory}">
<patternset>
<include name="META-INF/*-LICENSE.txt"/>
</patternset>
<mapper type="flatten"/>
<fileset file="${targetDistDirectory}/groovy-all-${groovyVersion}.jar"/>
</unzip>
<fixcrlf srcdir="${installDirectory}" eol="crlf" includes="*.txt"/>
<!-- Install generated artifacts and runtime dependencies -->
<mkdir dir="${installDirectory}/lib"/>
<copy todir="${installDirectory}/lib">
<fileset dir="${targetDistDirectory}" includes="groovy-${groovyVersion}.jar"/>
<fileset dir="${runtimeLibDirectory}" includes="*.jar"/>
</copy>
<!-- Install the embeddable bits -->
<mkdir dir="${installDirectory}/embeddable"/>
<copy todir="${installDirectory}/embeddable">
<fileset dir="${targetDistDirectory}" includes="groovy-all-${groovyVersion}.jar"/>
</copy>
<!-- Install configuration files -->
<mkdir dir="${installDirectory}/conf"/>
<copy toDir="${installDirectory}/conf">
<fileset dir="${sourceDirectory}/conf" includes="*"/>
</copy>
<!-- Install scripts -->
<mkdir dir="${installDirectory}/bin"/>
<copy toDir="${installDirectory}/bin">
<fileset dir="${sourceDirectory}/bin" excludes="groovy.icns"/>
<filterset>
<filter token="GROOVYJAR" value="groovy-${groovyVersion}.jar"/>
</filterset>
</copy>
<!-- icons -->
<copy toDir="${installDirectory}/bin" flatten="true">
<fileset dir="${sourceDirectory}/bin" includes="groovy.icns"/>
<fileset dir="${toolsSourceDirectory}">
<include name="org/codehaus/groovy/tools/groovy.ico"/>
</fileset>
</copy>
<!-- Tweak scripts for platform compatibility -->
<fixcrlf srcdir="${installDirectory}/bin" eol="lf" excludes="*.bat, *.icns"/>
<fixcrlf srcdir="${installDirectory}/bin" eol="crlf" includes="*.bat"/>
<chmod perm="ugo+x">
<fileset dir="${installDirectory}/bin" includes="*,*.*"/>
</chmod>
</target>
<target name="checkstyle" depends="-init,-initializeReports,-checkstyleInit"
description="Create the code style reports.">
<!-- TODO extend checkstyle to mainSourcePath -->
<checkAndReport
reportDirectory="${reportsDirectory}/checkstyle"
sourceDirectory="${mainSourceDirectory}"
excludes="org/codehaus/groovy/antlr/parser/*,org/codehaus/groovy/antlr/java/*,org/codehaus/groovy/syntax/Types.java">
<path>
<pathelement path="${mainClassesDirectory}"/>
<path refid="testLibPath"/>
</path>
</checkAndReport>
</target>
<target name="-compileTools" depends="-initGroovyc,compileMain">
<groovyc srcdir="${toolsSourceDirectory}" destdir="${toolsClassesDirectory}" fork="true">
<classpath>
<path refid="toolsPath"/>
<pathelement path="${mainClassesDirectory}"/>
<path refid="compilePath"/>
</classpath>
</groovyc>
<copy todir="${toolsClassesDirectory}">
<fileset dir="${toolsSourceDirectory}">
<include name="**/*.html"/>
</fileset>
</copy>
</target>
<target name="cruiseReportExtras">
<mkdir dir="${cruiseReportRootDirectory}"/>
<copy todir="${cruiseReportRootDirectory}">
<fileset dir="cruise/html"/>
</copy>
</target>
<target name="cruiseInit">
<property name="noTextReports" value="true"/>
<property name="forceCoverage" value="true"/>
<delete dir="${reportsDirectory}" quiet="true" failonerror="false"/>
<delete dir="${junitRawDirectory}" quiet="true" failonerror="false"/>
</target>
<target name="cruise" depends="cruiseInit,fulldist,cruiseReportExtras"/>
<target name="-docInit">
<mkdir dir="${docsDirectory}"/>
<property name="docFooter" value="Copyright &copy; 2003-2012 The Codehaus. All rights reserved."/>
<property name="title" value="Groovy ${groovyVersion}"/>
</target>
<target name="doc" depends="javadoc, groovydoc" description="Create the documentation."/>
<target name="javadoc" depends="-fetchDependencies,-docInit,-jvm14BuildWarning,ensureGrammars"
unless="_skipDocs_" description="Create the javadoc documentation.">
<javadoc destdir="${docsDirectory}/api" author="true" version="true"
windowtitle="${title}" doctitle="${title}"
encoding="ISO-8859-1" useexternalfile="true" source="1.5"
footer="${docFooter}"
overview="src/main/overviewj.html"
maxmemory="${javaDoc_mx}"
>
<classpath>
<path path="${mainClassesDirectory}"/>
<path refid="compilePath"/>
</classpath>
<fileset dir="${mainSourceDirectory}" includes="**/*.java"/>
<!-- TODO temp hack - remove once modules are in place -->
<fileset dir="${bsfSourceDirectory}/main/java" includes="**/*.java"/>
<fileset dir="${jmxSourceDirectory}/main/java" includes="**/*.java"/>
<fileset dir="${jsr223SourceDirectory}/main/java" includes="**/*.java"/>
<fileset dir="${groovyTestSourceDirectory}/main/java" includes="**/*.java"/>
<link href="http://docs.oracle.com/javase/6/docs/api/"/>
<link href="http://evgeny-goldin.org/javadoc/ant/api/"/>
<link href="http://kentbeck.github.com/junit/javadoc/latest/"/>
<link href="http://docs.oracle.com/javaee/6/api/"/>
<link href="http://www.antlr2.org/javadoc"/>
<link href="http://commons.apache.org/cli/api-release"/>
</javadoc>
<mkdir dir="${targetDistDirectory}"/>
<jar basedir="${docsDirectory}/api" destfile="${targetDistDirectory}/groovy-${groovyVersion}-javadoc.jar"/>
<copy toFile="${targetDistDirectory}/groovy-all-${groovyVersion}-javadoc.jar">
<fileset file="${targetDistDirectory}/groovy-${groovyVersion}-javadoc.jar"/>
</copy>
</target>
<target name="groovydoc" depends="-fetchDependencies" unless="_skipDocs_">
<path id="groovydocpath">
<path path="${mainClassesDirectory}"/>
<path refid="runtimePath"/>
</path>
<antforked target="realgroovydoc" maxmemory="${groovyDoc_mx}" classpathref="groovydocpath"/>
</target>
<target name="realgroovydoc" depends="-fetchDependencies,-docInit,-includeGroovyDocTemplates,docGDK">
<taskdef name="groovydoc" classname="org.codehaus.groovy.ant.Groovydoc">
<classpath>
<path path="${mainClassesDirectory}"/>
<path refid="compilePath"/>
</classpath>
</taskdef>
<groovydoc
destdir="${docsDirectory}/gapi"
sourcepath="${mainSourcePath}"
packagenames="**.*"
use="true"
windowtitle="${title}"
doctitle="${title}"
header="${title}"
footer="${docFooter}"
overview="src/main/overview.html">
<link packages="javax.servlet.,javax.management." href="http://docs.oracle.com/javaee/6/api/"/>
<link packages="java.,org.xml.,javax.,org.w3c." href="http://docs.oracle.com/javase/6/docs/api/"/>
<link packages="org.apache.ant.,org.apache.tools.ant." href="http://evgeny-goldin.org/javadoc/ant/api/"/>
<link packages="org.junit.,junit." href="http://kentbeck.github.com/junit/javadoc/latest/"/>
<link packages="org.apache.commons.cli." href="http://commons.apache.org/cli/api-release"/>
<link packages="antlr." href="http://www.antlr2.org/javadoc"/>
</groovydoc>
</target>
<target name="docGDK" depends="-fetchDependencies,-compileTools" description="Create the GDK documentation">
<java classname="org.codehaus.groovy.tools.DocGenerator" fork="yes" failonerror="true">
<classpath>
<pathelement path="${toolsClassesDirectory}"/>
<path refid="toolsPath"/>
<pathelement path="${mainClassesDirectory}"/>
</classpath>
<arg value="org.codehaus.groovy.runtime.DefaultGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.DefaultGroovyStaticMethods"/>
<arg value="org.codehaus.groovy.runtime.DateGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.EncodingGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.IOGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.ProcessGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.ResourceGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.SocketGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.SqlGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.StringGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.SwingGroovyMethods"/>
<arg value="org.codehaus.groovy.runtime.XmlGroovyMethods"/>
<arg value="org.codehaus.groovy.vmplugin.v5.PluginDefaultGroovyMethods"/>
<arg value="org.codehaus.groovy.vmplugin.v6.PluginDefaultGroovyMethods"/>
<arg value="org.codehaus.groovy.vmplugin.v6.PluginStaticGroovyMethods"/>
</java>
<copy todir="target/html/groovy-jdk" file="src/tools/org/codehaus/groovy/tools/groovy.ico"/>
<copy todir="target/html/groovy-jdk" file="src/tools/org/codehaus/groovy/tools/stylesheet.css"/>
</target>
<target name="clean" description="Clean up build artifacts.">
<delete dir="${targetDirectory}" quiet="true"/>
<delete file="cobertura.ser" quiet="true" failonerror="false"/>
<delete quiet="true">
<fileset dir="." includes="**/*~"/>
<fileset dir="${groovyParserDirectory}" includes="Groovy*.*"/>
<fileset dir="${javaParserDirectory}"
includes="JavaLexer.java,JavaRecognizer.java,JavaTokenTypes.java,JavaTokenTypes.txt,*.smap"/>
</delete>
</target>
<target name="deploy" depends="-mavenDeployInit,install,doc,-deployDefault,-deployFromServer"
description="Deploy jars to maven repository."/>
<target name="-deployDefault" unless="_forceServerSettings_">
<mavenDeploy version="${groovyVersion}" prefix="groovy"/>
<mavenDeploy version="${groovyVersion}" prefix="groovy-all"/>
</target>
<target name="-deployFromServer" if="_forceServerSettings_">
<copy tofile="target/settings.xml">
<fileset file="config/maven/settings.xml"/>
<filterset>
<filter token="groovy.deploy.username" value="${groovy.deploy.username}"/>
<filter token="groovy.deploy.password" value="${groovy.deploy.password}"/>
</filterset>
</copy>
<mavenDeploySettings version="${groovyVersion}" prefix="groovy" settings="target/settings.xml"/>
<mavenDeploySettings version="${groovyVersion}" prefix="groovy-all" settings="target/settings.xml"/>
<delete file="target/settings.xml"/>
</target>
<target name="installRepo" depends="-mavenInit,install,doc"
description="Deploy artifacts to local maven repository.">
<mavenInstallRepo version="${groovyVersion}" prefix="groovy"/>
<mavenInstallRepo version="${groovyVersion}" prefix="groovy-all"/>
</target>
<target name="quality" depends="install,checkstyle" description="install plus checkstyle"/>
<target name="release" depends="deploy,compileExamples" description="deploy plus compileExamples"/>
<target name="fulldist" depends="dist,compileExamples,checkstyle" description="dist plus examples plus checkstyle"/>
<target name="dist" depends="install,doc" description="Create everything needed for a distribution.">
<zip destfile="${targetDistDirectory}/groovy-binary-${groovyVersion}.zip"
comment="The Groovy ${groovyVersion} binary distribution.">
<!-- Make unix scripts executable -->
<zipfileset dir="${installDirectory}" prefix="groovy-${groovyVersion}" filemode="775">
<include name="bin/*"/>
<exclude name="bin/*.*"/>
<exclude name="bin/startGroovy*"/>
</zipfileset>
<!-- Include the other scripts as is -->
<zipfileset dir="${installDirectory}" prefix="groovy-${groovyVersion}">
<include name="bin/*.*"/>
<include name="bin/startGroovy*"/>
</zipfileset>
<!-- Include everything else as is too -->
<zipfileset dir="${installDirectory}" prefix="groovy-${groovyVersion}">
<exclude name="bin/**"/>
<include name="**"/>
</zipfileset>
</zip>
<zip destfile="${targetDistDirectory}/groovy-docs-${groovyVersion}.zip"
comment="The Groovy ${groovyVersion} documentation distribution.">
<zipfileset dir="${wikiPdfDirectory}" includes="wiki-snapshot.pdf" prefix="groovy-${groovyVersion}/pdf"/>
<zipfileset dir="${docsDirectory}" prefix="groovy-${groovyVersion}/html"/>
</zip>
<zip destfile="${targetDistDirectory}/groovy-src-${groovyVersion}.zip"
comment="The Groovy ${groovyVersion} source distribution.">
<zipfileset dir="${basedir}" prefix="groovy-${groovyVersion}">
<!-- Exclude generated bits as well as any other bits that shouldn't make it in -->
<exclude name="${targetDirectory}/**"/>
<exclude name="classes/**"/>
<exclude name="cruise/**"/>
<exclude name=".clover/*"/>
<exclude name=".git/**"/>
<exclude name="local.build.properties"/>
<exclude name="cobertura.ser"/>
<exclude name="junitvmwatcher*.properties"/>
</zipfileset>
</zip>
</target>
</project>