mirror of https://github.com/sbt/sbt.git
Take dependencyOverrides into account
This tracks https://github.com/coursier/sbt-coursier/pull/106 Fixes https://github.com/sbt/sbt/issues/4895
This commit is contained in:
parent
c06781aa61
commit
4086fc1213
|
|
@ -23,7 +23,8 @@ import lmcoursier.definitions.{
|
|||
Organization => COrganization,
|
||||
Project => CProject,
|
||||
Publication => CPublication,
|
||||
Type => CType
|
||||
Type => CType,
|
||||
Strict => CStrict,
|
||||
}
|
||||
import lmcoursier.credentials.DirectCredentials
|
||||
import lmcoursier.{ FallbackDependency, FromSbt, Inputs }
|
||||
|
|
@ -229,4 +230,21 @@ object CoursierInputsTasks {
|
|||
}
|
||||
creds ++ csrExtraCredentials.value
|
||||
}
|
||||
|
||||
val strictTask = Def.task {
|
||||
val cm = conflictManager.value
|
||||
val log = streams.value.log
|
||||
|
||||
cm.name match {
|
||||
case ConflictManager.latestRevision.name =>
|
||||
None
|
||||
case ConflictManager.strict.name =>
|
||||
val strict = CStrict()
|
||||
.withInclude(Set((cm.organization, cm.module)))
|
||||
Some(strict)
|
||||
case other =>
|
||||
log.warn(s"Unsupported conflict manager $other")
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import lmcoursier.definitions.{
|
|||
Project => CProject,
|
||||
ModuleMatchers,
|
||||
Reconciliation,
|
||||
Strict => CStrict,
|
||||
}
|
||||
import lmcoursier._
|
||||
import lmcoursier.credentials.Credentials
|
||||
|
|
@ -63,6 +64,9 @@ object LMCoursier {
|
|||
createLogger: Option[CacheLogger],
|
||||
cacheDirectory: File,
|
||||
reconciliation: Seq[(ModuleMatchers, Reconciliation)],
|
||||
ivyHome: Option[File],
|
||||
strict: Option[CStrict],
|
||||
depsOverrides: Seq[ModuleID],
|
||||
log: Logger
|
||||
): CoursierConfiguration = {
|
||||
val coursierExcludeDeps = Inputs
|
||||
|
|
@ -85,6 +89,7 @@ object LMCoursier {
|
|||
val sbtBootJars = internalSbtScalaProvider.jars()
|
||||
val sbtScalaVersion = internalSbtScalaProvider.version()
|
||||
val sbtScalaOrganization = "org.scala-lang" // always assuming sbt uses mainline scala
|
||||
val userForceVersions = Inputs.forceVersions(depsOverrides, scalaVer, scalaBinaryVer)
|
||||
Classpaths.warnResolversConflict(rs, log)
|
||||
CoursierConfiguration()
|
||||
.withResolvers(rs.toVector)
|
||||
|
|
@ -106,6 +111,9 @@ object LMCoursier {
|
|||
.withCache(cacheDirectory)
|
||||
.withReconciliation(reconciliation.toVector)
|
||||
.withLog(log)
|
||||
.withIvyHome(ivyHome)
|
||||
.withStrict(strict)
|
||||
.withForceVersions(userForceVersions.toVector)
|
||||
}
|
||||
|
||||
def coursierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||
|
|
@ -127,6 +135,9 @@ object LMCoursier {
|
|||
csrLogger.value,
|
||||
csrCacheDirectory.value,
|
||||
csrReconciliations.value,
|
||||
ivyPaths.value.ivyHome,
|
||||
CoursierInputsTasks.strictTask.value,
|
||||
dependencyOverrides.value,
|
||||
streams.value.log
|
||||
)
|
||||
}
|
||||
|
|
@ -150,6 +161,9 @@ object LMCoursier {
|
|||
csrLogger.value,
|
||||
csrCacheDirectory.value,
|
||||
csrReconciliations.value,
|
||||
ivyPaths.value.ivyHome,
|
||||
CoursierInputsTasks.strictTask.value,
|
||||
dependencyOverrides.value,
|
||||
streams.value.log
|
||||
)
|
||||
}
|
||||
|
|
@ -173,6 +187,9 @@ object LMCoursier {
|
|||
csrLogger.value,
|
||||
csrCacheDirectory.value,
|
||||
csrReconciliations.value,
|
||||
ivyPaths.value.ivyHome,
|
||||
CoursierInputsTasks.strictTask.value,
|
||||
dependencyOverrides.value,
|
||||
streams.value.log
|
||||
)
|
||||
}
|
||||
|
|
@ -196,6 +213,9 @@ object LMCoursier {
|
|||
csrLogger.value,
|
||||
csrCacheDirectory.value,
|
||||
csrReconciliations.value,
|
||||
ivyPaths.value.ivyHome,
|
||||
CoursierInputsTasks.strictTask.value,
|
||||
dependencyOverrides.value,
|
||||
streams.value.log
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
sbtBinaryVersion := "0.11.2"
|
||||
lazy val check = taskKey[Unit]("Runs the check")
|
||||
|
||||
addSbtPlugin("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.0", sbtVersion = "0.11.2", scalaVersion = "2.9.1")
|
||||
|
||||
scalaBinaryVersion := "2.9.1"
|
||||
|
||||
resolvers += Classpaths.typesafeReleases
|
||||
|
||||
dependencyOverrides := Vector("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.1")
|
||||
|
||||
autoScalaLibrary := false
|
||||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
autoScalaLibrary := false,
|
||||
libraryDependencies += "org.webjars.npm" % "is-odd" % "2.0.0",
|
||||
dependencyOverrides += "org.webjars.npm" % "is-number" % "5.0.0",
|
||||
check := {
|
||||
val cp = (Compile / externalDependencyClasspath).value.map {_.data.getName}.sorted
|
||||
if (!(cp contains "is-number-5.0.0.jar")) {
|
||||
sys.error("is-number-5.0.0 not found when it should be included: " + cp.toString)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
> update
|
||||
> check
|
||||
|
|
|
|||
Loading…
Reference in New Issue