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
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
|
<?xml version="1.0" encoding="UTF-8"?>
<project name="sabbus" default="build" xmlns:artifact="urn:maven-artifact-ant">
<description>
SuperSabbus for Scala core, builds the scala library and compiler. It can also package it as a simple distribution, tests it for stable bootstrapping and against the Scala test suite.
</description>
<!-- USAGE FROM JENKINS SCRIPTS IS (CURRENTLY) AS FOLLOWS:
ant $antArgs $scalacArgs $targets
antArgs tend to be:
-Darchives.skipxz=true
-Dscalac.args.optimise=-optimise
scalacArgs examples:
"-Dscalac.args=\"-Yrangepos\" -Dpartest.scalac_opts=\"-Yrangepos\""
targets exercised:
build-opt nightly test.suite test.continuations.suite test.scaladoc locker.done
-->
<!-- ===========================================================================
END-USER TARGETS
============================================================================ -->
<target name="build" depends="pack.done" description="Builds the Scala compiler and library. Executables are in 'build/pack/bin'."/>
<target name="test" depends="test.done" description="Runs test suite and bootstrapping test on Scala compiler and library."/>
<target name="docs" depends="docs.done" description="Builds documentation for the Scala library. Scaladoc is in 'build/scaladoc/library'."/>
<target name="docscomp" depends="docs.comp" description="Builds documentation for the Scala compiler and library. Scaladoc is in 'build/scaladoc'."/>
<target name="dist" depends="all.clean, all.done" description="Cleans all and builds and tests a new distribution."/>
<target name="partialdist" depends="dist.partial" description="Makes a new distribution without documentation, so just for testing."/>
<target name="fastdist" depends="dist.done" description="Makes a new distribution without testing it or removing partially build elements."/>
<target name="build-opt" description="Optimized version of build."> <optimized name="build"/></target>
<target name="test-opt" description="Optimized version of test."> <optimized name="test"/></target>
<target name="dist-opt" description="Optimized version of dist."> <optimized name="dist"/></target>
<target name="partialdist-opt" description="Optimized version of partialdist."> <optimized name="partialdist"/></target>
<target name="fastdist-opt" description="Optimized version of fastdist."> <optimized name="fastdist"/></target>
<!-- packaging -->
<target name="distpack" depends="dist.done, docs.done">
<ant antfile="${src.dir}/build/pack.xml" target="pack-all.done" inheritall="yes" inheritrefs="yes"/></target>
<target name="distpack-maven" depends="dist.done, docs.done">
<ant antfile="${src.dir}/build/pack.xml" target="pack-maven.done" inheritall="yes" inheritrefs="yes"/></target>
<target name="distpack-opt" description="Builds an optimised distribution."> <optimized name="distpack"/></target>
<target name="distpack-maven-opt" description="Builds an optimised maven distribution."><optimized name="distpack-maven"/></target>
<target name="all.done" depends="dist.done, test.done"/>
<!-- must use depends for all.done, not antcall: need the properties defined in there (dist.dir) -->
<target name="nightly-nopt" depends="all.done, docs.done">
<ant antfile="${src.dir}/build/pack.xml" target="pack-all.done" inheritall="yes" inheritrefs="yes"/></target>
<target name="nightly"><optimized name="nightly-nopt"/></target>
<target name="nightly.checkall">
<antcall target="nightly-nopt"> <param name="partest.scalac_opts" value="-Ycheck:all"/></antcall></target>
<target name="clean" depends="quick.clean" description="Removes binaries of compiler and library. Locker and distributions are untouched."/>
<target name="docsclean" depends="docs.clean" description="Removes generated documentation. Distributions are untouched."/>
<target name="distclean" depends="dist.clean" description="Removes all distributions. Binaries and documentation are untouched."/>
<macrodef name="optimized" >
<attribute name="name"/>
<sequential>
<antcall target="@{name}"><param name="scalac.args.optimise" value="-optimise"/></antcall>
</sequential>
</macrodef>
<!-- ===========================================================================
PROPERTIES
============================================================================ -->
<property environment="env"/>
<!-- Prevents system classpath from being used -->
<property name="build.sysclasspath" value="ignore"/>
<!-- Defines the repository layout -->
<property name="docs.dir" value="${basedir}/docs"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="partest.dir" value="${basedir}/test"/>
<property name="lib-ant.dir" value="${lib.dir}/ant"/>
<!-- For developers: any jars placed in this dir will be added to the classpath
of all targets and copied into quick/pack/etc builds. -->
<property name="lib-extra.dir" value="${lib.dir}/extra"/>
<!-- Loads custom properties definitions -->
<property file="${basedir}/build.properties"/>
<!-- Generating version number -->
<property file="${basedir}/build.number"/>
<!-- Sets location of pre-compiled libraries -->
<property name="library.starr.jar" value="${lib.dir}/scala-library.jar"/>
<property name="reflect.starr.jar" value="${lib.dir}/scala-reflect.jar"/>
<property name="compiler.starr.jar" value="${lib.dir}/scala-compiler.jar"/>
<property name="msil.starr.jar" value="${lib.dir}/msil.jar"/>
<property name="jline.jar" value="${lib.dir}/jline.jar"/>
<property name="ant.jar" value="${ant.home}/lib/ant.jar"/>
<property name="scalacheck.jar" value="${lib.dir}/scalacheck.jar"/>
<!-- Sets location of build folders -->
<property name="build.dir" value="${basedir}/build"/>
<property name="build-libs.dir" value="${build.dir}/libs"/>
<property name="build-asm.dir" value="${build.dir}/asm"/>
<property name="build-fjbg.dir" value="${build-libs.dir}"/>
<property name="build-forkjoin.dir" value="${build-libs.dir}"/>
<property name="build-locker.dir" value="${build.dir}/locker"/>
<property name="build-palo.dir" value="${build.dir}/palo"/>
<property name="build-quick.dir" value="${build.dir}/quick"/>
<property name="build-pack.dir" value="${build.dir}/pack"/>
<property name="build-osgi.dir" value="${build.dir}/osgi"/>
<property name="build-strap.dir" value="${build.dir}/strap"/>
<property name="build-docs.dir" value="${build.dir}/scaladoc"/>
<property name="build-sbt.dir" value="${build.dir}/sbt-interface"/>
<property name="test.osgi.src" value="${partest.dir}/osgi/src"/>
<property name="test.osgi.classes" value="${build-osgi.dir}/classes"/>
<property name="dists.dir" value="${basedir}/dists"/>
<property name="copyright.string" value="Copyright 2002-2013, LAMP/EPFL"/>
<property name="partest.version.number" value="0.9.2"/>
<!-- These are NOT the flags used to run SuperSabbus, but the ones written
into the script runners created with scala.tools.ant.ScalaTool -->
<property name="java.flags" value="-Xmx256M -Xms32M"/>
<property name="jvm.opts" value=""/>
<!-- if ANT_OPTS is already set by the environment, it will be unaltered,
but if it is unset it will take this default value. -->
<property name="env.ANT_OPTS" value="-Xms1536M -Xmx1536M -Xss1M -XX:MaxPermSize=192M -XX:+UseParallelGC" />
<property name="scalacfork.jvmargs" value="${env.ANT_OPTS} ${jvm.opts}"/>
<!-- ===========================================================================
INITIALIZATION
============================================================================ -->
<target name="desired.jars.uptodate">
<patternset id="desired.jars">
<include name="lib/**/*.desired.sha1"/>
<include name="test/files/**/*.desired.sha1"/>
<include name="tools/**/*.desired.sha1"/>
</patternset>
<uptodate property="lib.jars.uptodate">
<srcfiles dir="${basedir}"><patternset refid="desired.jars"/></srcfiles>
<mapper type="glob" from="*.desired.sha1" to="*"/>
</uptodate>
</target>
<target name="boot" depends="desired.jars.uptodate" unless="lib.jars.uptodate">
<echo level="warn" message="Updating bootstrap libs. (To do this by hand, run ./pull-binary-libs.sh)"/>
<exec osfamily="unix" vmlauncher="false" executable="./pull-binary-libs.sh" failifexecutionfails="true" />
<exec osfamily="windows" vmlauncher="false" executable="pull-binary-libs.sh" failifexecutionfails="true" />
<!-- uptodate task needs to know these are what's in the sha. -->
<touch>
<fileset dir="${basedir}"><patternset refid="desired.jars"/></fileset>
<mapper type="glob" from="*.desired.sha1" to="*"/>
</touch>
</target>
<target name="init" depends="boot">
<!-- Set up Ant contrib tasks so we can use <if><then><else> instead of the clunky `unless` attribute -->
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${lib-ant.dir}/ant-contrib.jar"/>
<!-- Add our maven ant tasks -->
<path id="maven-ant-tasks.classpath" path="${lib-ant.dir}/maven-ant-tasks-2.1.1.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />
<!-- Resolve maven dependencies -->
<!-- work around http://jira.codehaus.org/browse/MANTTASKS-203:
java.lang.ClassCastException: org.codehaus.plexus.DefaultPlexusContainer cannot be cast to org.codehaus.plexus.PlexusContainer
on repeated use of artifact:dependencies
-->
<if><not><isset property="maven-deps-done"></isset></not><then>
<mkdir dir="${user.home}/.m2/repository"/>
<!-- This task has an issue where if the user directory does not exist, so we create it above. UGH. -->
<artifact:dependencies pathId="extra.tasks.classpath" filesetId="extra.tasks.fileset">
<dependency groupId="biz.aQute" artifactId="bnd" version="1.50.0"/>
</artifact:dependencies>
<!-- Pax runner -->
<property name="pax.exam.version" value="2.5.0"/>
<artifact:dependencies pathId="pax.exam.classpath" filesetId="pax.exam.fileset">
<dependency groupId="org.ops4j.pax.exam" artifactId="pax-exam-container-native" version="${pax.exam.version}"/>
<dependency groupId="org.ops4j.pax.exam" artifactId="pax-exam-junit4" version="${pax.exam.version}"/>
<dependency groupId="org.ops4j.pax.exam" artifactId="pax-exam-link-assembly" version="${pax.exam.version}"/>
<dependency groupId="org.ops4j.pax.url" artifactId="pax-url-aether" version="1.4.0"/>
<dependency groupId="org.ops4j.pax.swissbox" artifactId="pax-swissbox-framework" version="1.5.1"/>
<dependency groupId="ch.qos.logback" artifactId="logback-core" version="0.9.20"/>
<dependency groupId="ch.qos.logback" artifactId="logback-classic" version="0.9.20"/>
<dependency groupId="junit" artifactId="junit" version="4.10"/>
<dependency groupId="org.apache.felix" artifactId="org.apache.felix.framework" version="3.2.2"/>
</artifact:dependencies>
<artifact:dependencies pathId="partest.extras.classpath" filesetId="partest.extras.fileset">
<dependency groupId="com.googlecode.java-diff-utils" artifactId="diffutils" version="1.3.0"/>
</artifact:dependencies>
<!-- BND support -->
<typedef resource="aQute/bnd/ant/taskdef.properties" classpathref="extra.tasks.classpath" />
<!--<dependency groupId="com.typesafe" artifactId="config" version="0.4.0"/>-->
<union id="dependency.fileset">
<resources refid="partest.extras.fileset"/>
</union>
<!-- Download STARR via maven if `starr.version` is specified.
Want to slow down STARR changes, using only released versions. -->
<if><isset property="starr.version"/><then>
<artifact:dependencies pathId="starr.core.path">
<dependency groupId="org.scala-lang" artifactId="scala-library" version="${starr.version}"/>
<dependency groupId="org.scala-lang" artifactId="scala-reflect" version="${starr.version}"/>
<dependency groupId="org.scala-lang" artifactId="scala-compiler" version="${starr.version}"/>
</artifact:dependencies>
</then></if>
<property name="maven-deps-done" value="yep!"/>
</then></if>
<!-- NOTE: ant properties are write-once: second writes are silently discarded; the logic below relies on this -->
<!-- Compute defaults (i.e., if not specified on command-line) for OSGi/maven version suffixes.
Try to establish the invariant (verified below):
`version.suffix == maven.version.suffix == osgi.version.suffix`,
except for:
- snapshot builds, where:
- `maven.suffix == "-SNAPSHOT"`
- `version.suffix == osgi.version.suffix == ""`
- final builds, where:
- `osgi.suffix == "-VFINAL"`
- `version.suffix == maven.version.suffix == ""`
-->
<if><not><equals arg1="${version.bnum}" arg2="0"/></not><then>
<property name="version.suffix" value="-${version.bnum}"/>
</then></if>
<if><or><not><isset property="version.suffix"/></not><equals arg1="${version.suffix}" arg2=""/></or><then>
<if><isset property="build.release"/><then>
<property name="maven.version.suffix" value=""/>
<property name="version.suffix" value="${maven.version.suffix}"/>
<if><equals arg1="${maven.version.suffix}" arg2=""/><then>
<property name="osgi.version.suffix" value="-VFINAL"/></then>
<else>
<property name="osgi.version.suffix" value="${maven.version.suffix}"/></else></if></then></if></then>
<else> <!-- version.suffix set and not empty -->
<property name="maven.version.suffix" value="${version.suffix}"/>
<property name="osgi.version.suffix" value="${version.suffix}"/></else></if>
<!-- not building a release and no version.suffix specified -->
<property name="maven.version.suffix" value="-SNAPSHOT"/>
<if><equals arg1="${maven.version.suffix}" arg2="-SNAPSHOT"/><then>
<property name="osgi.version.suffix" value=""/>
<property name="version.suffix" value=""/></then>
<else>
<property name="osgi.version.suffix" value="${maven.version.suffix}"/>
<property name="version.suffix" value="${maven.version.suffix}"/></else></if>
<exec osfamily="unix" executable="tools/get-scala-commit-sha" outputproperty="git.commit.sha" failifexecutionfails="false" />
<exec osfamily="windows" executable="cmd.exe" outputproperty="git.commit.sha" failifexecutionfails="false">
<arg value="/c"/>
<arg value="tools\get-scala-commit-sha.bat"/>
<arg value="-p"/>
</exec>
<exec osfamily="unix" executable="tools/get-scala-commit-date" outputproperty="git.commit.date" failifexecutionfails="false" />
<exec osfamily="windows" executable="cmd.exe" outputproperty="git.commit.date" failifexecutionfails="false">
<arg value="/c"/>
<arg value="tools\get-scala-commit-date.bat"/>
<arg value="-p"/>
</exec>
<!-- some default in case something went wrong getting the revision -->
<property name="git.commit.sha" value="unknown"/>
<property name="git.commit.date" value="unknown"/>
<!-- We use the git describe to determine the OSGi modifier for our build. -->
<property name="maven.version.number"
value="${version.major}.${version.minor}.${version.patch}${maven.version.suffix}"/>
<property name="osgi.version.number"
value="${version.major}.${version.minor}.${version.patch}.v${git.commit.date}${osgi.version.suffix}-${git.commit.sha}"/>
<if><isset property="build.release"/><then>
<property name="version.number" value="${maven.version.number}"/>
</then><else>
<property name="version.number" value="${version.major}.${version.minor}.${version.patch}${version.suffix}-${git.commit.date}-${git.commit.sha}"/>
</else></if>
<condition property="has.java6">
<equals arg1="${ant.java.version}" arg2="1.6"/>
</condition>
<condition property="has.java7">
<equals arg1="${ant.java.version}" arg2="1.7"/>
</condition>
<condition property="has.unsupported.jdk">
<not><or>
<isset property="has.java7" />
<isset property="has.java6" />
</or></not>
</condition>
<fail if="has.unsupported.jdk" message="JDK ${ant.java.version} is not supported by this build!"/>
<if><isset property="has.java7"/><then>
<echo level="warning"> You are using JDK7 for this build.
While this will be able to build most of Scala, it will not build the Swing project.
You will be unable to create a distribution.
</echo>
</then></if>
<!-- Allow this to be overridden simply -->
<property name="sbt.latest.version" value="0.12.2"/>
<property name="sbt.src.dir" value="${build-sbt.dir}/${sbt.latest.version}/src"/>
<property name="sbt.lib.dir" value="${build-sbt.dir}/${sbt.latest.version}/lib"/>
<property name="sbt.interface.jar" value="${sbt.lib.dir}/interface.jar"/>
<property name="sbt.interface.url" value="http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/interface/${sbt.latest.version}/jars/interface.jar"/>
<property name="sbt.interface.src.jar" value="${sbt.src.dir}/compiler-interface-src.jar"/>
<property name="sbt.interface.src.url" value="http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/${sbt.latest.version}/jars/compiler-interface-src.jar"/>
<!-- Additional command line arguments for scalac. They are added to all build targets -->
<property name="scalac.args" value=""/>
<property name="javac.args" value=""/>
<property name="scalac.args.always" value="" />
<property name="scalac.args.optimise" value=""/> <!-- scalac.args.optimise is selectively overridden in certain antcall tasks. -->
<property name="scalac.args.all" value="${scalac.args.always} ${scalac.args} ${scalac.args.optimise}"/>
<property name="scalac.args.locker" value="${scalac.args.all}"/>
<property name="scalac.args.quick" value="${scalac.args.all}"/>
<property name="scalac.args.strap" value="${scalac.args.quick}"/>
<!-- This is the start time for the distribution -->
<tstamp prefix="time">
<format property="human" pattern="d MMMM yyyy, HH:mm:ss" locale="en,US"/>
<format property="short" pattern="yyyyMMddHHmmss"/>
</tstamp>
<!-- some default in case something went wrong getting the revision -->
<property name="version.number" value="-unknown-"/>
<property name="init.avail" value="yes"/>
<!-- Local libs (developer use.) -->
<mkdir dir="${lib-extra.dir}"/>
<!-- Auxiliary libs placed on every classpath. -->
<path id="aux.libs">
<pathelement location="${ant.jar}"/>
<!-- needs ant 1.7.1 -->
<!-- <fileset dir="${lib-extra.dir}" erroronmissingdir="false"> -->
<fileset dir="${lib-extra.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- And print-out what we are building -->
<echo message=" build time: ${time.human}" />
<echo message=" java version: ${java.vm.name} ${java.version} (${ant.java.version})" />
<echo message=" java args: ${env.ANT_OPTS} ${jvm.opts}" />
<echo message=" javac args: ${javac.args}" />
<echo message=" scalac args: ${scalac.args.all}" />
<echo message="scalac quick args: ${scalac.args.quick}" />
<echo message=" git date: ${git.commit.date}" />
<echo message=" git hash: ${git.commit.sha}" />
<echo message=" maven version: ${maven.version.number}"/>
<echo message=" OSGi version: ${osgi.version.number}" />
<echo message="canonical version: ${version.number}" />
<!-- validate version suffixes -->
<if><equals arg1="${maven.version.suffix}" arg2="-SNAPSHOT"/><then>
<condition property="version.suffixes.consistent"><and>
<equals arg1="${osgi.version.suffix}" arg2=""/>
<equals arg1="${version.suffix}" arg2=""/>
</and></condition></then>
<else>
<if><equals arg1="${osgi.version.suffix}" arg2="-VFINAL"/><then>
<condition property="version.suffixes.consistent"><and>
<equals arg1="${maven.version.suffix}" arg2=""/>
<equals arg1="${version.suffix}" arg2=""/>
</and></condition></then>
<else>
<condition property="version.suffixes.consistent"><and>
<equals arg1="${osgi.version.suffix}" arg2="${maven.version.suffix}"/>
<equals arg1="${version.suffix}" arg2="${maven.version.suffix}"/>
</and></condition></else></if></else></if>
<!-- <echo message=" maven suffix: ${maven.version.suffix}"/>
<echo message=" OSGi suffix: ${osgi.version.suffix}" />
<echo message="canonical suffix: ${version.suffix}" /> -->
<fail unless="version.suffixes.consistent" message="Version suffixes inconsistent!"/>
<path id="forkjoin.classpath" path="${build-libs.dir}/classes/forkjoin"/>
<path id="fjbg.classpath" path="${build-libs.dir}/classes/fjbg"/>
<path id="asm.classpath" path="${build-asm.dir}/classes"/>
<property name="forkjoin-classes" refid="forkjoin.classpath"/>
<property name="fjbg-classes" refid="fjbg.classpath"/>
<property name="asm-classes" refid="asm.classpath"/>
<!-- Compilers to use for the various stages.
There must be a variable of the shape @{stage}.compiler.path for all @{stage} in starr, locker, quick, strap.
-->
<path id="starr.compiler.path">
<path refid="starr.core.path"/>
<pathelement location="${lib.dir}/forkjoin.jar"/>
<path refid="aux.libs"/>
</path>
<!-- Download STARR (see above) via maven if `starr.version` is specified.
Want to slow down STARR changes, using only released versions. -->
<if><isset property="starr.version"/><then>
<property name="strr" refid="starr.compiler.path"/>
<echo message="Using Scala ${starr.version} for STARR."/>
<!-- <echo message="STARR classpath: ${strr}"/> -->
</then><else>
<path id="starr.core.path">
<pathelement location="${library.starr.jar}"/>
<pathelement location="${reflect.starr.jar}"/>
<pathelement location="${compiler.starr.jar}"/>
<pathelement location="${msil.starr.jar}"/>
</path>
</else></if>
<!-- Skip locker with -Dlocker.skip=YESSIR. Uses STARR instead. -->
<if><isset property="locker.skip"/><then>
<echo message="Skipping locker! Using STARR instead."/>
<path id="locker.compiler.path"><path refid="starr.compiler.path"/></path>
<property name="locker.locked" value="locker skipped"/></then>
<else>
<path id="locker.compiler.path"><path refid="locker.compiler.build.path"/></path></else></if>
<!-- compilerpathref for compiling with quick -->
<path id="quick.compiler.path"> <path refid="quick.compiler.build.path"/></path>
<!-- What to have on the compilation path when compiling during certain phases.
There must be a variable of the shape @{stage}.@{project}.build.path
for all @{stage} in locker, quick, strap
and all @{project} in library, reflect, compiler
when stage is quick, @{project} also includes: actors, swing, plugins, scalacheck, partest, scalap
-->
<!-- LOCKER -->
<path id="locker.library.build.path">
<pathelement location="${build-locker.dir}/classes/library"/>
<path refid="forkjoin.classpath"/>
<path refid="aux.libs"/>
</path>
<path id="locker.reflect.build.path">
<path refid="locker.library.build.path"/>
<pathelement location="${build-locker.dir}/classes/reflect"/>
</path>
<path id="locker.compiler.build.path">
<path refid="locker.reflect.build.path"/>
<pathelement location="${build-locker.dir}/classes/compiler"/>
<path refid="asm.classpath"/>
<path refid="fjbg.classpath"/>
<pathelement location="${jline.jar}"/>
</path>
<path id="locker.msil.build.path" refid="locker.compiler.build.path"/>
<!-- QUICK -->
<path id="quick.library.build.path">
<pathelement location="${build-quick.dir}/classes/library"/>
<path refid="forkjoin.classpath"/>
<path refid="aux.libs"/>
</path>
<path id="quick.actors.build.path"><path refid="quick.library.build.path"/></path>
<path id="quick.reflect.build.path">
<path refid="quick.library.build.path"/>
<pathelement location="${build-quick.dir}/classes/reflect"/>
</path>
<path id="quick.compiler.build.path">
<path refid="quick.reflect.build.path"/>
<pathelement location="${build-quick.dir}/classes/compiler"/>
<path refid="asm.classpath"/>
<path refid="fjbg.classpath"/>
<pathelement location="${jline.jar}"/>
</path>
<path id="quick.swing.build.path" refid="quick.library.build.path"/>
<path id="quick.msil.build.path" refid="quick.compiler.build.path"/>
<path id="quick.plugins.build.path">
<path refid="quick.compiler.build.path"/>
<pathelement location="${build-quick.dir}/classes/continuations-plugin"/>
</path>
<path id="quick.scalacheck.build.path">
<pathelement location="${build-quick.dir}/classes/library"/>
<pathelement location="${build-quick.dir}/classes/scalacheck"/>
</path>
<path id="quick.scalap.build.path">
<path refid="quick.compiler.build.path"/>
<pathelement location="${build-quick.dir}/classes/scalap"/>
<pathelement location="${build-quick.dir}/classes/partest"/>
</path>
<path id="quick.partest.build.path">
<path refid="quick.scalap.build.path"/>
<path refid="partest.extras.classpath"/>
<pathelement location="${scalacheck.jar}"/>
</path>
<path id="quick.bin.tool.path">
<pathelement location="${build-quick.dir}/classes/library"/>
<pathelement location="${build-quick.dir}/classes/reflect"/>
<pathelement location="${build-quick.dir}/classes/compiler"/>
<pathelement location="${build-quick.dir}/classes/scalap"/>
<pathelement location="${build-quick.dir}/classes/continuations-library"/>
<pathelement location="${jline.jar}"/>
<path refid="asm.classpath"/>
<path refid="forkjoin.classpath"/>
<path refid="aux.libs"/>
</path>
<!-- PACK -->
<!-- also used for docs.* targets TODO: use separate paths for those -->
<path id="pack.compiler.path">
<pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-reflect.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-partest.jar"/>
<pathelement location="${build-pack.dir}/lib/scalap.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-actors.jar"/>
<pathelement location="${ant.jar}"/>
<pathelement location="${jline.jar}"/>
<path refid="partest.extras.classpath"/>
<path refid="aux.libs"/>
</path>
<path id="pack.bin.tool.path">
<pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-reflect.jar"/>
<pathelement location="${build-pack.dir}/lib/scala-compiler.jar"/>
<pathelement location="${build-pack.dir}/lib/scalap.jar"/>
<pathelement location="${build-pack.dir}/lib/jline.jar"/>
<path refid="aux.libs"/>
</path>
<path id="pack.library.files">
<fileset dir="${build-quick.dir}/classes/library">
<!-- <exclude name="scala/swing/**"/> -->
<exclude name="scala/actors/**"/>
</fileset>
<fileset dir="${build-quick.dir}/classes/continuations-library"/>
<fileset dir="${forkjoin-classes}"/>
</path>
<path id="pack.actors.files">
<fileset dir="${build-quick.dir}/classes/library">
<include name="scala/actors/**"/>
</fileset>
</path>
<path id="pack.compiler.files">
<fileset dir="${build-quick.dir}/classes/compiler"/>
<fileset dir="${asm-classes}"/>
<fileset dir="${fjbg-classes}"/>
</path>
<path id="pack.swing.files"> <fileset dir="${build-quick.dir}/classes/swing"/> </path>
<path id="pack.reflect.files"> <fileset dir="${build-quick.dir}/classes/reflect"/> </path>
<path id="pack.plugins.files"> <fileset dir="${build-quick.dir}/classes/continuations-plugin"/> </path>
<path id="pack.scalacheck.files"> <fileset dir="${build-quick.dir}/classes/scalacheck"/> </path>
<path id="pack.scalap.files"> <fileset dir="${build-quick.dir}/classes/scalap"/>
<fileset file="${src.dir}/scalap/decoder.properties"/> </path>
<path id="pack.partest.files">
<fileset dir="${build-quick.dir}/classes/partest">
<exclude name="scala/tools/partest/javaagent/**"/>
</fileset>
</path>
<path id="pack.partest-javaagent.files">
<fileset dir="${build-quick.dir}/classes/partest">
<include name="scala/tools/partest/javaagent/**"/>
</fileset>
</path>
<!-- STRAP -->
<path id="strap.library.build.path">
<pathelement location="${build-strap.dir}/classes/library"/>
<path refid="forkjoin.classpath"/>
<path refid="aux.libs"/>
</path>
<path id="strap.actors.build.path" refid="strap.library.build.path"/>
<path id="strap.msil.build.path" refid="strap.compiler.build.path"/>
<path id="strap.reflect.build.path">
<path refid="strap.library.build.path"/>
<pathelement location="${build-strap.dir}/classes/reflect"/>
</path>
<path id="strap.compiler.build.path">
<path refid="strap.reflect.build.path"/>
<pathelement location="${build-strap.dir}/classes/compiler"/>
<path refid="asm.classpath"/>
<path refid="fjbg.classpath"/>
<pathelement location="${jline.jar}"/>
</path>
<!-- MISC -->
<path id="sbt.compile.build.path">
<path refid="quick.compiler.build.path"/>
<pathelement location="${sbt.interface.jar}"/>
</path>
<path id="manual.classpath">
<pathelement location="${build-pack.dir}/lib/scala-library.jar"/>
<pathelement location="${build.dir}/manmaker/classes"/>
</path>
<path id="partest.classpath">
<path refid="pack.compiler.path"/>
<path refid="partest.extras.classpath"/>
</path>
<path id="partest.build.path">
<path refid="pack.compiler.path"/>
<fileset dir="${partest.dir}/files/lib" includes="*.jar" />
<pathelement location="${pack.dir}/lib/scala-swing.jar"/> <!-- TODO - segregate swing tests (there can't be many) -->
</path>
<path id="test.osgi.compiler.build.path">
<pathelement location="${test.osgi.classes}"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-library.jar"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-reflect.jar"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-compiler.jar"/>
<pathelement location="${build-osgi.dir}/org.scala-lang.scala-actors.jar"/>
<path refid="pax.exam.classpath"/>
<path refid="forkjoin.classpath"/>
</path>
<path id="palo.bin.tool.path">
<pathelement location="${build-palo.dir}/lib/scala-library.jar"/>
<pathelement location="${build-palo.dir}/lib/scala-reflect.jar"/>
<pathelement location="${build-palo.dir}/lib/scala-compiler.jar"/>
<pathelement location="${build-palo.dir}/lib/jline.jar"/>
</path>
<path id="test.positions.sub.build.path" path="${build-quick.dir}/classes/library"/>
<!-- TODO: consolidate *.includes -->
<patternset id="partest.includes">
<include name="**/*.xml"/>
</patternset>
<patternset id="lib.includes">
<include name="**/*.tmpl"/>
<include name="**/*.xml"/>
<include name="**/*.js"/>
<include name="**/*.css"/>
</patternset>
<patternset id="lib.rootdoc.includes">
<include name="**/*.tmpl"/>
<include name="**/*.xml"/>
<include name="**/*.js"/>
<include name="**/*.css"/>
<include name="rootdoc.txt"/>
</patternset>
<patternset id="comp.includes">
<include name="**/*.tmpl"/>
<include name="**/*.xml"/>
<include name="**/*.js"/>
<include name="**/*.css"/>
<include name="**/*.html"/>
<include name="**/*.properties"/>
<include name="**/*.swf"/>
<include name="**/*.png"/>
<include name="**/*.gif"/>
<include name="**/*.txt"/>
</patternset>
<taskdef resource="scala/tools/ant/sabbus/antlib.xml" classpathref="starr.compiler.path"/>
</target>
<!-- ===========================================================================
CLEANLINESS
=============================================================================-->
<target name="libs.clean"> <clean build="libs"/> <clean build="asm"/> </target>
<target name="quick.clean" depends="libs.clean"> <clean build="quick"/> <clean build="pack"/> <clean build="strap"/> </target>
<target name="palo.clean" depends="quick.clean"> <clean build="palo"/> </target>
<target name="locker.clean" depends="palo.clean"> <clean build="locker"/> </target>
<target name="docs.clean"> <clean build="docs"/> <delete dir="${build.dir}/manmaker" includeemptydirs="yes" quiet="yes" failonerror="no"/> </target>
<target name="dist.clean"> <delete dir="${dists.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/> </target>
<target name="all.clean" depends="locker.clean, docs.clean"> <clean build="sbt"/> <clean build="osgi"/> </target>
<!-- Used by the scala-installer script -->
<target name="allallclean" depends="all.clean, dist.clean"/>
<macrodef name="clean">
<attribute name="build"/>
<sequential>
<delete dir="${build-@{build}.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
</sequential>
</macrodef>
<!-- ===========================================================================
LOCAL DEPENDENCIES
============================================================================ -->
<macrodef name="simple-javac" >
<attribute name="project"/> <!-- project: fjbg/asm/forkjoin -->
<attribute name="args" default=""/>
<attribute name="jar" default="yes"/>
<sequential>
<uptodate property="@{project}.available" targetfile="${build-libs.dir}/@{project}.complete">
<srcfiles dir="${src.dir}/@{project}"/></uptodate>
<if><not><isset property="@{project}.available"/></not><then>
<stopwatch name="@{project}.timer"/>
<mkdir dir="${@{project}-classes}"/>
<javac
srcdir="${src.dir}/@{project}"
destdir="${@{project}-classes}"
classpath="${@{project}-classes}"
includes="**/*.java"
target="1.6" source="1.5"
compiler="javac1.6">
<compilerarg line="${javac.args} @{args}"/>
</javac>
<if><equals arg1="@{jar}" arg2="yes"/><then>
<jar whenmanifestonly="fail" destfile="${build-libs.dir}/@{project}.jar" basedir="${@{project}-classes}"/></then></if>
<stopwatch name="@{project}.timer" action="total"/>
<mkdir dir="${build-libs.dir}"/>
<touch file="${build-libs.dir}/@{project}.complete" verbose="no"/>
</then></if>
</sequential>
</macrodef>
<target name="asm.done" depends="init"> <simple-javac project="asm" jar="no"/> </target>
<target name="fjbg.done" depends="init"> <simple-javac project="fjbg"/> </target>
<target name="forkjoin.done" depends="init"> <simple-javac project="forkjoin" args="-XDignore.symbol.file"/></target>
<!-- ===========================================================================
STAGED COMPILATION MACROS
============================================================================ -->
<macrodef name="staged-javac" >
<attribute name="stage"/> <!-- current stage (locker, quick, strap) -->
<attribute name="project"/> <!-- project: library/reflect/compiler/actors -->
<attribute name="destproject" default="@{project}"/> <!-- overrides the output directory; used when building multiple projects into the same directory-->
<attribute name="args" default=""/>
<attribute name="excludes" default=""/>
<sequential>
<javac
srcdir="${src.dir}/@{project}"
destdir="${build-@{stage}.dir}/classes/@{destproject}"
includes="**/*.java"
excludes="@{excludes}"
target="1.6" source="1.5">
<compilerarg line="${javac.args} @{args}"/>
<classpath refid="@{stage}.@{destproject}.build.path"/>
</javac>
</sequential>
</macrodef>
<macrodef name="staged-scalac" >
<attribute name="with"/> <!-- will use path `@{with}.compiler.path` to locate scalac -->
<attribute name="stage"/> <!-- current stage (locker, quick, strap) -->
<attribute name="project"/> <!-- project: library/reflect/compiler/actors -->
<attribute name="srcpath" default="NOT SET"/> <!-- needed to compile the library -->
<attribute name="args" default=""/> <!-- additional args -->
<attribute name="destproject" default="@{project}"/> <!-- overrides the output directory; used when building multiple projects into the same directory-->
<attribute name="srcdir" default="@{project}"/>
<element name="args" implicit="true" optional="true"/>
<sequential>
<if><equals arg1="@{srcpath}" arg2="NOT SET"/><then>
<scalacfork taskname="@{stage}.@{project}"
destdir="${build-@{stage}.dir}/classes/@{destproject}"
compilerpathref="@{with}.compiler.path"
params="${scalac.args.@{stage}} @{args}"
srcdir="${src.dir}/@{srcdir}"
jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath refid="@{stage}.@{project}.build.path"/>
<args/>
</scalacfork></then>
<else>
<scalacfork taskname="@{stage}.@{project}"
destdir="${build-@{stage}.dir}/classes/@{destproject}"
compilerpathref="@{with}.compiler.path"
srcpath="@{srcpath}"
params="${scalac.args.@{stage}} @{args}"
srcdir="${src.dir}/@{srcdir}"
jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath refid="@{stage}.@{project}.build.path"/>
<args/>
</scalacfork></else>
</if>
</sequential>
</macrodef>
<macrodef name="staged-uptodate" >
<attribute name="stage"/>
<attribute name="project"/>
<element name="check"/>
<element name="do"/>
<sequential>
<uptodate property="@{stage}.@{project}.available" targetfile="${build-@{stage}.dir}/@{project}.complete">
<check/>
</uptodate>
<if><not><isset property="@{stage}.@{project}.available"/></not><then>
<do/>
<touch file="${build-@{stage}.dir}/@{project}.complete" verbose="no"/>
</then></if>
</sequential>
</macrodef>
<macrodef name="staged-build" >
<attribute name="with"/> <!-- will use path `@{with}.compiler.path` to locate scalac -->
<attribute name="stage"/> <!-- current stage (locker, quick, strap) -->
<attribute name="project"/> <!-- project: library/reflect/compiler/actors -->
<attribute name="srcpath" default="NOT SET"/> <!-- needed to compile the library -->
<attribute name="args" default=""/> <!-- additional args -->
<attribute name="includes" default="comp.includes"/>
<attribute name="version" default=""/> <!-- non-empty for partest and scaladoc: use @{version}.version.number in property file-->
<element name="pre" optional="true"/>
<element name="post" optional="true"/>
<sequential>
<staged-uptodate stage="@{stage}" project="@{project}">
<check><srcfiles dir="${src.dir}/@{project}"/></check>
<do>
<stopwatch name="@{stage}.@{project}.timer"/>
<mkdir dir="${build-@{stage}.dir}/classes/@{project}"/>
<pre/>
<staged-scalac with="@{with}" stage="@{stage}" project="@{project}" srcpath="@{srcpath}" args="@{args}"/>
<post/>
<if><equals arg1="@{version}" arg2=""/><then>
<propertyfile file = "${build-@{stage}.dir}/classes/@{project}/@{project}.properties">
<entry key = "version.number" value="${version.number}"/>
<entry key = "maven.version.number" value="${maven.version.number}"/>
<entry key = "osgi.version.number" value="${osgi.version.number}"/>
<entry key = "copyright.string" value="${copyright.string}"/>
</propertyfile>
</then><else>
<propertyfile file = "${build-@{stage}.dir}/classes/@{project}/@{project}.properties">
<entry key = "version.number" value="${@{version}.version.number}"/>
<entry key = "copyright.string" value="${copyright.string}"/>
</propertyfile>
</else></if>
<copy todir="${build-@{stage}.dir}/classes/@{project}">
<fileset dir="${src.dir}/@{project}">
<patternset refid="@{includes}"/>
</fileset>
</copy>
<stopwatch name="@{stage}.@{project}.timer" action="total"/>
</do>
</staged-uptodate>
</sequential>
</macrodef>
<macrodef name="staged-bin">
<attribute name="stage"/>
<attribute name="classpathref" default="NOT SET"/>
<sequential>
<staged-uptodate stage="@{stage}" project="bin">
<check>
<srcfiles dir="${src.dir}">
<include name="compiler/scala/tools/ant/templates/**"/>
</srcfiles>
</check>
<do>
<taskdef name="mk-bin" classname="scala.tools.ant.ScalaTool" classpathref="@{stage}.bin.tool.path"/>
<mkdir dir="${build-@{stage}.dir}/bin"/>
<if><equals arg1="@{classpathref}" arg2="NOT SET"/><then>
<mk-bin file="${build-@{stage}.dir}/bin/scala" class="scala.tools.nsc.MainGenericRunner" javaFlags="${java.flags}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scalac" class="scala.tools.nsc.Main" javaFlags="${java.flags}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scaladoc" class="scala.tools.nsc.ScalaDoc" javaFlags="${java.flags}"/>
<mk-bin file="${build-@{stage}.dir}/bin/fsc" class="scala.tools.nsc.CompileClient" javaFlags="${java.flags}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scalap" class="scala.tools.scalap.Main" javaFlags="${java.flags}"/>
</then><else>
<mk-bin file="${build-@{stage}.dir}/bin/scala" class="scala.tools.nsc.MainGenericRunner" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scalac" class="scala.tools.nsc.Main" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scaladoc" class="scala.tools.nsc.ScalaDoc" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
<mk-bin file="${build-@{stage}.dir}/bin/fsc" class="scala.tools.nsc.CompileClient" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
<mk-bin file="${build-@{stage}.dir}/bin/scalap" class="scala.tools.scalap.Main" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
</else></if>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scala"/>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scalac"/>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scaladoc"/>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/fsc"/>
<chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scalap"/>
</do>
</staged-uptodate>
</sequential>
</macrodef>
<macrodef name="staged-pack">
<attribute name="project"/>
<attribute name="targetdir" default="lib"/>
<attribute name="targetjar" default="scala-@{project}.jar"/>
<attribute name="destfile" default="${build-pack.dir}/@{targetdir}/@{targetjar}"/>
<attribute name="manifest" default=""/>
<element name="pre" optional="true"/>
<element name="jar-opts" optional="true"/>
<sequential>
<uptodate property="pack.@{project}.available" targetfile="@{destfile}">
<srcresources>
<resources refid="pack.@{project}.files"/>
<!-- <path><pathelement location="${build-quick.dir}/@{project}.complete"/></path> -->
</srcresources>
</uptodate>
<if><not><isset property="pack.@{project}.available"/></not><then>
<mkdir dir="${build-pack.dir}/@{targetdir}"/>
<pre/>
<if><not><equals arg1="@{manifest}" arg2=""/></not><then>
<jar whenmanifestonly="fail" destfile="@{destfile}" manifest="@{manifest}"> <!-- update="true" makes no difference on my machine, so starting from scratch-->
<jar-opts/>
<path refid="pack.@{project}.files"/>
</jar></then>
<else>
<jar whenmanifestonly="fail" destfile="@{destfile}">
<jar-opts/>
<path refid="pack.@{project}.files"/>
</jar>
</else></if>
</then></if>
</sequential>
</macrodef>
<macrodef name="staged-docs">
<attribute name="project"/>
<attribute name="dir" default="@{project}"/>
<attribute name="title"/>
<attribute name="docroot" default="NOT SET"/>
<element name="includes" implicit="true"/>
<sequential>
<staged-uptodate stage="docs" project="@{project}">
<check><srcfiles dir="${src.dir}/@{dir}"/></check>
<do>
<stopwatch name="docs.@{project}.timer"/>
<mkdir dir="${build-docs.dir}/@{project}"/>
<if><equals arg1="@{docroot}" arg2="NOT SET"/><then>
<!-- TODO: introduce docs.@{project}.build.path for classpathref -->
<scaladoc
destdir="${build-docs.dir}/@{project}"
doctitle="@{title}"
docversion="${version.number}"
sourcepath="${src.dir}"
classpathref="pack.compiler.path"
srcdir="${src.dir}/@{dir}"
addparams="${scalac.args.all}"
implicits="on"
diagrams="on"
groups="on"
rawOutput="${scaladoc.raw.output}"
noPrefixes="${scaladoc.no.prefixes}">
<includes/>
</scaladoc>
</then><else>
<scaladoc
destdir="${build-docs.dir}/@{project}"
doctitle="@{title}"
docversion="${version.number}"
sourcepath="${src.dir}"
classpathref="pack.compiler.path"
srcdir="${src.dir}/@{dir}"
docRootContent="${src.dir}/@{project}/@{docroot}"
addparams="${scalac.args.all}"
implicits="on"
diagrams="on"
groups="on"
rawOutput="${scaladoc.raw.output}"
noPrefixes="${scaladoc.no.prefixes}">
<includes/>
</scaladoc>
</else></if>
<stopwatch name="docs.@{project}.timer" action="total"/>
</do>
</staged-uptodate>
</sequential>
</macrodef>
<!-- ===========================================================================
LOCAL REFERENCE BUILD (LOCKER)
============================================================================ -->
<target name="locker.start" depends="asm.done, forkjoin.done, fjbg.done">
<condition property="locker.locked"><available file="${build-locker.dir}/locker.locked"/></condition></target>
<target name="locker.lib" depends="locker.start" unless="locker.locked">
<staged-build with="starr" stage="locker" project="library" srcpath="${src.dir}/library" includes="lib.includes">
<pre><staged-javac stage="locker" project="library" args="-XDignore.symbol.file"/></pre></staged-build></target>
<!-- TODO: args="-XDignore.symbol.file" necessary?? -->
<target name="locker.reflect" depends="locker.lib" unless="locker.locked"> <staged-build with="starr" stage="locker" project="reflect"/></target>
<target name="locker.comp" depends="locker.reflect" unless="locker.locked">
<staged-build with="starr" stage="locker" project="compiler">
<pre>
<staged-javac stage="locker" project="msil" destproject="compiler" excludes="**/tests/**"/>
<staged-scalac with="starr" stage="locker" project="msil" destproject="compiler"/>
</pre>
</staged-build>
</target>
<target name="locker.done" depends="locker.comp">
<mkdir dir="${build-locker.dir}"/>
<touch file="${build-locker.dir}/locker.locked" verbose="no"/>
</target>
<target name="locker.unlock"> <delete file="${build-locker.dir}/locker.locked"/>
<delete file="${build-locker.dir}/*.complete"/></target>
<!-- ===========================================================================
QUICK BUILD (QUICK)
============================================================================ -->
<target name="quick.start" depends="locker.done"/>
<target name="quick.lib" depends="quick.start">
<staged-build with="locker" stage="quick" project="library" srcpath="${src.dir}/library" includes="lib.rootdoc.includes">
<pre>
<staged-javac stage="quick" project="library" args="-XDignore.symbol.file"/> <!-- TODO: args="-XDignore.symbol.file" necessary?? -->
<staged-javac stage="quick" project="actors" destproject="library"/>
</pre>
<post>
<staged-scalac with="locker" stage="quick" project="actors" destproject="library"/>
</post>
</staged-build>
</target>
<target name="quick.reflect" depends="quick.lib"> <staged-build with="locker" stage="quick" project="reflect"/> </target>
<target name="quick.comp" depends="quick.reflect">
<staged-build with="locker" stage="quick" project="compiler">
<pre>
<staged-javac stage="quick" project="msil" destproject="compiler" excludes="**/tests/**"/>
<staged-scalac with="locker" stage="quick" project="msil" destproject="compiler"/>
</pre>
</staged-build>
</target>
<target name="quick.scalacheck" depends="quick.lib">
<staged-build with="locker" stage="quick" project="scalacheck" args="-nowarn"/>
</target>
<target name="quick.scalap" depends="quick.comp">
<staged-build with="locker" stage="quick" project="scalap"/>
</target>
<target name="quick.partest" depends="quick.scalap, quick.comp, asm.done">
<staged-build with="locker" stage="quick" project="partest" version="partest">
<pre><staged-javac stage="quick" project="partest"/></pre>
</staged-build>
</target>
<target name="quick.swing" depends="quick.lib" if="has.java6">
<staged-build with="locker" stage="quick" project="swing"/>
</target>
<target name="quick.plugins" depends="quick.comp">
<staged-uptodate stage="quick" project="plugins">
<check><srcfiles dir="${src.dir}/continuations"/></check>
<do>
<stopwatch name="quick.plugins.timer"/>
<mkdir dir="${build-quick.dir}/classes/continuations-plugin"/>
<staged-scalac with="locker" stage="quick" project="plugins" srcdir="continuations/plugin" destproject="continuations-plugin"/>
<copy
file="${src.dir}/continuations/plugin/scalac-plugin.xml"
todir="${build-quick.dir}/classes/continuations-plugin"/>
<!-- not very nice to create jar here but needed to load plugin -->
<mkdir dir="${build-quick.dir}/misc/scala-devel/plugins"/>
<jar whenmanifestonly="fail" destfile="${build-quick.dir}/misc/scala-devel/plugins/continuations.jar" basedir="${build-quick.dir}/classes/continuations-plugin"/>
<!-- might split off library part into its own ant target -->
<mkdir dir="${build-quick.dir}/classes/continuations-library"/>
<!-- have to compile with quick compiler here! -->
<staged-scalac with="quick" stage="quick" project="plugins"
srcdir="continuations/library" destproject="continuations-library"
args="-Xplugin-require:continuations -P:continuations:enable">
<compilerarg value="-Xpluginsdir"/>
<compilerarg file="${build-quick.dir}/misc/scala-devel/plugins"/>
</staged-scalac>
<stopwatch name="quick.plugins.timer" action="total"/>
</do>
</staged-uptodate>
</target>
<target name="quick.bin" depends="init">
<staged-bin stage="quick" classpathref="quick.bin.tool.path"/>
</target>
<target name="quick.done" depends="quick.lib, quick.reflect, quick.comp, quick.scalacheck, quick.scalap, quick.swing, quick.plugins, quick.partest, quick.bin"/>
<target name="quick-opt" description="Optimized version of quick.done."> <optimized name="quick.done"/></target>
<!-- ===========================================================================
PACKED QUICK BUILD (PACK)
============================================================================ -->
<target name="pack.lib" depends="quick.lib, quick.plugins, forkjoin.done">
<staged-pack project="library"/></target>
<target name="pack.actors" depends="quick.lib"> <staged-pack project="actors"/> </target>
<target name="pack.swing" if="has.java6" depends="quick.swing"> <staged-pack project="swing"/> </target>
<target name="pack.reflect" depends="quick.reflect"> <staged-pack project="reflect"/> </target>
<target name="pack.comp" depends="quick.comp, asm.done">
<staged-pack project="compiler" manifest="${build-pack.dir}/META-INF/MANIFEST.MF">
<pre> <!-- TODO the files copied here do not influence actuality of this target (nor does the manifest) -->
<copy file="${jline.jar}" toDir="${build-pack.dir}/lib"/>
<copy todir="${build-pack.dir}/lib">
<fileset dir="${lib-extra.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<mkdir dir="${build-pack.dir}/META-INF"/>
<copy file="${basedir}/META-INF/MANIFEST.MF" toDir="${build-pack.dir}/META-INF"/>
<manifest file="${build-pack.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Bundle-Version" value="${version.number}"/>
<attribute name="Class-Path" value="scala-reflect.jar scala-library.jar"/>
</manifest>
</pre>
<jar-opts>
<service type="javax.script.ScriptEngineFactory" provider="scala.tools.nsc.interpreter.IMain$Factory"/>
</jar-opts>
</staged-pack>
</target>
<target name="pack.plugins" depends="quick.plugins"> <staged-pack project="plugins" targetdir="misc/scala-devel/plugins" targetjar="continuations.jar"/> </target>
<target name="pack.scalacheck" depends="quick.scalacheck"> <staged-pack project="scalacheck" targetjar="scalacheck.jar"/> </target>
<target name="pack.partest" depends="quick.partest">
<staged-pack project="partest"/>
<!-- TODO the manifest should influence actuality of this target -->
<staged-pack project="partest-javaagent" manifest="${src.dir}/partest/scala/tools/partest/javaagent/MANIFEST.MF"/>
</target>
<target name="pack.scalap" depends="quick.scalap"> <staged-pack project="scalap" targetjar="scalap.jar"/> </target>
<target name="pack.bin" depends="pack.comp, pack.lib, pack.actors, pack.partest, pack.plugins, pack.reflect, pack.scalacheck, pack.scalap, pack.swing">
<staged-bin stage="pack"/>
</target>
<!-- depend on quick.done so quick.bin is run when pack.done is -->
<target name="pack.done" depends="quick.done, pack.bin">
<!-- copy maven dependencies -->
<copy todir="${build-pack.dir}/lib">
<resources refid="dependency.fileset" />
<mapper type="flatten" />
</copy>
<taskdef resource="scala/tools/ant/antlib.xml" classpathref="pack.compiler.path"/>
<taskdef resource="scala/tools/partest/antlib.xml" classpathref="partest.classpath"/>
</target>
<!-- ===========================================================================
BOOTSTRAPPING BUILD (STRAP)
============================================================================ -->
<target name="strap.lib" depends="quick.done">
<staged-build with="quick" stage="strap" project="library" srcpath="${src.dir}/library" includes="lib.rootdoc.includes">
<pre>
<staged-javac stage="strap" project="library" args="-XDignore.symbol.file"/> <!-- TODO: args="-XDignore.symbol.file" necessary?? -->
<staged-javac stage="strap" project="actors" destproject="library"/>
</pre>
<post>
<staged-scalac with="quick" stage="strap" project="actors" destproject="library"/>
</post>
</staged-build>
</target>
<target name="strap.reflect" depends="strap.lib"> <staged-build with="pack" stage="strap" project="reflect"/> </target>
<target name="strap.comp" depends="strap.reflect">
<staged-build with="pack" stage="strap" project="compiler">
<pre>
<staged-javac stage="strap" project="msil" destproject="compiler" excludes="**/tests/**"/>
<staged-scalac with="quick" stage="strap" project="msil" destproject="compiler"/>
</pre>
</staged-build>
</target>
<target name="strap.done" depends="strap.comp"/>
<target name="strap-opt" description="Optimized version of strap.done."> <optimized name="strap.done"/></target>
<!-- ===========================================================================
PACKED LOCKER BUILD (PALO)
============================================================================ -->
<target name="palo.done" depends="locker.done">
<mkdir dir="${build-palo.dir}/lib"/>
<jar whenmanifestonly="fail" destfile="${build-palo.dir}/lib/scala-library.jar">
<fileset dir="${build-locker.dir}/classes/library"/>
<fileset dir="${forkjoin-classes}"/>
</jar>
<jar whenmanifestonly="fail" destfile="${build-palo.dir}/lib/scala-reflect.jar" manifest="${basedir}/META-INF/MANIFEST.MF"
basedir="${build-locker.dir}/classes/reflect"/>
<jar whenmanifestonly="fail" destfile="${build-palo.dir}/lib/scala-compiler.jar" manifest="${basedir}/META-INF/MANIFEST.MF">
<fileset dir="${build-locker.dir}/classes/compiler"/>
<fileset dir="${asm-classes}"/>
<fileset dir="${fjbg-classes}"/>
</jar>
<copy file="${jline.jar}" toDir="${build-palo.dir}/lib"/>
</target>
<target name="palo.bin" depends="palo.done"> <staged-bin stage="palo"/></target>
<!-- ===========================================================================
OSGi Artifacts
============================================================================ -->
<target name="osgi.done" depends="pack.done">
<mkdir dir="${build-osgi.dir}"/>
<!-- simplify fixing pom versions -->
<macrodef name="make-bundle">
<attribute name="name" />
<attribute name="version" />
<sequential>
<copy file="${src.dir}/build/bnd/@{name}.bnd" tofile="${build-osgi.dir}/@{name}.bnd" overwrite="true">
<filterset>
<filter token="VERSION" value="@{version}" />
</filterset>
</copy>
<bnd classpath="${build-pack.dir}/lib/@{name}.jar"
eclipse="false"
failok="false"
exceptions="true"
files="${build-osgi.dir}/@{name}.bnd"
output="${build-osgi.dir}"/>
</sequential>
</macrodef>
<macrodef name="make-plugin-bundle">
<attribute name="name" />
<attribute name="version" />
<sequential>
<copy file="${src.dir}/build/bnd/@{name}.bnd" tofile="${build-osgi.dir}/@{name}.bnd" overwrite="true">
<filterset>
<filter token="VERSION" value="@{version}" />
</filterset>
</copy>
<bnd classpath="${build-pack.dir}/misc/scala-devel/plugins/@{name}.jar"
eclipse="false"
failok="false"
exceptions="true"
files="${build-osgi.dir}/@{name}.bnd"
output="${build-osgi.dir}"/>
</sequential>
</macrodef>
<uptodate property="osgi.bundles.available" targetfile="${build-osgi.dir}/bundles.complete">
<srcfiles dir="${basedir}">
<include name="build.xml"/>
<include name="src/build/bnd/*.bnd"/>
</srcfiles>
</uptodate>
<if><not><isset property="osgi.bundles.available"/></not><then>
<stopwatch name="osgi.bundle.timer"/>
<make-bundle name="scala-library" version="${osgi.version.number}" />
<make-bundle name="scala-actors" version="${osgi.version.number}" />
<make-bundle name="scala-reflect" version="${osgi.version.number}" />
<make-bundle name="scala-compiler" version="${osgi.version.number}" />
<make-plugin-bundle name="continuations" version="${osgi.version.number}" />
<touch file="${build-osgi.dir}/bundles.complete" verbose="no"/>
<if><isset property="has.java6"/><then>
<make-bundle name="scala-swing" version="${osgi.version.number}"/></then>
</if>
<stopwatch name="osgi.bundle.timer" action="total"/></then>
</if>
</target>
<!-- ===========================================================================
TEST SUITE
============================================================================ -->
<!-- bootstrapping stability: compare {quick,strap}/(lib|reflect|comp) -->
<target name="test.stability" depends="quick.lib, quick.reflect, quick.comp, strap.lib, strap.reflect, strap.comp">
<exec osfamily="unix" vmlauncher="false" executable="${basedir}/tools/stability-test.sh" failonerror="true" />
<!-- I think doing it this way means it will auto-pass on windows... that's the idea. If not, something like this. -->
<!-- <exec osfamily="windows" executable="foo" failonerror="false" failifexecutionfails="false" /> -->
</target>
<target name="test.stability-opt" description="Optimized version of test.stability."> <optimized name="test.stability"/></target>
<target name="test.osgi.init" depends="osgi.done">
<uptodate property="test.osgi.available" targetfile="${build-osgi.dir}/test-compile.complete">
<srcfiles dir="${test.osgi.src}">
<include name="**/*.scala"/>
</srcfiles>
</uptodate>
</target>
<target name="test.osgi.comp" depends="test.osgi.init, quick.done" unless="test.osgi.available">
<stopwatch name="test.osgi.compiler.timer"/>
<mkdir dir="${test.osgi.classes}"/>
<scalacfork
destdir="${test.osgi.classes}"
compilerpathref="quick.compiler.path"
params="${scalac.args.quick}"
srcdir="${test.osgi.src}"
jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath refid="test.osgi.compiler.build.path"/>
</scalacfork>
<touch file="${build-osgi.dir}/test-compile.complete" verbose="no"/>
<stopwatch name="test.osgi.compiler.timer" action="total"/>
</target>
<target name="test.osgi" depends="test.osgi.comp">
<stopwatch name="test.osgi.timer"/>
<mkdir dir="${test.osgi.classes}"/>
<junit fork="yes" haltonfailure="yes">
<classpath refid="test.osgi.compiler.build.path"/>
<batchtest fork="yes" todir="${build-osgi.dir}">
<fileset dir="${test.osgi.classes}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
<formatter type="brief" /> <!-- silenced by having it use a file; I tried for an hour to use other formatters but classpath issues drove me to this usefile="false" -->
</junit>
<stopwatch name="test.osgi.timer" action="total"/>
</target>
<!-- ===========================================================================
SBT Compiler Interface
============================================================================ -->
<target name="test.sbt" depends="quick.done">
<if><not><and>
<available file="${sbt.interface.jar}"/>
<available file="${sbt.interface.src.jar}"/></and></not>
<then>
<!-- Ensure directories exist -->
<mkdir dir="${sbt.src.dir}"/>
<mkdir dir="${sbt.lib.dir}"/>
<get src="${sbt.interface.url}" dest="${sbt.interface.jar}"/>
<get src="${sbt.interface.src.url}" dest="${sbt.interface.src.jar}"/>
<!-- Explode sources -->
<unzip src="${sbt.interface.src.jar}" dest="${sbt.src.dir}"/>
</then></if>
<stopwatch name="quick.sbt-interface.timer"/>
<mkdir dir="${build-sbt.dir}/classes"/>
<scalacfork
destdir="${build-sbt.dir}/classes"
compilerpathref="quick.compiler.path"
params="${scalac.args.quick}"
srcdir="${sbt.src.dir}"
jvmargs="${scalacfork.jvmargs}">
<include name="**/*.scala"/>
<compilationpath refid="sbt.compile.build.path"/>
</scalacfork>
<touch file="${build-sbt.dir}/sbt-interface.complete" verbose="no"/>
<stopwatch name="quick.sbt-interface.timer" action="total"/>
</target>
<property name="partest.srcdir" value="files" /> <!-- TODO: make targets for `pending` and other subdirs -->
<target name="test.run" depends="pack.done">
<partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
timeout="1200000"
srcdir="${partest.srcdir}"
scalacopts="${scalac.args.optimise}">
<compilationpath refid="partest.build.path"/>
<runtests dir="${partest.dir}/${partest.srcdir}/run" includes="*.scala"/>
<jvmtests dir="${partest.dir}/${partest.srcdir}/jvm" includes="*.scala"/>
</partest>
</target>
<target name="test.suite" depends="pack.done">
<partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
timeout="2400000"
srcdir="${partest.srcdir}"
scalacopts="${scalac.args.optimise}">
<compilationpath refid="partest.build.path"/>
<postests dir="${partest.dir}/${partest.srcdir}/pos" includes="*.scala"/>
<negtests dir="${partest.dir}/${partest.srcdir}/neg" includes="*.scala"/>
<runtests dir="${partest.dir}/${partest.srcdir}/run" includes="*.scala"/>
<jvmtests dir="${partest.dir}/${partest.srcdir}/jvm" includes="*.scala"/>
<residenttests dir="${partest.dir}/${partest.srcdir}/res" includes="*.res"/>
<buildmanagertests dir="${partest.dir}/${partest.srcdir}/buildmanager" includes="*"/>
<scalaptests dir="${partest.dir}/${partest.srcdir}/scalap" includes="**/*.scala"/>
<scalachecktests dir="${partest.dir}/${partest.srcdir}/scalacheck">
<include name="*.scala"/>
</scalachecktests>
<specializedtests dir="${partest.dir}/${partest.srcdir}/specialized">
<include name="*.scala"/>
</specializedtests>
<instrumentedtests dir="${partest.dir}/${partest.srcdir}/instrumented">
<include name="*.scala"/>
</instrumentedtests>
</partest>
</target>
<target name="test.continuations.suite" depends="pack.done">
<partest showlog="yes" erroronfailed="yes" javacmd="${java.home}/bin/java"
timeout="2400000"
srcdir="${partest.srcdir}"
scalacopts="${scalac.args.optimise} -Xplugin-require:continuations -P:continuations:enable">
<compilerarg value="-Xpluginsdir"/>
<compilerarg file="${build-quick.dir}/misc/scala-devel/plugins"/>
<compilationpath refid="partest.build.path"/>
<negtests dir="${partest.dir}/${partest.srcdir}/continuations-neg" includes="*.scala"/>
<runtests dir="${partest.dir}/${partest.srcdir}/continuations-run" includes="*.scala"/>
</partest>
</target>
<target name="test.scaladoc" depends="pack.done">
<partest erroronfailed="yes" scalacopts="${scalac.args.optimise}" showlog="yes">
<compilationpath refid="partest.build.path"/>
<runtests dir="${partest.dir}/scaladoc/run" includes="*.scala" />
<scalachecktests dir="${partest.dir}/scaladoc/scalacheck" includes="*.scala" />
</partest>
</target>
<target name="test.interactive" depends="pack.done">
<partest erroronfailed="yes" scalacopts="${scalac.args.optimise}" showlog="yes">
<compilationpath refid="partest.build.path"/>
<presentationtests dir="${partest.dir}/${partest.srcdir}/presentation">
<include name="*/*.scala"/>
</presentationtests>
</partest>
</target>
<!-- for use in PR validation, where stability is rarely broken, so we're going to use starr for locker,
and skip test.stability (which requires locker == quick) -->
<target name="test.core" depends="test.osgi, test.sbt, test.bc, test.interactive, test.continuations.suite, test.scaladoc, test.suite"/>
<target name="test.done" depends="test.core, test.stability"/>
<!-- ===========================================================================
BINARY COMPATIBILITY TESTING
============================================================================ -->
<target name="bc.init" depends="init" unless="maven-deps-done-mima">
<property name="bc-reference-version" value="2.10.0"/>
<property name="bc-build.dir" value="${build.dir}/bc"/>
<!-- Obtain mima -->
<mkdir dir="${bc-build.dir}"/>
<!-- Pull down MIMA -->
<artifact:dependencies pathId="mima.classpath">
<dependency groupId="com.typesafe" artifactId="mima-reporter_2.9.2" version="0.1.5"/>
</artifact:dependencies>
<artifact:dependencies pathId="old.bc.classpath">
<dependency groupId="org.scala-lang" artifactId="scala-swing" version="${bc-reference-version}"/>
<dependency groupId="org.scala-lang" artifactId="scala-library" version="${bc-reference-version}"/>
<dependency groupId="org.scala-lang" artifactId="scala-reflect" version="${bc-reference-version}"/>
</artifact:dependencies>
<property name="maven-deps-done-mima" value="true"/>
</target>
<macrodef name="bc.run-mima">
<attribute name="jar-name"/>
<attribute name="prev"/>
<attribute name="curr"/>
<attribute name="direction"/>
<sequential>
<echo message="Checking @{direction} binary compatibility for @{jar-name} (against ${bc-reference-version})"/>
<java taskname="mima"
fork="true"
failonerror="true"
classname="com.typesafe.tools.mima.cli.Main">
<arg value="--prev"/>
<arg value="@{prev}"/>
<arg value="--curr"/>
<arg value="@{curr}"/>
<arg value="--filters"/>
<arg value="${basedir}/bincompat-@{direction}.whitelist.conf"/>
<arg value="--generate-filters"/>
<classpath>
<path refid="mima.classpath"/>
</classpath>
</java>
</sequential>
</macrodef>
<macrodef name="bc.check">
<attribute name="jar-name"/>
<sequential>
<bc.run-mima
jar-name="@{jar-name}"
prev="${org.scala-lang:@{jar-name}:jar}"
curr="${build-pack.dir}/lib/@{jar-name}.jar"
direction="backward"/>
<bc.run-mima
jar-name="@{jar-name}"
prev="${build-pack.dir}/lib/@{jar-name}.jar"
curr="${org.scala-lang:@{jar-name}:jar}"
direction="forward"/>
</sequential>
</macrodef>
<target name="test.bc-opt" description="Optimized version of test.bc."> <optimized name="test.bc"/></target>
<target name="test.bc" depends="bc.init, pack.lib, pack.reflect, pack.swing">
<bc.check jar-name="scala-library"/>
<bc.check jar-name="scala-reflect"/>
<bc.check jar-name="scala-swing"/>
</target>
<!-- ===========================================================================
DOCUMENTATION
============================================================================ -->
<target name="docs.start" depends="pack.done">
<!-- Set the github commit scaladoc sources point to -->
<!-- For releases, look for the tag with the same name as the maven version -->
<condition property="scaladoc.git.commit" value="v${maven.version.number}">
<isset property="build.release"/>
</condition>
<!-- For snapshots, if we know the commit, point scaladoc to that particular commit instead of master -->
<condition property="scaladoc.git.commit" value="${git.commit.sha}">
<not><equals arg1="${git.commit.sha}" arg2="unknown"/></not>
</condition>
<!-- Fallback: point scaladoc to master -->
<property name="scaladoc.git.commit" value="master"/>
<!-- Compute the URL and show it -->
<property name="scaladoc.url" value="https://github.com/scala/scala/tree/${scaladoc.git.commit}/src"/>
<echo message="Scaladoc will point to ${scaladoc.url} for source files."/>
<!-- Unless set with -Dscaladoc.<...>, these won't be activated -->
<property name="scaladoc.raw.output" value="no"/>
<property name="scaladoc.no.prefixes" value="no"/>
</target>
<target name="docs.lib" depends="docs.start">
<staged-uptodate stage="docs" project="library">
<check><srcfiles dir="${src.dir}">
<include name="library/**"/>
<include name="swing/**"/>
<include name="actors/**"/>
<include name="reflect/**"/>
<include name="continuations/library/**"/>
</srcfiles></check>
<do>
<stopwatch name="docs.lib.timer"/>
<mkdir dir="${build-docs.dir}/library"/>
<!-- last three attributes not supported by staged-docs: -->
<scaladoc
destdir="${build-docs.dir}/library"
doctitle="Scala Standard Library API (Scaladoc)"
docversion="${version.number}"
docsourceurl="${scaladoc.url}€{FILE_PATH}.scala#L1"
sourcepath="${src.dir}"
classpathref="pack.compiler.path"
addparams="${scalac.args.all}"
docRootContent="${src.dir}/library/rootdoc.txt"
implicits="on"
diagrams="on"
groups="on"
rawOutput="${scaladoc.raw.output}"
noPrefixes="${scaladoc.no.prefixes}"
docfooter="epfl"
docUncompilable="${src.dir}/library-aux"
skipPackages="scala.reflect.macros.internal:scala.reflect.internal:scala.reflect.io:scala.concurrent.impl">
<src>
<files includes="${src.dir}/actors"/>
<files includes="${src.dir}/library"/>
<files includes="${src.dir}/reflect"/>
<files includes="${src.dir}/swing"/>
<files includes="${src.dir}/continuations/library"/>
</src>
<include name="**/*.scala"/>
<exclude name="reflect/Code.scala"/>
<exclude name="reflect/Print.scala"/>
<exclude name="reflect/Symbol.scala"/>
<exclude name="reflect/Tree.scala"/>
<exclude name="reflect/Type.scala"/>
<exclude name="runtime/*$.scala"/>
<exclude name="runtime/ScalaRunTime.scala"/>
<exclude name="runtime/StringAdd.scala"/>
</scaladoc>
<stopwatch name="docs.lib.timer" action="total"/>
</do>
</staged-uptodate>
</target>
<target name="docs.comp" depends="docs.start">
<staged-docs project="compiler" title="Scala Compiler" docroot="rootdoc.txt">
<include name="**/*.scala"/>
</staged-docs>
</target>
<target name="docs.jline" depends="docs.start">
<staged-docs project="jline" dir="jline/src/main/java" title="Scala JLine">
<include name="**/*.scala"/>
<include name="**/*.java"/>
</staged-docs>
</target>
<target name="docs.scalap" depends="docs.start">
<staged-docs project="scalap" title="Scalap">
<include name="**/*.scala"/>
</staged-docs>
</target>
<target name="docs.partest" depends="docs.start">
<staged-docs project="partest" title="Scala Parallel Testing Framework">
<include name="**/*.scala"/>
</staged-docs>
</target>
<target name="docs.continuations-plugin" depends="docs.start">
<staged-docs project="continuations-plugin" dir="continuations/plugin" title="Delimited Continuations Compiler Plugin">
<include name="**/*.scala"/>
</staged-docs>
</target>
<target name="docs.man" depends="docs.start">
<staged-uptodate stage="docs" project="manual">
<check><srcfiles dir="${src.dir}/manual"/></check>
<do>
<mkdir dir="${build.dir}/manmaker/classes"/>
<scalac
destdir="${build.dir}/manmaker/classes"
classpathref="pack.compiler.path"
srcdir="${src.dir}/manual"
includes="**/*.scala"
addparams="${scalac.args.all}"/>
<mkdir dir="${build-docs.dir}/manual/man/man1"/>
<mkdir dir="${build-docs.dir}/manual/html"/>
<mkdir dir="${build-docs.dir}/manual/genman/man1"/>
<taskdef name="genman"
classname="scala.tools.docutil.ManMaker"
classpathref="manual.classpath"/>
<genman command="fsc, scala, scalac, scaladoc, scalap"
htmlout="${build-docs.dir}/manual/html"
manout="${build-docs.dir}/manual/genman"/>
<!-- On Windows source and target files can't be the same ! -->
<fixcrlf
srcdir="${build-docs.dir}/manual/genman"
destdir="${build-docs.dir}/manual/man"
eol="unix" includes="**/*.1"/>
<copy todir="${build-docs.dir}/manual/html">
<fileset dir="${src.dir}/manual/scala/tools/docutil/resources">
<include name="**/*.html"/>
<include name="**/*.css"/>
<include name="**/*.gif"/>
<include name="**/*.png"/>
</fileset>
</copy>
</do>
</staged-uptodate>
</target>
<target name="docs.done" depends="docs.jline, docs.comp, docs.man, docs.lib, docs.scalap, docs.partest, docs.continuations-plugin"/>
<!-- ===========================================================================
DISTRIBUTION
============================================================================ -->
<target name="dist.base" depends="pack.done, osgi.done">
<property name="dist.name" value="scala-${version.number}"/>
<property name="dist.dir" value="${dists.dir}/${dist.name}"/>
<macrodef name="copy-bundle">
<attribute name="name" />
<sequential>
<copy file="${build-osgi.dir}/org.scala-lang.@{name}.jar"
tofile="${dist.dir}/lib/@{name}.jar"/>
</sequential>
</macrodef>
<macrodef name="copy-plugin-bundle">
<attribute name="name" />
<sequential>
<copy file="${build-osgi.dir}/org.scala-lang.plugins.@{name}.jar"
tofile="${dist.dir}/misc/scala-devel/plugins/@{name}.jar"
overwrite="yes"/>
</sequential>
</macrodef>
<mkdir dir="${dist.dir}/lib"/>
<copy toDir="${dist.dir}/lib">
<fileset dir="${build-pack.dir}/lib">
<include name="jline.jar"/>
<include name="scalacheck.jar"/>
<include name="scala-partest.jar"/>
<include name="scalap.jar"/>
</fileset>
<resources refid="partest.extras.fileset"/>
</copy>
<mkdir dir="${dist.dir}/bin"/>
<!-- TODO - Stop being inefficient and don't copy OSGi bundles overtop other jars. -->
<copy-bundle name="scala-library"/>
<copy-bundle name="scala-reflect"/>
<copy-bundle name="scala-swing"/>
<copy-bundle name="scala-actors"/>
<copy-bundle name="scala-compiler"/>
<copy toDir="${dist.dir}/bin">
<fileset dir="${build-pack.dir}/bin"/>
</copy>
<chmod perm="ugo+rx" file="${dist.dir}/bin/scala"/>
<chmod perm="ugo+rx" file="${dist.dir}/bin/scalac"/>
<chmod perm="ugo+rx" file="${dist.dir}/bin/scaladoc"/>
<chmod perm="ugo+rx" file="${dist.dir}/bin/fsc"/>
<chmod perm="ugo+rx" file="${dist.dir}/bin/scalap"/>
<mkdir dir="${dist.dir}/misc/scala-devel/plugins"/>
<copy-plugin-bundle name="continuations"/>
</target>
<target name="dist.doc" depends="dist.base, docs.done">
<mkdir dir="${dist.dir}/doc/scala-devel-docs"/>
<copy file="${docs.dir}/LICENSE" toDir="${dist.dir}/doc"/>
<copy file="${docs.dir}/README" toDir="${dist.dir}/doc"/>
<mkdir dir="${dist.dir}/doc/scala-devel-docs/api"/>
<copy toDir="${dist.dir}/doc/scala-devel-docs/api">
<fileset dir="${build-docs.dir}/library"/>
</copy>
<mkdir dir="${dist.dir}/doc/scala-devel-docs/examples"/>
<copy toDir="${dist.dir}/doc/scala-devel-docs/examples">
<fileset dir="${docs.dir}/examples">
<exclude name="**/*.desired.sha1"/>
</fileset>
</copy>
<mkdir dir="${dist.dir}/doc/scala-devel-docs/tools"/>
<copy toDir="${dist.dir}/doc/scala-devel-docs/tools">
<fileset dir="${build-docs.dir}/manual/html"/>
</copy>
<copy file="${src.dir}/swing/doc/README"
toFile="${dist.dir}/doc/scala-devel-docs/README.scala-swing"/>
</target>
<target name="dist.man" depends="dist.base">
<mkdir dir="${dist.dir}/man"/>
<copy toDir="${dist.dir}/man">
<fileset dir="${build-docs.dir}/manual/man"/>
</copy>
</target>
<target name="dist.src" depends="dist.base">
<mkdir dir="${dist.dir}/src"/>
<jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-library-src.jar">
<fileset dir="${src.dir}/library"/>
<fileset dir="${src.dir}/continuations/library"/>
</jar>
<jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-reflect-src.jar" basedir="${src.dir}/reflect"/>
<jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-swing-src.jar" basedir="${src.dir}/swing"/>
<jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-compiler-src.jar" basedir="${src.dir}/compiler"/>
<jar whenmanifestonly="fail" destfile="${dist.dir}/src/fjbg-src.jar" basedir="${src.dir}/fjbg"/>
<jar whenmanifestonly="fail" destfile="${dist.dir}/src/msil-src.jar" basedir="${src.dir}/msil"/>
<jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-actors-src.jar" basedir="${src.dir}/actors"/>
<jar whenmanifestonly="fail" destfile="${dist.dir}/src/scalap-src.jar" basedir="${src.dir}/scalap"/>
<jar whenmanifestonly="fail" destfile="${dist.dir}/src/scala-partest-src.jar" basedir="${src.dir}/partest"/>
</target>
<target name="dist.partial" depends="dist.base">
<if><not><os family="windows"/></not><then>
<symlink link="${dists.dir}/latest" resource="${dist.name}" overwrite="yes"/>
</then><else> <!-- XXX THIS PROBABLY DOES NOT WORK: copying must happen last during dist.done! is this guaranteed? -->
<copydir dest="${dists.dir}/latest" src="${dist.dir}"/>
</else></if>
</target>
<target name="dist.done" depends="dist.doc, dist.man, dist.src, dist.partial"/>
<!-- ===========================================================================
STABLE REFERENCE (STARR)
============================================================================ -->
<!-- Does not use any properties other than ${basedir}, so that it can
run without 'init' (when using 'replacestarrwin') -->
<target name="starr.start">
<fail message="Library in build/pack not available">
<condition><not><and>
<available file="${build-pack.dir}/lib/scala-library.jar"/>
</and></not></condition>
</fail>
<fail message="Compiler in build/quick not available">
<condition><not><and>
<available file="${build-quick.dir}/classes/compiler"/>
<available file="${build-quick.dir}/compiler.complete"/>
</and></not></condition>
</fail>
</target>
<target name="starr.jars" depends="starr.start">
<copy toDir="${lib.dir}" overwrite="yes">
<fileset dir="${build-pack.dir}/lib">
<include name="scala-library.jar"/>
<include name="scala-reflect.jar"/>
<include name="scala-compiler.jar"/>
</fileset>
</copy>
</target>
<target name="starr.src" depends="starr.jars">
<jar whenmanifestonly="fail" destfile="${lib.dir}/scala-library-src.jar">
<fileset dir="${src.dir}/library"/>
<fileset dir="${src.dir}/swing"/>
<fileset dir="${src.dir}/actors"/>
<fileset dir="${src.dir}/forkjoin"/>
</jar>
<jar whenmanifestonly="fail" destfile="${lib.dir}/scala-reflect-src.jar" basedir="${src.dir}/reflect"/>
<jar whenmanifestonly="fail" destfile="${lib.dir}/scala-compiler-src.jar">
<fileset dir="${src.dir}/compiler"/>
<fileset dir="${src.dir}/asm"/>
</jar>
</target>
<target name="starr.removesha1" depends="starr.src">
<!-- remove SHA1 files for no starr, so we don't loose artifacts. -->
<delete>
<fileset dir="${lib.dir}">
<include name="scala-compiler.jar.desired.sha1"/>
<include name="scala-reflect.jar.desired.sha1"/>
<include name="scala-library.jar.desired.sha1"/>
<include name="scala-library-src.jar.desired.sha1"/>
<include name="scala-reflect-src.jar.desired.sha1"/>
<include name="scala-compiler-src.jar.desired.sha1"/>
</fileset>
</delete>
</target>
<target name="starr.done" depends="starr.jars, starr.removesha1"/>
<target name="replacestarr" description="Replaces the Starr compiler and library by fresh ones built from current sources and tests them.">
<fail message="This target is not available on Windows. Use 'ant replacestarrwin' instead.">
<condition>
<os family="windows"/>
</condition>
</fail>
<!-- needs antcall to enforce ordering -->
<antcall target="locker.clean"/>
<antcall target="pack.done"/>
<antcall target="starr.done"/>
<antcall target="locker.clean"/>
<antcall target="test.done"/>
</target>
<target name="replacestarr-opt" description="Replaces the Starr compiler and library by fresh, optimised ones built from current sources and tests them.">
<optimized name="replacestarr"/></target>
<!-- Ant on Windows is not able to delete jar files that are referenced in any <path>.
See ticket 1290 on trac. -->
<target name="replacestarrwin" description="Creates a new Starr on Windows. Manually execute 'ant locker.clean build' first!">
<fail message="This target is only available on Windows. Use 'ant replacestarr' instead.">
<condition>
<not><os family="windows"/></not>
</condition>
</fail>
<echo message="CAUTION: Make sure to execute 'ant locker.clean build' prior to calling 'replacestarrwin'."/>
<antcall target="starr.done"/>
<antcall target="locker.clean"/>
<antcall target="test.done"/>
</target>
<target name="replacestarrwin-opt" description="Creates a new Starr on Windows. Manually execute 'ant locker.clean build' first!">
<optimized name="replacestarrwin"/></target>
<target name="replacelocker" description="Replaces the Locker compiler and library by fresh ones built from current sources."
depends="palo.clean, locker.unlock, palo.done"/>
<target name="replacelocker-opt" description="Replaces the Locker compiler and library by fresh, optimised ones built from current sources.">
<optimized name="replacelocker"/></target>
<target name="buildlocker" description="Does the same for locker as build does for quick." depends="locker.unlock, palo.bin"/>
<target name="unlocklocker" description="Same as buildlocker." depends="buildlocker"/> <!-- REMOVE -->
<target name="fastlocker.lib" description="Buildlocker without extra fuss" depends="locker.unlock, locker.lib">
<property name="fastlocker" value="true"/>
</target>
<target name="fastlocker.reflect" description="Buildlocker without extra fuss" depends="locker.unlock, locker.reflect">
<property name="fastlocker" value="true"/>
</target>
<target name="fastlocker.comp" description="Buildlocker without extra fuss" depends="locker.unlock, locker.comp">
<property name="fastlocker" value="true"/>
</target>
<target name="fastlocker" description="Buildlocker without extra fuss" depends="fastlocker.comp"/>
<!-- ===========================================================================
VISUALIZATION
============================================================================ -->
<target name="graph.init">
<taskdef name="vizant" classname="vizant.Vizant" classpath="${lib-ant.dir}/vizant.jar"/>
</target>
<target name="graph.all" depends="graph.init">
<vizant antfile="${ant.file}" outfile="${ant.project.name}.dot" from="all.done"/>
</target>
<target name="graph.sabbus" depends="graph.init">
<vizant antfile="${ant.file}" outfile="${ant.project.name}.dot"/>
</target>
</project>
|