Merge pull request #5634 from eed3si9n/wip/missingok

Fixes missingOk under Coursier
This commit is contained in:
eugene yokota 2020-06-17 21:06:40 -04:00 committed by GitHub
commit 9f9bb9daa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 99 additions and 0 deletions

View File

@ -68,6 +68,55 @@ object LMCoursier {
strict: Option[CStrict], strict: Option[CStrict],
depsOverrides: Seq[ModuleID], depsOverrides: Seq[ModuleID],
log: Logger 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 = { ): CoursierConfiguration = {
val coursierExcludeDeps = Inputs val coursierExcludeDeps = Inputs
.exclusions( .exclusions(
@ -92,6 +141,10 @@ object LMCoursier {
val userForceVersions = Inputs.forceVersions(depsOverrides, scalaVer, scalaBinaryVer) val userForceVersions = Inputs.forceVersions(depsOverrides, scalaVer, scalaBinaryVer)
Classpaths.warnResolversConflict(rs, log) Classpaths.warnResolversConflict(rs, log)
Classpaths.errorInsecureProtocol(rs, log) Classpaths.errorInsecureProtocol(rs, log)
val missingOk = updateConfig match {
case Some(uc) => uc.missingOk
case _ => false
}
CoursierConfiguration() CoursierConfiguration()
.withResolvers(rs.toVector) .withResolvers(rs.toVector)
.withInterProjectDependencies(interProjectDependencies.toVector) .withInterProjectDependencies(interProjectDependencies.toVector)
@ -115,6 +168,7 @@ object LMCoursier {
.withIvyHome(ivyHome) .withIvyHome(ivyHome)
.withStrict(strict) .withStrict(strict)
.withForceVersions(userForceVersions.toVector) .withForceVersions(userForceVersions.toVector)
.withMissingOk(missingOk)
} }
def coursierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task { def coursierConfigurationTask: Def.Initialize[Task[CoursierConfiguration]] = Def.task {
@ -139,6 +193,7 @@ object LMCoursier {
ivyPaths.value.ivyHome, ivyPaths.value.ivyHome,
CoursierInputsTasks.strictTask.value, CoursierInputsTasks.strictTask.value,
dependencyOverrides.value, dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log streams.value.log
) )
} }
@ -165,6 +220,7 @@ object LMCoursier {
ivyPaths.value.ivyHome, ivyPaths.value.ivyHome,
CoursierInputsTasks.strictTask.value, CoursierInputsTasks.strictTask.value,
dependencyOverrides.value, dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log streams.value.log
) )
} }
@ -191,6 +247,7 @@ object LMCoursier {
ivyPaths.value.ivyHome, ivyPaths.value.ivyHome,
CoursierInputsTasks.strictTask.value, CoursierInputsTasks.strictTask.value,
dependencyOverrides.value, dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log streams.value.log
) )
} }
@ -217,6 +274,7 @@ object LMCoursier {
ivyPaths.value.ivyHome, ivyPaths.value.ivyHome,
CoursierInputsTasks.strictTask.value, CoursierInputsTasks.strictTask.value,
dependencyOverrides.value, dependencyOverrides.value,
Some(updateConfiguration.value),
streams.value.log streams.value.log
) )
} }

View File

@ -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)}")
}
}

View File

@ -0,0 +1 @@
> check