Skip to content

Commit 1f8aac8

Browse files
committed
Adding JDK7 friendly build.
Essentially this just disables swing if you're on JDK7 so you can actually build and use Scala.
1 parent 1c2d466 commit 1f8aac8

File tree

1 file changed

+64
-35
lines changed

1 file changed

+64
-35
lines changed

build.xml

Lines changed: 64 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -334,16 +334,31 @@ INITIALISATION
334334
<target name="init.version.done" depends="init.version.release, init.version.snapshot"/>
335335

336336
<target name="init.testjava6">
337-
<fail message="This build requires JDK 1.6">
338-
<condition>
339-
<not>
337+
<condition property="has.java6">
340338
<equals arg1="${ant.java.version}" arg2="1.6"/>
341-
</not>
342339
</condition>
343-
</fail>
340+
<condition property="has.java7">
341+
<equals arg1="${ant.java.version}" arg2="1.7"/>
342+
</condition>
343+
<condition property="has.unsupported.jdk">
344+
<not><or>
345+
<isset property="has.java7" />
346+
<isset property="has.java6" />
347+
</or></not>
348+
</condition>
344349
</target>
345350

346-
<target name="init" depends="init.jars, init.maven.jars, init.version.done">
351+
<target name="init.fail.bad.jdk" depends="init.testjava6">
352+
<fail if="has.unsupported.jdk"
353+
message="JDK ${ant.java.version} is not supported by this build!"/>
354+
</target>
355+
<target name="init.warn.jdk7" depends="init.testjava6" if="has.java7">
356+
<echo level="warning"> You are using JDK7 for this build. While this will be able to build most of Scala, it will
357+
not build the Swing project. You will be unable to create a distribution.
358+
</echo>
359+
</target>
360+
361+
<target name="init" depends="init.jars, init.maven.jars, init.version.done, init.fail.bad.jdk, init.warn.jdk7">
347362
<property name="scalac.args.always" value="" />
348363
<!-- scalac.args.optimise is selectively overridden in certain antcall tasks. -->
349364
<property name="scalac.args.optimise" value=""/>
@@ -467,7 +482,7 @@ LOCAL DEPENDENCY (Adapted ASM)
467482
<!-- ===========================================================================
468483
LOCAL DEPENDENCY (FORKJOIN)
469484
============================================================================ -->
470-
<target name="forkjoin.start" depends="init, init.testjava6">
485+
<target name="forkjoin.start" depends="init">
471486
<uptodate property="forkjoin.available" targetfile="${build-libs.dir}/forkjoin.complete">
472487
<srcfiles dir="${src.dir}/forkjoin">
473488
<include name="**/*.java"/>
@@ -978,15 +993,6 @@ QUICK BUILD (QUICK)
978993
<include name="**/*.scala"/>
979994
<compilationpath refid="quick.compilation.path"/>
980995
</scalacfork>
981-
<scalacfork
982-
destdir="${build-quick.dir}/classes/library"
983-
compilerpathref="locker.classpath"
984-
params="${scalac.args.quick}"
985-
srcdir="${src.dir}/swing"
986-
jvmargs="${scalacfork.jvmargs}">
987-
<include name="**/*.scala"/>
988-
<compilationpath refid="quick.compilation.path"/>
989-
</scalacfork>
990996
<propertyfile file="${build-quick.dir}/classes/library/library.properties">
991997
<entry key="version.number" value="${version.number}"/>
992998
<entry key="maven.version.number" value="${maven.version.number}"/>
@@ -1001,12 +1007,26 @@ QUICK BUILD (QUICK)
10011007
<include name="**/*.css"/>
10021008
</fileset>
10031009
</copy>
1004-
<touch file="${build-quick.dir}/library.complete" verbose="no"/>
1005-
<stopwatch name="quick.lib.timer" action="total"/>
10061010
</target>
10071011

1012+
<target name="quick.swing" depends="quick.lib" if="has.java6" unless="quick.lib.available">
1013+
<scalacfork
1014+
destdir="${build-quick.dir}/classes/library"
1015+
compilerpathref="locker.classpath"
1016+
params="${scalac.args.quick}"
1017+
srcdir="${src.dir}/swing"
1018+
jvmargs="${scalacfork.jvmargs}">
1019+
<include name="**/*.scala"/>
1020+
<compilationpath refid="quick.compilation.path"/>
1021+
</scalacfork>
1022+
</target>
1023+
1024+
<target name="quick.lib.done" depends="quick.swing, quick.lib">
1025+
<stopwatch name="quick.lib.timer" action="total"/>
1026+
<touch file="${build-quick.dir}/library.complete" verbose="no"/>
1027+
</target>
10081028

