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,
|
Organization => COrganization,
|
||||||
Project => CProject,
|
Project => CProject,
|
||||||
Publication => CPublication,
|
Publication => CPublication,
|
||||||
Type => CType
|
Type => CType,
|
||||||
|
Strict => CStrict,
|
||||||
}
|
}
|
||||||
import lmcoursier.credentials.DirectCredentials
|
import lmcoursier.credentials.DirectCredentials
|
||||||
import lmcoursier.{ FallbackDependency, FromSbt, Inputs }
|
import lmcoursier.{ FallbackDependency, FromSbt, Inputs }
|
||||||
|
|
@ -229,4 +230,21 @@ object CoursierInputsTasks {
|
||||||
}
|
}
|
||||||
creds ++ csrExtraCredentials.value
|
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,
|
Project => CProject,
|
||||||
ModuleMatchers,
|
ModuleMatchers,
|
||||||
Reconciliation,
|
Reconciliation,
|
||||||
|
Strict => CStrict,
|
||||||
}
|
}
|
||||||
import lmcoursier._
|
import lmcoursier._
|
||||||
import lmcoursier.credentials.Credentials
|
import lmcoursier.credentials.Credentials
|
||||||
|
|
@ -63,6 +64,9 @@ object LMCoursier {
|
||||||
createLogger: Option[CacheLogger],
|
createLogger: Option[CacheLogger],
|
||||||
cacheDirectory: File,
|
cacheDirectory: File,
|
||||||
reconciliation: Seq[(ModuleMatchers, Reconciliation)],
|
reconciliation: Seq[(ModuleMatchers, Reconciliation)],
|
||||||
|
ivyHome: Option[File],
|
||||||
|
strict: Option[CStrict],
|
||||||
|
depsOverrides: Seq[ModuleID],
|
||||||
log: Logger
|
log: Logger
|
||||||
): CoursierConfiguration = {
|
): CoursierConfiguration = {
|
||||||
val coursierExcludeDeps = Inputs
|
val coursierExcludeDeps = Inputs
|
||||||
|
|
@ -85,6 +89,7 @@ object LMCoursier {
|
||||||
val sbtBootJars = internalSbtScalaProvider.jars()
|
val sbtBootJars = internalSbtScalaProvider.jars()
|
||||||
val sbtScalaVersion = internalSbtScalaProvider.version()
|
val sbtScalaVersion = internalSbtScalaProvider.version()
|
||||||
val sbtScalaOrganization = "org.scala-lang" // always assuming sbt uses mainline scala
|
val sbtScalaOrganization = "org.scala-lang" // always assuming sbt uses mainline scala
|
||||||
|
val userForceVersions = Inputs.forceVersions(depsOverrides, scalaVer, scalaBinaryVer)
|
||||||
Classpaths.warnResolversConflict(rs, log)
|
Classpaths.warnResolversConflict(rs, log)
|
||||||
CoursierConfiguration()
|
CoursierConfiguration()
|
||||||
.withResolvers(rs.toVector)
|
.withResolvers(rs.toVector)
|
||||||
|
|
@ -106,6 +111,9 @@ object LMCoursier {
|
||||||
.withCache(cacheDirectory)
|
.withCache(cacheDirectory)
|
||||||
.withReconciliation(reconciliation.toVector)
|
.withReconciliation(reconciliation.toVector)
|
||||||
.withLog(log)
|
.withLog(log)
|
||||||
|
.withIvyHome(ivyHome)
|
||||||
|
.withStrict(strict)
|
||||||
|
.withForceVersions(userForceVersions.toVector)
|
||||||
}
|
}
|
||||||
|
|
||||||
def coursierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
def coursierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
|
||||||
|
|
@ -127,6 +135,9 @@ object LMCoursier {
|
||||||
csrLogger.value,
|
csrLogger.value,
|
||||||
csrCacheDirectory.value,
|
csrCacheDirectory.value,
|
||||||
csrReconciliations.value,
|
csrReconciliations.value,
|
||||||
|
ivyPaths.value.ivyHome,
|
||||||
|
CoursierInputsTasks.strictTask.value,
|
||||||
|
dependencyOverrides.value,
|
||||||
streams.value.log
|
streams.value.log
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -150,6 +161,9 @@ object LMCoursier {
|
||||||
csrLogger.value,
|
csrLogger.value,
|
||||||
csrCacheDirectory.value,
|
csrCacheDirectory.value,
|
||||||
csrReconciliations.value,
|
csrReconciliations.value,
|
||||||
|
ivyPaths.value.ivyHome,
|
||||||
|
CoursierInputsTasks.strictTask.value,
|
||||||
|
dependencyOverrides.value,
|
||||||
streams.value.log
|
streams.value.log
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -173,6 +187,9 @@ object LMCoursier {
|
||||||
csrLogger.value,
|
csrLogger.value,
|
||||||
csrCacheDirectory.value,
|
csrCacheDirectory.value,
|
||||||
csrReconciliations.value,
|
csrReconciliations.value,
|
||||||
|
ivyPaths.value.ivyHome,
|
||||||
|
CoursierInputsTasks.strictTask.value,
|
||||||
|
dependencyOverrides.value,
|
||||||
streams.value.log
|
streams.value.log
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -196,6 +213,9 @@ object LMCoursier {
|
||||||
csrLogger.value,
|
csrLogger.value,
|
||||||
csrCacheDirectory.value,
|
csrCacheDirectory.value,
|
||||||
csrReconciliations.value,
|
csrReconciliations.value,
|
||||||
|
ivyPaths.value.ivyHome,
|
||||||
|
CoursierInputsTasks.strictTask.value,
|
||||||
|
dependencyOverrides.value,
|
||||||
streams.value.log
|
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")
|
lazy val root = (project in file("."))
|
||||||
|
.settings(
|
||||||
scalaBinaryVersion := "2.9.1"
|
autoScalaLibrary := false,
|
||||||
|
libraryDependencies += "org.webjars.npm" % "is-odd" % "2.0.0",
|
||||||
resolvers += Classpaths.typesafeReleases
|
dependencyOverrides += "org.webjars.npm" % "is-number" % "5.0.0",
|
||||||
|
check := {
|
||||||
dependencyOverrides := Vector("com.typesafe.sbtscalariform" % "sbtscalariform" % "0.3.1")
|
val cp = (Compile / externalDependencyClasspath).value.map {_.data.getName}.sorted
|
||||||
|
if (!(cp contains "is-number-5.0.0.jar")) {
|
||||||
autoScalaLibrary := false
|
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