Skip to content

Commit 7e8433b

Browse files
committed
Allow to load the build on JDK 9.
We put all our build-level `.scala` files in a `package build`, rather than in the default package, to work around scala/scala-dev#304. This does not yet allow to build the test suite.
1 parent 02e3830 commit 7e8433b

8 files changed

+19
-11
lines changed

build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import build.Build
2+
13
val scalajs = Build.root
24
val ir = Build.irProject
35
val irJS = Build.irProjectJS

project/BinaryIncompatibilities.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package build
2+
13
import com.typesafe.tools.mima.core._
24
import com.typesafe.tools.mima.core.ProblemFilters._
35

project/Build.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package build
2+
13
import sbt._
24
import Keys._
35

@@ -436,16 +438,10 @@ object Build {
436438
),
437439
// JDK version we are running with
438440
javaVersion in Global := {
439-
val v = System.getProperty("java.version")
440-
v.substring(0, 3) match {
441-
case "1.8" => 8
442-
case "1.7" => 7
443-
case "1.6" => 6
444-
445-
case _ =>
446-
sLog.value.warn(s"Unknown JDK version $v. Assuming max compat.")
447-
Int.MaxValue
448-
}
441+
val fullVersion = System.getProperty("java.version")
442+
val v = fullVersion.stripPrefix("1.").takeWhile(_.isDigit).toInt
443+
sLog.value.info(s"Detected JDK version $v")
444+
v
449445
}
450446
)
451447

project/ExternalCompile.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package build
2+
13
import sbt._
24
import Keys._
35

project/JavaLangObject.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package build
2+
13
/*
24
* Hard-coded IR for java.lang.Object.
35
*/

project/JavaLangString.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package build
2+
13
/*
24
* Hard-coded IR for java.lang.String.
35
*/

project/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ sources in Compile +=
3838
baseDirectory.value / "project" / "ScalaJSEnvGenerator.scala"
3939

4040
sourceGenerators in Compile += Def.task {
41-
ScalaJSEnvGenerator.generateEnvHolder(
41+
build.ScalaJSEnvGenerator.generateEnvHolder(
4242
baseDirectory.value.getParentFile / "tools",
4343
(sourceManaged in Compile).value)
4444
}.taskValue

project/project/ScalaJSEnvGenerator.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package build
2+
13
import sbt._
24

35
object ScalaJSEnvGenerator {

0 commit comments

Comments
 (0)