Skip to content

Commit e1895d6

Browse files
committed
Add scala-java8-compat to scala-library.jar
When the ant build is run with `-Dscala-java8-compat.package`, the contents of `org.scala-lang.modules:scala-java8-compat` are spliced into `scala-library.jar`. This is handy to facilitate downstream testing of indy lambdas, we can just use the the compiler options `-target 1.8 -Ydelambdafy:method -Xexperimental` without needed to add `scala-java8-compat.jar` to the compile and runtime classpaths. (Classpath augmentation doesn't appear to be straight forward in partest or in the community build.)
1 parent 74e324d commit e1895d6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

build.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ TODO:
266266
-->
267267
<if><not><isset property="maven-deps-done"></isset></not><then>
268268
<mkdir dir="${user.home}/.m2/repository"/>
269+
270+
<artifact:remoteRepository id="sonatype-release" url="https://oss.sonatype.org/content/repositories/releases"/>
271+
<artifact:remoteRepository id="sonatype-snapshots" url="https://oss.sonatype.org/content/repositories/snapshots"/>
272+
<artifact:remoteRepository id="extra-repo" url="${extra.repo.url}"/>
273+
269274
<!-- This task has an issue where if the user directory does not exist, so we create it above. UGH. -->
270275
<artifact:dependencies pathId="extra.tasks.classpath" filesetId="extra.tasks.fileset">
271276
<dependency groupId="biz.aQute" artifactId="bnd" version="1.50.0"/>
@@ -307,6 +312,36 @@ TODO:
307312
<artifact:remoteRepository id="sonatype-release" url="https://oss.sonatype.org/content/repositories/releases"/>
308313
<artifact:remoteRepository id="extra-repo" url="${extra.repo.url}"/>
309314

315+
<!-- scala-java8-compat, used by the experimental -target jvm-1.8 support. -->
316+
<if><isset property="scala-java8-compat.package"/><then>
317+
<property name="scala-java8-compat.version" value="0.2.0"/>
318+
<property name="scala-java8-compat.binary.version" value="2.11"/>
319+
<artifact:dependencies pathId="scala-java8-compat.classpath" filesetId="scala-java8-compat.fileset">
320+
<dependency groupId="org.scala-lang.modules" artifactId="scala-java8-compat_${scala-java8-compat.binary.version}" version="${scala-java8-compat.version}">
321+
<exclusion groupId="org.scala-lang" artifactId="scala-library"/>
322+
</dependency>
323+
</artifact:dependencies>
324+
<property name="scala-java8-compat-classes" value="${build-quick.dir}/scala-java8-compat"/>
325+
<delete dir="${scala-java8-compat-classes}"/>
326+
<unzip dest="${scala-java8-compat-classes}">
327+
<fileset refid="scala-java8-compat.fileset"/>
328+
<patternset>
329+
<include name="**/*.class"/>
330+
</patternset>
331+
</unzip>
332+
<path id="scala-java8-compat.libs">
333+
<pathelement location="${scala-java8-compat-classes}"/>
334+
</path>
335+
<fileset id="scala-java8-compat.fileset" dir="${scala-java8-compat-classes}">
336+
<include name="**/*"/>
337+
</fileset>
338+
</then>
339+
<else>
340+
<path id="scala-java8-compat.libs"/>
341+
<fileset id="scala-java8-compat.fileset" dir="." excludes="**"/>
342+
</else>
343+
</if>
344+
310345
<!-- prepare, for each of the names below, the property "@{name}.cross", set to the
311346
necessary cross suffix (usually something like "_2.11.0-M6". -->
312347
<prepareCross name="scala-xml" />
@@ -718,6 +753,7 @@ TODO:
718753
<pathelement location="${build-locker.dir}/classes/library"/>
719754
<path refid="forkjoin.classpath"/>
720755
<path refid="aux.libs"/>
756+
<path refid="scala-java8-compat.libs"/>
721757
</path>
722758

723759
<path id="locker.reflect.build.path">
@@ -739,6 +775,7 @@ TODO:
739775
<pathelement location="${build-quick.dir}/classes/library"/>
740776
<path refid="forkjoin.classpath"/>
741777
<path refid="aux.libs"/>
778+
<path refid="scala-java8-compat.libs"/>
742779
</path>
743780

744781
<path id="quick.actors.build.path">
@@ -827,6 +864,7 @@ TODO:
827864
<path id="pack.library.files">
828865
<fileset dir="${build-quick.dir}/classes/library"/>
829866
<fileset dir="${forkjoin-classes}"/>
867+
<fileset refid="scala-java8-compat.fileset"/>
830868
</path>
831869

832870
<path id="pack.actors.files">

0 commit comments

Comments
 (0)