mirror of https://github.com/sbt/sbt.git
OverrideScalaMediator: fix bootstrapping a Scala compiler
Fixes #2867, #2896
This commit is contained in:
parent
9b0818f49a
commit
9375c88a8b
|
|
@ -62,13 +62,22 @@ private[sbt] abstract class IvyScalaFunctions {
|
|||
// Mediate only for the dependencies in scalaVersion configurations. https://github.com/sbt/sbt/issues/2786
|
||||
def configQualifies: Boolean =
|
||||
(dd.getModuleConfigurations exists { scalaVersionConfigs })
|
||||
// Do not rewrite the dependencies of Scala dependencies themselves, this prevents bootstrapping
|
||||
// a Scala compiler using another Scala compiler.
|
||||
def dependeeQualifies: Boolean =
|
||||
dd.getParentRevisionId.getName match {
|
||||
case name @ (CompilerID | LibraryID | ReflectID | ActorsID | ScalapID) =>
|
||||
false
|
||||
case _ =>
|
||||
true
|
||||
}
|
||||
val transformer =
|
||||
new NamespaceTransformer {
|
||||
def transform(mrid: ModuleRevisionId): ModuleRevisionId = {
|
||||
if (mrid == null) mrid
|
||||
else
|
||||
mrid.getName match {
|
||||
case name @ (CompilerID | LibraryID | ReflectID | ActorsID | ScalapID) if configQualifies =>
|
||||
case name @ (CompilerID | LibraryID | ReflectID | ActorsID | ScalapID) if configQualifies && dependeeQualifies =>
|
||||
ModuleRevisionId.newInstance(scalaOrganization, name, mrid.getBranch, scalaVersion, mrid.getQualifiedExtraAttributes)
|
||||
case _ => mrid
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue