mirror of https://github.com/sbt/sbt.git
Switch to coursier 2.0.0-RC4 (#148)
This commit is contained in:
parent
14a4a6998a
commit
b27615cf25
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue