Switch to coursier 2.0.0-RC4 (#148)

This commit is contained in:
Alexandre Archambault 2019-10-14 13:52:32 +02:00 committed by GitHub
parent 14a4a6998a
commit b27615cf25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 30 deletions

View File

@ -15,7 +15,7 @@ inThisBuild(List(
)
))
val coursierVersion0 = "2.0.0-RC3-4"
val coursierVersion0 = "2.0.0-RC4"
lazy val `lm-coursier` = project
.enablePlugins(ContrabandPlugin)

View File

@ -26,7 +26,7 @@ object ToCoursier {
def authentication(authentication: Authentication): coursier.core.Authentication =
coursier.core.Authentication(authentication.user, authentication.password)
.withOptional(authentication.optional)
.withRealm(authentication.realmOpt)
.withRealmOpt(authentication.realmOpt)
def module(module: Module): coursier.core.Module =
coursier.core.Module(

View File

@ -48,7 +48,7 @@ final case class ResolutionParams(
val cleanCache = cache
.withPool(null)
.withLogger(null)
.withSync[Task](null)
.withS(null)
SbtCoursierCache.ResolutionKey(
dependencies,
internalRepositories,
@ -60,7 +60,7 @@ final case class ResolutionParams(
parallel = 0,
cache = cleanCache
),
ResolutionParams.cacheKey(cleanCache),
cleanCache,
sbtClassifiers
)
}
@ -73,18 +73,6 @@ final case class ResolutionParams(
// private[coursier]
object ResolutionParams {
private lazy val m = {
val cls = classOf[FileCache[Task]]
//cls.getDeclaredMethods.foreach(println)
val m = cls.getDeclaredMethod("params")
m.setAccessible(true)
m
}
// temporary, until we can use https://github.com/coursier/coursier/pull/1090
private def cacheKey(cache: FileCache[Task]): Object =
m.invoke(cache)
def defaultIvyProperties(ivyHomeOpt: Option[File]): Map[String, String] = {
val ivyHome = sys.props

View File

@ -89,7 +89,7 @@ object ResolutionRun {
.params
.addForceVersion((if (isCompileConfig) params.interProjectDependencies.map(_.moduleVersion) else Nil): _*)
.withForceScalaVersion(isCompileOrScalaToolConfig && params.autoScalaLibOpt.nonEmpty)
.withScalaVersion(params.autoScalaLibOpt.map(_._2))
.withScalaVersionOpt(params.autoScalaLibOpt.map(_._2))
.withTypelevel(params.params.typelevel && isCompileOrScalaToolConfig)
.withRules(rules)
)

View File

@ -4,6 +4,8 @@ import java.util.concurrent.ConcurrentHashMap
import coursier.core._
import sbt.librarymanagement.UpdateReport
import coursier.cache.FileCache
import coursier.util.Task
// private[coursier]
class SbtCoursierCache {
@ -45,7 +47,7 @@ object SbtCoursierCache {
mainRepositories: Seq[Repository],
fallbackRepositories: Seq[Repository],
params: ResolutionParams,
tmpCacheKey: Object, // temporary, until we can use https://github.com/coursier/coursier/pull/1090
cache: FileCache[Task],
sbtClassifiers: Boolean
)

View File

@ -156,11 +156,10 @@ private[internal] object SbtUpdateReport {
if (notFound.isEmpty)
depArtifacts0.flatMap {
case (dep, pub, a) =>
val sigPub = pub.copy(
val sigPub = pub
// not too sure about those
ext = Extension(pub.ext.value),
`type` = Type(pub.`type`.value)
)
.withExt(Extension(pub.ext.value))
.withType(Type(pub.`type`.value))
Seq((dep, pub, a)) ++
a.extra.get("sig").toSeq.map((dep, sigPub, _))
}
@ -183,7 +182,10 @@ private[internal] object SbtUpdateReport {
}.toMap
def clean(dep: Dependency): Dependency =
dep.copy(configuration = Configuration.empty, exclusions = Set.empty, optional = false)
dep
.withConfiguration(Configuration.empty)
.withExclusions(Set.empty)
.withOptional(false)
val reverseDependencies = res.reverseDependencies
.toVector
@ -201,10 +203,10 @@ private[internal] object SbtUpdateReport {
// FIXME Likely flaky...
val dependees = reverseDependencies
.getOrElse(clean(dep.copy(version = "")), Vector.empty)
.getOrElse(clean(dep.withVersion("")), Vector.empty)
.map { dependee0 =>
val version = versions(dependee0.module)
val dependee = dependee0.copy(version = version)
val dependee = dependee0.withVersion(version)
val (_, dependeeProj) = res.projectCache(dependee.moduleVersion)
(dependee, dependeeProj)
}
@ -283,7 +285,7 @@ private[internal] object SbtUpdateReport {
// should not happen
Project(c.dependeeModule, c.dependeeVersion, Nil, Map(), None, Nil, Nil, Nil, None, None, None, false, None, Nil, coursier.core.Info.empty)
}
val rep = moduleReport((dep, Seq((dependee, dependeeProj)), proj.copy(version = c.wantedVersion), Nil))
val rep = moduleReport((dep, Seq((dependee, dependeeProj)), proj.withVersion(c.wantedVersion), Nil))
.withEvicted(true)
.withEvictedData(Some("version selection")) // ??? put latest-revision like sbt/ivy here?
OrganizationArtifactReport(c.module.organization.value, c.module.name.value, Vector(rep))

View File

@ -42,12 +42,12 @@ object UpdateRun {
allDependenciesByConfig(res, depsByConfig, configs)
.flatMap {
case (config, deps) =>
deps.map(dep => dep.copy(configuration = config --> dep.configuration))
deps.map(dep => dep.withConfiguration(config --> dep.configuration))
}
.groupBy(_.copy(configuration = Configuration.empty))
.groupBy(_.withConfiguration(Configuration.empty))
.map {
case (dep, l) =>
dep.copy(configuration = Configuration.join(l.map(_.configuration).toSeq: _*))
dep.withConfiguration(Configuration.join(l.map(_.configuration).toSeq: _*))
}
.toSet

View File

@ -122,7 +122,7 @@ object ResolutionTasks {
authenticationByRepositoryId.get(resolver.name).map { a =>
Authentication(a.user, a.password)
.withOptional(a.optional)
.withRealm(a.realmOpt)
.withRealmOpt(a.realmOpt)
}
)
}