@@ -13,7 +13,6 @@ import java.util.Optional
1313import scala .util .Properties .isJavaAtLeast
1414
1515object DottyPlugin extends AutoPlugin {
16- val dottyScalaInstance = taskKey[ScalaInstance ](" ScalaInstance for Dotty" )
1716 object autoImport {
1817 val isDotty = settingKey[Boolean ](" Is this project compiled with Dotty?" )
1918
@@ -269,40 +268,38 @@ object DottyPlugin extends AutoPlugin {
269268 },
270269 // ... instead, we'll fetch the compiler and its dependencies ourselves.
271270 scalaInstance := Def .taskDyn {
272- if (isDotty.value) dottyScalaInstance
273- else {
271+ if (isDotty.value) Def .task {
272+ val updateReport =
273+ fetchArtifactsOf(
274+ dependencyResolution.value,
275+ scalaModuleInfo.value,
276+ updateConfiguration.value,
277+ (unresolvedWarningConfiguration in update).value,
278+ streams.value.log,
279+ scalaOrganization.value %% " dotty-doc" % scalaVersion.value)
280+ val scalaLibraryJar = getJar(updateReport,
281+ " org.scala-lang" , " scala-library" , revision = AllPassFilter )
282+ val dottyLibraryJar = getJar(updateReport,
283+ scalaOrganization.value, s " dotty-library_ ${scalaBinaryVersion.value}" , scalaVersion.value)
284+ val compilerJar = getJar(updateReport,
285+ scalaOrganization.value, s " dotty-compiler_ ${scalaBinaryVersion.value}" , scalaVersion.value)
286+ val allJars =
287+ getJars(updateReport, AllPassFilter , AllPassFilter , AllPassFilter )
288+
289+ makeScalaInstance(
290+ state.value,
291+ scalaVersion.value,
292+ scalaLibraryJar,
293+ dottyLibraryJar,
294+ compilerJar,
295+ allJars
296+ )
297+ }
298+ else
274299 // This dereferences the Initialize graph, but keeps the Task unevaluated,
275- // so its effect gets fired only when isDotty.value evalutes to false. yay monad.
300+ // so its effect gets fired only when isDotty.value evaluates to false. yay monad.
276301 Def .valueStrict { scalaInstance.taskValue }
277- }
278302 }.value,
279- dottyScalaInstance := {
280- val updateReport =
281- fetchArtifactsOf(
282- dependencyResolution.value,
283- scalaModuleInfo.value,
284- updateConfiguration.value,
285- (unresolvedWarningConfiguration in update).value,
286- streams.value.log,
287- scalaOrganization.value %% " dotty-doc" % scalaVersion.value)
288- val scalaLibraryJar = getJar(updateReport,
289- " org.scala-lang" , " scala-library" , revision = AllPassFilter )
290- val dottyLibraryJar = getJar(updateReport,
291- scalaOrganization.value, s " dotty-library_ ${scalaBinaryVersion.value}" , scalaVersion.value)
292- val compilerJar = getJar(updateReport,
293- scalaOrganization.value, s " dotty-compiler_ ${scalaBinaryVersion.value}" , scalaVersion.value)
294- val allJars =
295- getJars(updateReport, AllPassFilter , AllPassFilter , AllPassFilter )
296-
297- makeScalaInstance(
298- state.value,
299- scalaVersion.value,
300- scalaLibraryJar,
301- dottyLibraryJar,
302- compilerJar,
303- allJars
304- )
305- },
306303
307304 // Because managedScalaInstance is false, sbt won't add the standard library to our dependencies for us
308305 libraryDependencies ++= {
0 commit comments