1009-
<target name="quick.pre-reflect" depends="quick.lib">
1029+
<target name="quick.pre-reflect" depends="quick.lib.done">
10101030
<uptodate property="quick.reflect.available" targetfile="${build-quick.dir}/reflect.complete">
10111031
<srcfiles dir="${src.dir}">
10121032
<include name="reflect/**"/>
@@ -1412,11 +1432,6 @@ PACKED QUICK BUILD (PACK)
14121432
</fileset>
14131433
<fileset dir="${build-libs.dir}/classes/forkjoin"/>
14141434
</jar>
1415-
<jar destfile="${build-pack.dir}/lib/scala-swing.jar">
1416-
<fileset dir="${build-quick.dir}/classes/library">
1417-
<include name="scala/swing/**"/>
1418-
</fileset>
1419-
</jar>
14201435
<jar destfile="${build-pack.dir}/lib/scala-actors.jar">
14211436
<fileset dir="${build-quick.dir}/classes/library">
14221437
<include name="scala/actors/**"/>
@@ -1427,7 +1442,15 @@ PACKED QUICK BUILD (PACK)
14271442
</jar>
14281443
</target>
14291444

1430-
<target name="pack.pre-reflect" depends="pack.lib">
1445+
<target name="pack.swing" depends="pack.lib" if="has.java6">
1446+
<jar destfile="${build-pack.dir}/lib/scala-swing.jar">
1447+
<fileset dir="${build-quick.dir}/classes/library">
1448+
<include name="scala/swing/**"/>
1449+
</fileset>
1450+
</jar>
1451+
</target>
1452+
1453+
<target name="pack.pre-reflect" depends="pack.lib, pack.swing">
14311454
<uptodate
14321455
property="pack.reflect.available"
14331456
targetfile="${build-pack.dir}/lib/scala-reflect.jar"
@@ -1643,15 +1666,6 @@ BOOTSTRAPPING BUILD (STRAP)
16431666
<include name="**/*.scala"/>
16441667
<compilationpath refid="strap.compilation.path"/>
16451668
</scalacfork>
1646-
<scalacfork
1647-
destdir="${build-strap.dir}/classes/library"
1648-
compilerpathref="pack.classpath"
1649-
params="${scalac.args.quick}"
1650-
srcdir="${src.dir}/swing"
1651-
jvmargs="${scalacfork.jvmargs}">
1652-
<include name="**/*.scala"/>
1653-
<compilationpath refid="strap.compilation.path"/>
1654-
</scalacfork>
16551669
<propertyfile file="${build-strap.dir}/classes/library/library.properties">
16561670
<entry key="version.number" value="${version.number}"/>
16571671
<entry key="maven.version.number" value="${maven.version.number}"/>
@@ -1666,11 +1680,26 @@ BOOTSTRAPPING BUILD (STRAP)
16661680
<include name="**/*.css"/>
16671681
</fileset>
16681682
</copy>
1683+
</target>
1684+
1685+
<target name="strap.swing" if="has.java6" unless="strap.lib.available" depends="strap.lib">
1686+
<scalacfork
1687+
destdir="${build-strap.dir}/classes/library"
1688+
compilerpathref="pack.classpath"
1689+
params="${scalac.args.quick}"
1690+
srcdir="${src.dir}/swing"
1691+
jvmargs="${scalacfork.jvmargs}">
1692+
<include name="**/*.scala"/>
1693+
<compilationpath refid="strap.compilation.path"/>
1694+
</scalacfork>
1695+
</target>
1696+
1697+
<target name="strap.lib.done" depends="strap.swing, strap.lib">
16691698
<touch file="${build-strap.dir}/library.complete" verbose="no"/>
16701699
<stopwatch name="strap.lib.timer" action="total"/>
16711700
</target>
16721701

1673-
<target name="strap.pre-reflect" depends="strap.lib">
1702+
<target name="strap.pre-reflect" depends="strap.lib.done">
16741703
<uptodate property="strap.reflect.available" targetfile="${build-strap.dir}/reflect.complete">
16751704
<srcfiles dir="${src.dir}/reflect"/>
16761705
</uptodate>

0 commit comments

Comments
 (0)