Skip to content

Commit 25e8c75

Browse files
committed
Don't use deprecated ScalaInstance constructor
sbt/zinc@9397b6a#diff-ea135f2f26f43e40ff045089da221e1e introduced a new constructor for ScalaInstance and deprecated the old one. We use the new one but don't call it with the proper arguments. It shouldn't matter though as the enw constructor was introduced to fix an issue with `sbt run` that only occurs when `(fork in run) := false`.
1 parent 7020f13 commit 25e8c75

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

project/Build.scala

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ object Build {
249249
// Compile using the non-bootstrapped and non-published dotty
250250
managedScalaInstance := false,
251251
scalaInstance := {
252+
import sbt.internal.inc.ScalaInstance
253+
import sbt.internal.inc.classpath.ClasspathUtilities
254+
252255
val updateReport = update.value
253256
var libraryJar = packageBin.in(`dotty-library`, Compile).value
254257
var compilerJar = packageBin.in(`dotty-compiler`, Compile).value
@@ -270,8 +273,18 @@ object Build {
270273

271274
val allJars = libraryJar :: compilerJar :: otherDependencies.toList
272275
val classLoader = state.value.classLoaderCache(allJars)
273-
new sbt.internal.inc.ScalaInstance(scalaVersion.value,
274-
classLoader, libraryJar, compilerJar, allJars.toArray, None)
276+
new ScalaInstance(
277+
scalaVersion.value,
278+
classLoader,
279+
ClasspathUtilities.rootLoader, // FIXME: Should be a class loader which only includes the dotty-lib
280+
// See: https://github.com/sbt/zinc/commit/9397b6aaf94ac3cfab386e3abd11c0ef9c2ceaff#diff-ea135f2f26f43e40ff045089da221e1e
281+
// Should not matter, as it addresses an issue with `sbt run` that
282+
// only occur when `(fork in run) := false`
283+
libraryJar,
284+
compilerJar,
285+
allJars.toArray,
286+
None
287+
)
275288
}
276289
)
277290

0 commit comments

Comments
 (0)