@@ -404,10 +404,15 @@ object DottyPlugin extends AutoPlugin {
404404
405405 /** Create a scalaInstance task that uses Dotty based on `moduleName`. */
406406 def dottyScalaInstanceTask (moduleName : String ): Initialize [Task [ScalaInstance ]] = Def .task {
407+ val ivyConfig0 = mkIvyConfiguration.value
408+ // When compiling non-bootstrapped projects in the build of Dotty itself,
409+ // dependency resolution might pick a local project which is not what we
410+ // want. We avoid this by dropping the inter-project resolver.
411+ val ivyConfig1 = ivyConfig0.withResolvers(ivyConfig0.resolvers.filter(_.name != " inter-project" ))
407412 val updateReport =
408413 fetchArtifactsOf(
409414 scalaOrganization.value %% moduleName % scalaVersion.value,
410- dependencyResolution.value ,
415+ ivy. IvyDependencyResolution (ivyConfig1) ,
411416 scalaModuleInfo.value,
412417 updateConfiguration.value,
413418 (unresolvedWarningConfiguration in update).value,
@@ -431,6 +436,25 @@ object DottyPlugin extends AutoPlugin {
431436 )
432437 }
433438
439+ // Copy-pasted from sbt until we upgrade to a version of sbt
440+ // with https://github.com/sbt/sbt/pull/5271 in.
441+ def mkIvyConfiguration : Initialize [Task [InlineIvyConfiguration ]] =
442+ Def .task {
443+ val (rs, other) = (fullResolvers.value.toVector, otherResolvers.value.toVector)
444+ val s = streams.value
445+ Classpaths .warnResolversConflict(rs ++: other, s.log)
446+ InlineIvyConfiguration ()
447+ .withPaths(ivyPaths.value)
448+ .withResolvers(rs)
449+ .withOtherResolvers(other)
450+ .withModuleConfigurations(moduleConfigurations.value.toVector)
451+ .withLock(Defaults .lock(appConfiguration.value))
452+ .withChecksums((checksums in update).value.toVector)
453+ .withResolutionCacheDir(crossTarget.value / " resolution-cache" )
454+ .withUpdateOptions(updateOptions.value)
455+ .withLog(s.log)
456+ }
457+
434458 def makeScalaInstance (
435459 state : State , dottyVersion : String , scalaLibrary : File , dottyLibrary : File , compiler : File , all : Seq [File ]
436460 ): ScalaInstance = {
0 commit comments