@@ -13,6 +13,7 @@ import java.util.Optional
13
13
import scala .util .Properties .isJavaAtLeast
14
14
15
15
object DottyPlugin extends AutoPlugin {
16
+ val dottyScalaInstance = taskKey[ScalaInstance ](" ScalaInstance for Dotty" )
16
17
object autoImport {
17
18
val isDotty = settingKey[Boolean ](" Is this project compiled with Dotty?" )
18
19
@@ -266,41 +267,38 @@ object DottyPlugin extends AutoPlugin {
266
267
},
267
268
// ... instead, we'll fetch the compiler and its dependencies ourselves.
268
269
scalaInstance := Def .taskDyn {
269
- if (isDotty.value) Def .task {
270
- val updateReport =
271
- fetchArtifactsOf(
272
- dependencyResolution.value,
273
- scalaModuleInfo.value,
274
- updateConfiguration.value,
275
- (unresolvedWarningConfiguration in update).value,
276
- streams.value.log,
277
- scalaOrganization.value %% " dotty-doc" % scalaVersion.value)
278
- val scalaLibraryJar = getJar(updateReport,
279
- " org.scala-lang" , " scala-library" , revision = AllPassFilter )
280
- val dottyLibraryJar = getJar(updateReport,
281
- scalaOrganization.value, s " dotty-library_ ${scalaBinaryVersion.value}" , scalaVersion.value)
282
- val compilerJar = getJar(updateReport,
283
- scalaOrganization.value, s " dotty-compiler_ ${scalaBinaryVersion.value}" , scalaVersion.value)
284
- val allJars =
285
- getJars(updateReport, AllPassFilter , AllPassFilter , AllPassFilter )
286
-
287
- makeScalaInstance(
288
- state.value,
289
- scalaVersion.value,
290
- scalaLibraryJar,
291
- dottyLibraryJar,
292
- compilerJar,
293
- allJars
294
- )
295
- }
296
- else Def .task {
297
- // This should really be `old` with `val old = scalaInstance.value`
298
- // above, except that this would force the original definition of the
299
- // `scalaInstance` task to be computed when `isDotty` is true, which
300
- // would fail because `managedScalaInstance` is false.
301
- Defaults .scalaInstanceTask.value
302
- }
270
+ val isD = isDotty.value
271
+ val si = scalaInstance.value
272
+ if (isD) dottyScalaInstance
273
+ else Def .task { si }
303
274
}.value,
275
+ dottyScalaInstance := {
276
+ val updateReport =
277
+ fetchArtifactsOf(
278
+ dependencyResolution.value,
279
+ scalaModuleInfo.value,
280
+ updateConfiguration.value,
281
+ (unresolvedWarningConfiguration in update).value,
282
+ streams.value.log,
283
+ scalaOrganization.value %% " dotty-doc" % scalaVersion.value)
284
+ val scalaLibraryJar = getJar(updateReport,
285
+ " org.scala-lang" , " scala-library" , revision = AllPassFilter )
286
+ val dottyLibraryJar = getJar(updateReport,
287
+ scalaOrganization.value, s " dotty-library_ ${scalaBinaryVersion.value}" , scalaVersion.value)
288
+ val compilerJar = getJar(updateReport,
289
+ scalaOrganization.value, s " dotty-compiler_ ${scalaBinaryVersion.value}" , scalaVersion.value)
290
+ val allJars =
291
+ getJars(updateReport, AllPassFilter , AllPassFilter , AllPassFilter )
292
+
293
+ makeScalaInstance(
294
+ state.value,
295
+ scalaVersion.value,
296
+ scalaLibraryJar,
297
+ dottyLibraryJar,
298
+ compilerJar,
299
+ allJars
300
+ )
301
+ },
304
302
305
303
// Because managedScalaInstance is false, sbt won't add the standard library to our dependencies for us
306
304
libraryDependencies ++= {
0 commit comments