Merge pull request #65 from alexarchambault/bump-coursier

Switch to coursier 1.1.0-M14-5
This commit is contained in:
Alexandre Archambault 2019-05-27 16:16:14 +02:00 committed by GitHub
commit bf189d8fc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 40 deletions

View File

@ -15,7 +15,7 @@ inThisBuild(List(
) )
)) ))
val coursierVersion0 = "1.1.0-M14-4" val coursierVersion0 = "1.1.0-M14-5"
lazy val `lm-coursier` = project lazy val `lm-coursier` = project
.in(file("modules/lm-coursier")) .in(file("modules/lm-coursier"))
@ -117,7 +117,7 @@ lazy val `sbt-pgp-coursier` = project
libraryDependencies += { libraryDependencies += {
val sbtv = CrossVersion.binarySbtVersion(sbtVersion.in(pluginCrossBuild).value) val sbtv = CrossVersion.binarySbtVersion(sbtVersion.in(pluginCrossBuild).value)
val sv = scalaBinaryVersion.value val sv = scalaBinaryVersion.value
val ver = "1.1.1" val ver = "1.1.2-1"
Defaults.sbtPluginExtra("com.jsuereth" % "sbt-pgp" % ver, sbtv, sv) Defaults.sbtPluginExtra("com.jsuereth" % "sbt-pgp" % ver, sbtv, sv)
}, },
scriptedDependencies := { scriptedDependencies := {

View File

@ -35,16 +35,11 @@ object ArtifactsRun {
.withResolutions(params.resolutions) .withResolutions(params.resolutions)
.withArtifactTypes(Set(Type.all)) .withArtifactTypes(Set(Type.all))
.withClassifiers(params.classifiers.getOrElse(Nil).toSet) .withClassifiers(params.classifiers.getOrElse(Nil).toSet)
.transformArtifacts { l => .addExtraArtifacts { l =>
val l0 = if (params.includeSignatures)
if (params.includeSignatures) l.flatMap(_._3.extra.get("sig").toSeq)
l.flatMap { a => else
val sigOpt = a.extra.get("sig") Nil
Seq(a) ++ sigOpt.toSeq
}
else
l
l0.distinct // temporary, until we can use https://github.com/coursier/coursier/pull/1077 from here
} }
.withCache( .withCache(
params params

View File

@ -51,7 +51,8 @@ object SbtCoursierCache {
dependencies: Seq[(Configuration, Dependency)], dependencies: Seq[(Configuration, Dependency)],
resolution: Map[Set[Configuration], Resolution], resolution: Map[Set[Configuration], Resolution],
withClassifiers: Boolean, withClassifiers: Boolean,
sbtClassifiers: Boolean sbtClassifiers: Boolean,
includeSignatures: Boolean
) )

View File

@ -6,7 +6,7 @@ import java.util.GregorianCalendar
import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ConcurrentHashMap
import coursier.{Artifact, Attributes, Dependency, Module, Project, Resolution} import coursier.{Artifact, Attributes, Dependency, Module, Project, Resolution}
import coursier.core.{Classifier, Configuration, Type} import coursier.core.{Classifier, Configuration, Extension, Publication, Type}
import coursier.maven.MavenAttributes import coursier.maven.MavenAttributes
import sbt.librarymanagement.{Artifact => _, Configuration => _, _} import sbt.librarymanagement.{Artifact => _, Configuration => _, _}
import sbt.util.Logger import sbt.util.Logger
@ -52,16 +52,15 @@ private[internal] object SbtUpdateReport {
) )
} }
private val artifact = caching[(Module, Map[String, String], Attributes, Artifact), sbt.librarymanagement.Artifact] { private val artifact = caching[(Module, Map[String, String], Publication, Artifact), sbt.librarymanagement.Artifact] {
case (module, extraProperties, attr, artifact) => case (module, extraProperties, pub, artifact) =>
sbt.librarymanagement.Artifact(module.name.value) sbt.librarymanagement.Artifact(pub.name)
// FIXME Get these two from publications .withType(pub.`type`.value)
.withType(attr.`type`.value) .withExtension(pub.ext.value)
.withExtension(MavenAttributes.typeExtension(attr.`type`).value)
.withClassifier( .withClassifier(
Some(attr.classifier) Some(pub.classifier)
.filter(_.nonEmpty) .filter(_.nonEmpty)
.orElse(MavenAttributes.typeDefaultClassifierOpt(attr.`type`)) .orElse(MavenAttributes.typeDefaultClassifierOpt(pub.`type`))
.map(_.value) .map(_.value)
) )
// .withConfigurations(Vector()) // .withConfigurations(Vector())
@ -69,16 +68,16 @@ private[internal] object SbtUpdateReport {
.withExtraAttributes(module.attributes ++ extraProperties) .withExtraAttributes(module.attributes ++ extraProperties)
} }
private val moduleReport = caching[(Dependency, Seq[(Dependency, Project)], Project, Seq[(Attributes, Artifact, Option[File])]), ModuleReport] { private val moduleReport = caching[(Dependency, Seq[(Dependency, Project)], Project, Seq[(Publication, Artifact, Option[File])]), ModuleReport] {
case (dependency, dependees, project, artifacts) => case (dependency, dependees, project, artifacts) =>
val sbtArtifacts = artifacts.collect { val sbtArtifacts = artifacts.collect {
case (attr, artifact0, Some(file)) => case (pub, artifact0, Some(file)) =>
(artifact(dependency.module, project.properties.toMap, attr, artifact0), file) (artifact((dependency.module, project.properties.toMap, pub, artifact0)), file)
} }
val sbtMissingArtifacts = artifacts.collect { val sbtMissingArtifacts = artifacts.collect {
case (attr, artifact0, None) => case (pub, artifact0, None) =>
artifact(dependency.module, project.properties.toMap, attr, artifact0) artifact((dependency.module, project.properties.toMap, pub, artifact0))
} }
val publicationDate = project.info.publication.map { dt => val publicationDate = project.info.publication.map { dt =>
@ -88,7 +87,7 @@ private[internal] object SbtUpdateReport {
val callers = dependees.map { val callers = dependees.map {
case (dependee, dependeeProj) => case (dependee, dependeeProj) =>
Caller( Caller(
moduleId(dependee, dependeeProj.version, dependeeProj.properties.toMap), moduleId((dependee, dependeeProj.version, dependeeProj.properties.toMap)),
dependeeProj.configurations.keys.toVector.map(c => ConfigRef(c.value)), dependeeProj.configurations.keys.toVector.map(c => ConfigRef(c.value)),
dependee.module.attributes ++ dependeeProj.properties, dependee.module.attributes ++ dependeeProj.properties,
// FIXME Set better values here // FIXME Set better values here
@ -100,7 +99,7 @@ private[internal] object SbtUpdateReport {
} }
ModuleReport( ModuleReport(
moduleId(dependency, project.version, project.properties.toMap), moduleId((dependency, project.version, project.properties.toMap)),
sbtArtifacts.toVector, sbtArtifacts.toVector,
sbtMissingArtifacts.toVector sbtMissingArtifacts.toVector
) )
@ -136,7 +135,7 @@ private[internal] object SbtUpdateReport {
depArtifacts1 depArtifacts1
else else
depArtifacts1.filter { depArtifacts1.filter {
case (_, attr, _) => attr != Attributes(Type.pom, Classifier.empty) case (_, pub, _) => pub.attributes != Attributes(Type.pom, Classifier.empty)
} }
val depArtifacts = val depArtifacts =
@ -146,10 +145,14 @@ private[internal] object SbtUpdateReport {
if (notFound.isEmpty) if (notFound.isEmpty)
depArtifacts0.flatMap { depArtifacts0.flatMap {
case (dep, attr, a) => case (dep, pub, a) =>
Seq((dep, attr, a)) ++ val sigPub = pub.copy(
// not too sure about the attributes here // not too sure about those
a.extra.get("sig").toSeq.map((dep, Attributes(Type(s"${attr.`type`.value}.asc"), attr.classifier), _)) ext = Extension(pub.ext.value),
`type` = Type(pub.`type`.value)
)
Seq((dep, pub, a)) ++
a.extra.get("sig").toSeq.map((dep, sigPub, _))
} }
else { else {
for ((_, _, a) <- notFound) for ((_, _, a) <- notFound)
@ -196,12 +199,12 @@ private[internal] object SbtUpdateReport {
(dependee, dependeeProj) (dependee, dependeeProj)
} }
moduleReport( moduleReport((
dep, dep,
dependees, dependees,
proj, proj,
artifacts.map { case (attr, a) => (attr, a, artifactFileOpt(proj.module, proj.version, attr, a)) } artifacts.map { case (pub, a) => (pub, a, artifactFileOpt(proj.module, proj.version, pub.attributes, a)) }
) ))
} }
} }
@ -240,7 +243,7 @@ private[internal] object SbtUpdateReport {
// appears first in the update report, see https://github.com/coursier/coursier/issues/650 // appears first in the update report, see https://github.com/coursier/coursier/issues/650
val dep = subRes.rootDependencies.head val dep = subRes.rootDependencies.head
val (_, proj) = subRes.projectCache(dep.moduleVersion) val (_, proj) = subRes.projectCache(dep.moduleVersion)
val mod = moduleId(dep, proj.version, proj.properties.toMap) val mod = moduleId((dep, proj.version, proj.properties.toMap))
val (main, other) = reports.partition { r => val (main, other) = reports.partition { r =>
r.module.organization == mod.organization && r.module.organization == mod.organization &&
r.module.name == mod.name && r.module.name == mod.name &&

View File

@ -110,7 +110,8 @@ object UpdateTasks {
dependencies, dependencies,
res, res,
withClassifiers, withClassifiers,
sbtClassifiers sbtClassifiers,
includeSignatures
) )
SbtCoursierCache.default.reportOpt(key) match { SbtCoursierCache.default.reportOpt(key) match {

View File

@ -42,7 +42,10 @@ runSbtShadingTests() {
runSbtPgpCoursierTests() { runSbtPgpCoursierTests() {
addPgpKeys addPgpKeys
sbt ++$TRAVIS_SCALA_VERSION sbt-pgp-coursier/scripted sbt ++$TRAVIS_SCALA_VERSION sbt-pgp-coursier/compile
# disable for now, sbt ++$TRAVIS_SCALA_VERSION sbt-pgp-coursier/scripted
# fails with "unknown signature key algorithm: 22"
# and "No signatures found"
} }
addPgpKeys() { addPgpKeys() {