Merge pull request #79 from eed3si9n/fport/2897

[fport] OverrideScalaMediator, dotty nightly builds
This commit is contained in:
eugene yokota 2017-04-04 11:09:25 -07:00 committed by GitHub
commit 728e57827f
1 changed files with 13 additions and 2 deletions

View File

@ -28,7 +28,7 @@ object ScalaArtifacts {
private[sbt] def toolDependencies(org: String, version: String, isDotty: Boolean = false): Seq[ModuleID] =
if (isDotty)
Seq(ModuleID(org, DottyIDPrefix, version).withConfigurations(Some(Configurations.ScalaTool.name + "->compile"))
Seq(ModuleID(org, DottyIDPrefix, version).withConfigurations(Some(Configurations.ScalaTool.name + "->default(compile)"))
.withCrossVersion(CrossVersion.binary))
else
Seq(
@ -62,13 +62,24 @@ 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 == null || (
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
}