8000 Fixes missingOk under Coursier by eed3si9n · Pull Request #5634 · sbt/sbt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixes missingOk under Coursier #5634

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
8000 Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions main/src/main/scala/sbt/coursierint/LMCoursier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,55 @@ object LMCoursier {
strict: Option[CStrict],
depsOverrides: Seq[ModuleID],
log: Logger
): CoursierConfiguration =
coursierConfiguration(
rs,
interProjectDependencies,
extraProjects,
fallbackDeps,
appConfig,
classifiers,
profiles,
scalaOrg,
scalaVer,
scalaBinaryVer,
autoScalaLib,
scalaModInfo,
excludeDeps,
credentials,
createLogger,
cacheDirectory,
reconciliation,
ivyHome,
strict,
depsOverrides,
None,
log
)

def coursierConfiguration(
rs: Seq[Resolver],
interProjectDependencies: Seq[CProject],
extraProjects: Seq[CProject],
fallbackDeps: Seq[FallbackDependency],
appConfig: AppConfiguration,
classifiers: Option[Seq[Classifier]],
profiles: Set[String],
scalaOrg: String,
scalaVer: String,
scalaBinaryVer: String,
autoScalaLib: Boolean,
scalaModInfo: Option[ScalaModuleInfo],
excludeDeps: Seq[InclExclRule],
credentials: Seq[Credentials],
createLogger: Option[CacheLogger],
cacheDirectory: File,
reconciliation: Seq[(ModuleMatchers, Reconciliation)],
ivyHome: Option[File],
strict: Option[CStrict],
depsOverrides: Seq[ModuleID],
updateConfig: Option[UpdateConfiguration],
log: Logger
): CoursierConfiguration = {
val coursierExcludeDeps = Inputs
.exclusions(
Expand All @@ -92,6 +141,10 @@ object LMCoursier {
val userForceVersions = Inputs.forceVersions(depsOverrides, scalaVer, scalaBinaryVer)
Classpaths.warnResolversConflict(rs, log)
Classpaths.errorInsecureProtocol(rs, log)
val missingOk = updateConfig match {
case Some(uc) => uc.missingOk
case _ => false
}
CoursierConfiguration()
.withResolvers(rs.toVector)
.withInterProjectDependencies(interProjectDependencies.toVector)
Expand All @@ -115,6 +168,7 @@ object LMCoursier {
.withIvyHome(ivyHome)
.withStrict(strict)
.withForceVersions(userForceVersions.toVector)
.withMissingOk(missingOk)
}

def coursierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
Expand All @@ -139,6 +193,7 @@ object LMCoursier {
ivyPaths.value.ivyHome,
CoursierInputsTasks.strictTask.value,
dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log
)
}
Expand All @@ -165,6 +220,7 @@ object LMCoursier {
ivyPaths.value.ivyHome,
CoursierInputsTasks.strictTask.value,
dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log
)
}
Expand All @@ -191,6 +247,7 @@ object LMCoursier {
ivyPaths.value.ivyHome,
CoursierInputsTasks.strictTask.value,
dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log
)
}
Expand All @@ -217,6 +274,7 @@ object LMCoursier {
ivyPaths.value.ivyHome,
CoursierInputsTasks.strictTask.value,
dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log
)
}
Expand Down
40 changes: 40 additions & 0 deletions sbt/src/sbt-test/dependency-management/missingok/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
ThisBuild / scalaVersion := "2.13.2"
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.3.3",
// non-existing
"org.webjars" % "npm" % "0.0.99"
)
updateConfiguration := updateConfiguration.value.withMissingOk(true)

lazy val check = taskKey[Unit]("")

check := {
val updateReport = update.value
val updateClassifiersReport = updateClassifiers.value

val compileReport = updateReport
.configuration(Compile)
.getOrElse {
sys.error("Compile configuration not found in update report")
}

val compileClassifiersReport = updateClassifiersReport
.configuration(Compile)
.getOrElse {
sys.error("Compile configuration not found in update classifiers report")
}

val shapelessModule = compileReport
.modules
.find(_.module.name == "shapeless_2.13")
.getOrElse {
sys.error(s"shapeless module not found in ${compileReport.modules.map(_.module)}")
}

val shapelessClassifiersModule = compileClassifiersReport
.modules
.find(_.module.name == "shapeless_2.13")
.getOrElse {
sys.error(s"shapeless module not found in ${compileClassifiersReport.modules.map(_.module)}")
}
}
1 change: 1 addition & 0 deletions sbt/src/sbt-test/dependency-management/missingok/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> check
0