summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2015-06-30 12:33:07 +0200
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-07-01 11:46:29 -0700
commit8247b8f077c96ba9a017b53de4d8062fe428c4a7 (patch)
tree52e0fcabfe451bc5e94dbe6183bc039b2ce006c3
parentd2cffb9ad2e431d62c890a7fb9d56520739e07b2 (diff)
downloadscala-8247b8f077c96ba9a017b53de4d8062fe428c4a7.tar.gz
scala-8247b8f077c96ba9a017b53de4d8062fe428c4a7.tar.bz2
scala-8247b8f077c96ba9a017b53de4d8062fe428c4a7.zip
Prepare build for inclusion of java8-compat
<h1>Allow mixed builds in ant</h1> The `JFunction` classes depend on the `FunctionN` traits, so the Java compiler needs the Scala library on the classpath. At the same time, while compiling the Scala library, the symbols for `JFunction` classes need to be available to emit indy-lambda closures. Therefore we pass the `JFunctions` as Java sources while compiling the Scala library. <h1>Upgrade versions of osgi tools</h1> Set the required java version in bnd files (JavaSE-1.8). Introduce `scala-swing.version.osgi` as a quick hack to allow manually deriving an osgi-friendly version number for the `scala-swing.version.number`. The latter is used to resolve the artifact, the osgi version is just so we can generate a bundle that osgi will accept. Bnd 1.50 doesn't work with Java 8 classfiles, so upgrade to 2.4.1. Also upgrade all other tools to make tests pass. For `org.eclipse.osgi` we moved to the group ID `org.eclipse.tycho`, where there's a newer version available. The osgi tests would fail with the most recent version available in the `org.eclipse.osgi` groupID. The new version of bnd only copies *classfiles* from the original into the resulting jar, while the old version also copied all other files. This caused osgi test failure with a `NoClassDefFound`, which was really due to a `NumberFormatException` in `ScalaVersion`, as it couldn't find the properties file to parse the version in... Include resources from source jar into osgi bundle as follows: ``` Include-Resource: @@SOURCE_JARNAME@ ``` This makes bnd copy all resources from the source jar. I ran the following on the osgi artifacts of this branch, and on 2.11.x: ``` for f in `find build/osgi -name '*.jar' -a -not -name '*src.jar'`; do unzip -l $f | grep -v '\.class' ; done ``` Comparing the two file lists, things look OK: https://gist.github.com/lrytz/be08db051a53eded192d
-rw-r--r--build-ant-macros.xml23
-rw-r--r--build.sbt1
-rwxr-xr-xbuild.xml43
-rw-r--r--src/build/bnd/scala-compiler-doc.bnd3
-rw-r--r--src/build/bnd/scala-compiler-interactive.bnd3
-rw-r--r--src/build/bnd/scala-compiler.bnd3
-rw-r--r--src/build/bnd/scala-library.bnd3
-rw-r--r--src/build/bnd/scala-parser-combinators.bnd3
-rw-r--r--src/build/bnd/scala-reflect.bnd3
-rw-r--r--src/build/bnd/scala-swing.bnd3
-rw-r--r--src/build/bnd/scala-xml.bnd3
-rw-r--r--versions.properties1
12 files changed, 61 insertions, 31 deletions
diff --git a/build-ant-macros.xml b/build-ant-macros.xml
index d0c9c4d310..868fb41cce 100644
--- a/build-ant-macros.xml
+++ b/build-ant-macros.xml
@@ -202,7 +202,9 @@
<!-- overrides the output directory; used when building multiple projects into the same directory-->
<attribute name="srcdir" default="@{project}"/>
<attribute name="java-excludes" default=""/>
+ <attribute name="mixed" default="NOPE"/>
<sequential>
+ <local name="mixed.true"/><condition property="mixed.true"><equals arg1="@{mixed}" arg2="true"/></condition>
<!-- TODO: detect zinc anywhere on PATH
use zinc for the quick stage if it's available;
would use it for locker but something is iffy in sbt: get a class cast error on global phase -->
@@ -220,12 +222,14 @@
<then>
<scalacfork taskname="@{stage}.@{project}" jvmargs="${scalacfork.jvmargs}" compilerpathref="@{with}.compiler.path" destdir="${build-@{stage}.dir}/classes/@{destproject}" srcdir="${src.dir}/@{srcdir}" params="${scalac.args.@{stage}} @{args}">
<include name="**/*.scala"/>
+ <include name="**/*.java" if="mixed.true"/>
<compilationpath refid="@{stage}.@{project}.build.path"/>
</scalacfork>
</then>
<else>
<scalacfork taskname="@{stage}.@{project}" jvmargs="${scalacfork.jvmargs}" compilerpathref="@{with}.compiler.path" destdir="${build-@{stage}.dir}/classes/@{destproject}" srcdir="${src.dir}/@{srcdir}" srcpath="@{srcpath}" params="${scalac.args.@{stage}} @{args}">
<include name="**/*.scala"/>
+ <include name="**/*.java" if="mixed.true"/>
<compilationpath refid="@{stage}.@{project}.build.path"/>
</scalacfork>
</else>
@@ -270,6 +274,7 @@
<attribute name="includes" default="comp.includes"/>
<attribute name="java-excludes" default=""/>
<attribute name="version" default=""/>
+ <attribute name="mixed" default="NOPE"/>
<!-- non-empty for scaladoc: use @{version}.version.number in property file-->
<sequential>
<staged-uptodate stage="@{stage}" project="@{project}">
@@ -279,9 +284,18 @@
<do>
<stopwatch name="@{stage}.@{project}.timer"/>
<mkdir dir="${build-@{stage}.dir}/classes/@{project}"/>
- <staged-javac stage="@{stage}" project="@{project}" excludes="@{java-excludes}"/>
- <!-- always compile with javac for simplicity and regularity; it's cheap -->
- <staged-scalac with="@{with}" stage="@{stage}" project="@{project}" srcpath="@{srcpath}" args="@{args}" java-excludes="@{java-excludes}"/>
+ <if>
+ <equals arg1="@{mixed}" arg2="true"/>
+ <then>
+ <staged-scalac with="@{with}" stage="@{stage}" project="@{project}" srcpath="@{srcpath}" args="@{args}" java-excludes="@{java-excludes}" mixed="@{mixed}"/>
+ <staged-javac stage="@{stage}" project="@{project}" excludes="@{java-excludes}"/>
+ </then>
+ <else>
+ <staged-javac stage="@{stage}" project="@{project}" excludes="@{java-excludes}"/>
+ <!-- always compile with javac for simplicity and regularity; it's cheap -->
+ <staged-scalac with="@{with}" stage="@{stage}" project="@{project}" srcpath="@{srcpath}" args="@{args}" java-excludes="@{java-excludes}"/>
+ </else>
+ </if>
<if>
<equals arg1="@{version}" arg2=""/>
<then>
@@ -474,7 +488,8 @@
<filter token="SCALA_COMPILER_INTERACTIVE_VERSION" value="${scala-compiler-interactive.version.number}"/>
<filter token="XML_VERSION" value="${scala-xml.version.number}" />
<filter token="PARSER_COMBINATORS_VERSION" value="${scala-parser-combinators.version.number}" />
- <filter token="SCALA_SWING_VERSION" value="${scala-swing.version.number}" />
+ <filter token="SCALA_SWING_VERSION" value="${scala-swing.version.osgi}" />
+ <filter token="SOURCE_JARNAME" value="${@{project}.targetjar}"/>
</filterset>
</copy>
<bnd classpath="${@{project}.jar}" eclipse="false" failok="false" exceptions="true" files="${build-osgi.dir}/${@{project}.name}.bnd" output="${build-osgi.dir}"/>
diff --git a/build.sbt b/build.sbt
index 03e0e73fc8..4a01ac4549 100644
--- a/build.sbt
+++ b/build.sbt
@@ -142,6 +142,7 @@ lazy val library = configureAsSubproject(project)
.settings(generatePropertiesFileSettings: _*)
.settings(
name := "scala-library",
+ compileOrder := CompileOrder.Mixed, // needed for JFunction classes in scala.runtime.java8
scalacOptions in Compile ++= Seq[String]("-sourcepath", (scalaSource in Compile).value.toString),
// Workaround for a bug in `scaladoc` that it seems to not respect the `-sourcepath` option
// as a result of this bug, the compiler cannot even initialize Definitions without
diff --git a/build.xml b/build.xml
index a52139219d..999ffd9bc6 100755
--- a/build.xml
+++ b/build.xml
@@ -272,7 +272,7 @@ TODO:
<!-- 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"/>
+ <dependency groupId="biz.aQute.bnd" artifactId="biz.aQute.bnd" version="2.4.1"/>
</artifact:dependencies>
<artifact:dependencies pathId="jarjar.classpath">
@@ -280,27 +280,26 @@ TODO:
</artifact:dependencies>
<!-- JUnit -->
- <property name="junit.version" value="4.11"/>
+ <property name="junit.version" value="4.12"/>
<artifact:dependencies pathId="junit.classpath" filesetId="junit.fileset">
<dependency groupId="junit" artifactId="junit" version="${junit.version}"/>
</artifact:dependencies>
<copy-deps project="junit"/>
<!-- Pax runner -->
- <property name="pax.exam.version" value="3.5.0"/><!-- Last version which supports Java 6 -->
- <property name="osgi.felix.version" value="4.4.0"/>
- <property name="osgi.equinox.version" value="3.7.1"/>
+ <property name="pax.exam.version" value="4.5.0"/>
+ <property name="osgi.felix.version" value="5.0.1"/>
+ <property name="osgi.equinox.version" value="3.10.100.v20150521-1310"/>
<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}">
- <exclusion groupId="org.osgi" artifactId="org.osgi.core"/><!-- Avoid dragging in a dependency which requires Java >6 -->
- </dependency>
+ <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="2.2.0"/>
- <dependency groupId="org.ops4j.pax.swissbox" artifactId="pax-swissbox-tracker" version="1.8.0"/>
- <dependency groupId="ch.qos.logback" artifactId="logback-core" version="1.1.2"/>
- <dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.1.2"/>
+ <dependency groupId="org.ops4j.pax.url" artifactId="pax-url-aether" version="2.4.1"/>
+ <dependency groupId="org.ops4j.pax.swissbox" artifactId="pax-swissbox-tracker" version="1.8.1"/>
+ <dependency groupId="ch.qos.logback" artifactId="logback-core" version="1.1.3"/>
+ <dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.1.3"/>
<dependency groupId="junit" artifactId="junit" version="${junit.version}"/>
+ <dependency groupId="org.slf4j" artifactId="slf4j-api" version="1.7.12"/>
</artifact:dependencies>
<copy-deps project="pax.exam"/>
@@ -309,7 +308,7 @@ TODO:
</artifact:dependencies>
<artifact:dependencies pathId="osgi.framework.equinox">
- <dependency groupId="org.eclipse.osgi" artifactId="org.eclipse.osgi" version="${osgi.equinox.version}"/>
+ <dependency groupId="org.eclipse.tycho" artifactId="org.eclipse.osgi" version="${osgi.equinox.version}"/>
</artifact:dependencies>
<artifact:remoteRepository id="sonatype-release" url="https://oss.sonatype.org/content/repositories/releases"/>
@@ -637,18 +636,21 @@ TODO:
<property name="swing.description" value="Scala Swing Library"/>
<property name="swing.package" value="modules."/>
+ <property name="swing.targetjar" value="scala-swing${scala-swing.cross}-${scala-swing.version.number}.jar"/>
<property name="swing.jar" value="${scala-swing}"/>
<property name="swing.src" value="false"/>
<property name="swing.srcjar" value="${scala-swing-sources}"/>
<property name="parser-combinators.description" value="Scala Parser Combinators Library"/>
<property name="parser-combinators.package" value="modules."/>
+ <property name="parser-combinators.targetjar" value="scala-parser-combinators${scala-parser-combinators.cross}-${scala-parser-combinators.version.number}.jar"/>
<property name="parser-combinators.jar" value="${scala-parser-combinators}"/>
<property name="parser-combinators.src" value="false"/>
<property name="parser-combinators.srcjar" value="${scala-parser-combinators-sources}"/>
<property name="xml.description" value="Scala XML Library"/>
<property name="xml.package" value="modules."/>
+ <property name="xml.targetjar" value="scala-xml${scala-xml.cross}-${scala-xml.version.number}.jar"/>
<property name="xml.jar" value="${scala-xml}"/>
<property name="xml.src" value="false"/>
<property name="xml.srcjar" value="${scala-xml-sources}"/>
@@ -1091,7 +1093,8 @@ TODO:
<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"/></target>
+ <!-- "mixed" needed for JFunction classes in scala.runtime.java8 -->
+ <staged-build with="starr" stage="locker" project="library" srcpath="${src.dir}/library" includes="lib.includes" mixed="true"/></target>
<target name="locker.reflect" depends="locker.lib" unless="locker.locked">
<staged-build with="starr" stage="locker" project="reflect"/></target>
@@ -1112,7 +1115,8 @@ TODO:
<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"/></target>
+ <!-- "mixed" needed for JFunction classes in scala.runtime.java8 -->
+ <staged-build with="locker" stage="quick" project="library" srcpath="${src.dir}/library" includes="lib.rootdoc.includes" mixed="true"/></target>
<target name="quick.reflect" depends="quick.lib">
<staged-build with="locker" stage="quick" project="reflect"/> </target>
@@ -1246,7 +1250,8 @@ TODO:
BOOTSTRAPPING BUILD (STRAP)
============================================================================ -->
<target name="strap.done" depends="pack.done">
- <staged-build with="pack" stage="strap" project="library" srcpath="${src.dir}/library" includes="lib.rootdoc.includes"/>
+ <!-- "mixed" needed for JFunction classes in scala.runtime.java8 -->
+ <staged-build with="pack" stage="strap" project="library" srcpath="${src.dir}/library" includes="lib.rootdoc.includes" mixed="true"/>
<staged-build with="pack" stage="strap" project="reflect"/>
<staged-build with="pack" stage="strap" project="compiler"/>
</target>
@@ -1466,9 +1471,9 @@ TODO:
srcdir="${test.junit.src}"
destdir="${test.junit.classes}"
classpathref="test.junit.compiler.build.path"
- target="1.6"
- source="1.5"
- compiler="javac1.6"
+ target="1.8"
+ source="1.8"
+ compiler="javac1.8"
includes="**/*.java"/>
<scalacfork
destdir="${test.junit.classes}"
diff --git a/src/build/bnd/scala-compiler-doc.bnd b/src/build/bnd/scala-compiler-doc.bnd
index 9d6d0304d1..5b662e8cef 100644
--- a/src/build/bnd/scala-compiler-doc.bnd
+++ b/src/build/bnd/scala-compiler-doc.bnd
@@ -4,4 +4,5 @@ ver: @SCALA_COMPILER_DOC_VERSION@
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
Import-Package: scala.*;version="${range;[==,=+);@VERSION@}",*
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6, JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Include-Resource: @@SOURCE_JARNAME@
diff --git a/src/build/bnd/scala-compiler-interactive.bnd b/src/build/bnd/scala-compiler-interactive.bnd
index 07e3de35b0..fbfff60801 100644
--- a/src/build/bnd/scala-compiler-interactive.bnd
+++ b/src/build/bnd/scala-compiler-interactive.bnd
@@ -4,4 +4,5 @@ ver: @SCALA_COMPILER_INTERACTIVE_VERSION@
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
Import-Package: scala.*;version="${range;[==,=+);@VERSION@}",*
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6, JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Include-Resource: @@SOURCE_JARNAME@
diff --git a/src/build/bnd/scala-compiler.bnd b/src/build/bnd/scala-compiler.bnd
index 2bd24d780d..3e60c4973c 100644
--- a/src/build/bnd/scala-compiler.bnd
+++ b/src/build/bnd/scala-compiler.bnd
@@ -9,4 +9,5 @@ Import-Package: jline.*;resolution:=optional, \
scala.xml.*;version="${range;[====,====];@XML_VERSION@}";resolution:=optional, \
scala.*;version="${range;[==,=+);${ver}}", \
*
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6, JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Include-Resource: @@SOURCE_JARNAME@
diff --git a/src/build/bnd/scala-library.bnd b/src/build/bnd/scala-library.bnd
index 7eb4fa4b2a..e211c5d1ad 100644
--- a/src/build/bnd/scala-library.bnd
+++ b/src/build/bnd/scala-library.bnd
@@ -4,4 +4,5 @@ ver: @VERSION@
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
Import-Package: sun.misc;resolution:=optional, *
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6, JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Include-Resource: @@SOURCE_JARNAME@
diff --git a/src/build/bnd/scala-parser-combinators.bnd b/src/build/bnd/scala-parser-combinators.bnd
index ef8646cbd0..515084f4a8 100644
--- a/src/build/bnd/scala-parser-combinators.bnd
+++ b/src/build/bnd/scala-parser-combinators.bnd
@@ -4,4 +4,5 @@ ver: @PARSER_COMBINATORS_VERSION@
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
Import-Package: scala.*;version="${range;[==,=+);@VERSION@}",*
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6, JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Include-Resource: @@SOURCE_JARNAME@
diff --git a/src/build/bnd/scala-reflect.bnd b/src/build/bnd/scala-reflect.bnd
index e4bc54e52e..59db311f8d 100644
--- a/src/build/bnd/scala-reflect.bnd
+++ b/src/build/bnd/scala-reflect.bnd
@@ -6,4 +6,5 @@ Export-Package: *;version=${ver}
Import-Package: scala.*;version="${range;[==,=+);${ver}}", \
scala.tools.nsc;resolution:=optional;version="${range;[==,=+);${ver}}", \
*
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6, JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Include-Resource: @@SOURCE_JARNAME@
diff --git a/src/build/bnd/scala-swing.bnd b/src/build/bnd/scala-swing.bnd
index f8b50baa91..24cd9f6f90 100644
--- a/src/build/bnd/scala-swing.bnd
+++ b/src/build/bnd/scala-swing.bnd
@@ -4,4 +4,5 @@ ver: @SCALA_SWING_VERSION@
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
Import-Package: scala.*;version="${range;[==,=+);@VERSION@}",*
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6,JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Include-Resource: @@SOURCE_JARNAME@
diff --git a/src/build/bnd/scala-xml.bnd b/src/build/bnd/scala-xml.bnd
index 01bf0144eb..b7b19824e8 100644
--- a/src/build/bnd/scala-xml.bnd
+++ b/src/build/bnd/scala-xml.bnd
@@ -4,4 +4,5 @@ ver: @XML_VERSION@
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
Import-Package: scala.*;version="${range;[==,=+);@VERSION@}",*
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6, JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Include-Resource: @@SOURCE_JARNAME@
diff --git a/versions.properties b/versions.properties
index 5fd2ac4b71..ad3d659aee 100644
--- a/versions.properties
+++ b/versions.properties
@@ -25,6 +25,7 @@ scala.binary.version=2.12.0-M1
scala-xml.version.number=1.0.4
scala-parser-combinators.version.number=1.0.4
scala-swing.version.number=2.0.0-M2
+scala-swing.version.osgi=2.0.0.M2
jline.version=2.12.1
scala-asm.version=5.0.4-scala-2