Skip to content

Commit fc3d150

Browse files
committed
Fix incremental compilation under Java 8
This restores some code that got removed in 4d394f7 because I thought the bug was fixed in sbt, but turns out it isn't. Without this commit, doing: % sbt > dotty-library-bootstrapped/compile > exit % sbt > dotty-library-bootstrapped/compile Caused dotty-library-bootstrapped to be compiled twice, because sbt thinks the JDK has changed. This only happens in Java 8.
1 parent c9cae24 commit fc3d150

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

project/Build.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import dotty.tools.sbtplugin.DottyIDEPlugin.autoImport._
2121
import sbtbuildinfo.BuildInfoPlugin
2222
import sbtbuildinfo.BuildInfoPlugin.autoImport._
2323

24+
import scala.util.Properties.isJavaAtLeast
25+
2426
/* In sbt 0.13 the Build trait would expose all vals to the shell, where you
2527
* can use them in "set a := b" like expressions. This re-exposes them.
2628
*/
@@ -225,6 +227,14 @@ object Build {
225227
// non-bootstrapped dotty-library that will then take priority over
226228
// the bootstrapped dotty-library on the classpath or sourcepath.
227229
classpathOptions ~= (_.withAutoBoot(false)),
230+
// ... but when running under Java 8, we still need a Scala bootclasspath that contains the JVM bootclasspath,
231+
// otherwise sbt incremental compilation breaks.
232+
scalacOptions ++= {
233+
if (isJavaAtLeast("9"))
234+
Seq()
235+
else
236+
Seq("-bootclasspath", sys.props("sun.boot.class.path"))
237+
},
228238

229239
// Enforce that the only Scala 2 classfiles we unpickle come from scala-library
230240
/*

0 commit comments

Comments
 (0)