mirror of https://github.com/sbt/sbt.git
Switch to coursier 1.1.0-M13-1 (#45)
This commit is contained in:
parent
c24e8dd4e1
commit
1c28e8fb6b
|
|
@ -21,7 +21,7 @@ lazy val `lm-coursier` = project
|
|||
.settings(
|
||||
shared,
|
||||
libraryDependencies ++= Seq(
|
||||
"io.get-coursier" %% "coursier" % "1.1.0-M13",
|
||||
"io.get-coursier" %% "coursier" % "1.1.0-M13-1",
|
||||
// We depend on librarymanagement-ivy rather than just
|
||||
// librarymanagement-core to handle the ModuleDescriptor passed
|
||||
// to DependencyResolutionInterface.update, which is an
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package coursier.lmcoursier
|
||||
|
||||
import coursier.cache.CacheLogger
|
||||
import coursier.cache.{CacheLogger, FileCache}
|
||||
import coursier.core.{Classifier, Resolution}
|
||||
import coursier.params.CacheParams
|
||||
import coursier.util.Task
|
||||
|
||||
final case class ArtifactsParams(
|
||||
classifiers: Option[Seq[Classifier]],
|
||||
|
|
@ -11,5 +11,6 @@ final case class ArtifactsParams(
|
|||
loggerOpt: Option[CacheLogger],
|
||||
projectName: String,
|
||||
sbtClassifiers: Boolean,
|
||||
cacheParams: CacheParams
|
||||
cache: FileCache[Task],
|
||||
parallel: Int
|
||||
)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package coursier.lmcoursier
|
|||
|
||||
import java.io.File
|
||||
|
||||
import coursier.cache.FileCache
|
||||
import coursier.Artifact
|
||||
import coursier.cache.loggers.{ProgressBarRefreshDisplay, RefreshLogger}
|
||||
import coursier.core.Type
|
||||
|
|
@ -29,13 +28,13 @@ object ArtifactsRun {
|
|||
else
|
||||
""
|
||||
|
||||
Sync.withFixedThreadPool(params.cacheParams.parallel) { pool =>
|
||||
Sync.withFixedThreadPool(params.parallel) { pool =>
|
||||
|
||||
coursier.Artifacts()
|
||||
.withResolutions(params.resolutions)
|
||||
.withArtifactTypes(Set(Type.all))
|
||||
.withClassifiers(params.classifiers.getOrElse(Nil).toSet)
|
||||
.withTransformArtifacts { l =>
|
||||
.transformArtifacts { l =>
|
||||
val l0 =
|
||||
if (params.includeSignatures)
|
||||
l.flatMap { a =>
|
||||
|
|
@ -47,10 +46,9 @@ object ArtifactsRun {
|
|||
l0.distinct // temporary, until we can use https://github.com/coursier/coursier/pull/1077 from here
|
||||
}
|
||||
.withCache(
|
||||
FileCache()
|
||||
.withLocation(params.cacheParams.cacheLocation)
|
||||
.withCachePolicies(params.cacheParams.cachePolicies)
|
||||
.withChecksums(params.cacheParams.checksum)
|
||||
params
|
||||
.cache
|
||||
.withPool(pool)
|
||||
.withLogger(
|
||||
params.loggerOpt.getOrElse {
|
||||
RefreshLogger.create(
|
||||
|
|
@ -65,8 +63,6 @@ object ArtifactsRun {
|
|||
)
|
||||
}
|
||||
)
|
||||
.withTtl(params.cacheParams.ttl)
|
||||
.withPool(pool)
|
||||
)
|
||||
.either()
|
||||
.map(_.toMap)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ import java.io.File
|
|||
import _root_.coursier.{Artifact, Organization, Resolution, organizationString}
|
||||
import _root_.coursier.core.{Classifier, Configuration, ModuleName}
|
||||
import _root_.coursier.lmcoursier.Inputs.withAuthenticationByHost
|
||||
import coursier.cache.{CacheDefaults, CachePolicy}
|
||||
import coursier.cache.{CacheDefaults, CachePolicy, FileCache}
|
||||
import coursier.internal.Typelevel
|
||||
import coursier.params.CacheParams
|
||||
import sbt.internal.librarymanagement.IvySbt
|
||||
import sbt.librarymanagement._
|
||||
import sbt.util.Logger
|
||||
|
|
@ -20,8 +19,6 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
|
|||
* sbt-coursier, that was moved to this module.
|
||||
*/
|
||||
|
||||
private def sbtBinaryVersion = "1.0"
|
||||
|
||||
lazy val resolvers =
|
||||
if (conf.reorderResolvers)
|
||||
ResolutionParams.reorderResolvers(conf.resolvers)
|
||||
|
|
@ -138,12 +135,12 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
|
|||
sbtClassifiers = false,
|
||||
projectName = projectName,
|
||||
loggerOpt = loggerOpt,
|
||||
cacheParams = coursier.params.CacheParams()
|
||||
.withCacheLocation(cache)
|
||||
cache = coursier.cache.FileCache()
|
||||
.withLocation(cache)
|
||||
.withCachePolicies(cachePolicies)
|
||||
.withTtl(ttl)
|
||||
.withChecksum(checksums)
|
||||
.withParallel(conf.parallelDownloads),
|
||||
.withChecksums(checksums),
|
||||
parallel = conf.parallelDownloads,
|
||||
params = coursier.params.ResolutionParams()
|
||||
.withMaxIterations(conf.maxIterations)
|
||||
.withProfiles(conf.mavenProfiles.toSet)
|
||||
|
|
@ -159,12 +156,12 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
|
|||
loggerOpt = loggerOpt,
|
||||
projectName = projectName,
|
||||
sbtClassifiers = false,
|
||||
cacheParams = CacheParams()
|
||||
.withParallel(conf.parallelDownloads)
|
||||
.withCacheLocation(cache)
|
||||
.withChecksum(checksums)
|
||||
cache = FileCache()
|
||||
.withLocation(cache)
|
||||
.withChecksums(checksums)
|
||||
.withTtl(ttl)
|
||||
.withCachePolicies(cachePolicies)
|
||||
.withCachePolicies(cachePolicies),
|
||||
parallel = conf.parallelDownloads
|
||||
)
|
||||
|
||||
val sbtBootJarOverrides = SbtBootJars(
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package coursier.lmcoursier
|
|||
|
||||
import java.io.File
|
||||
|
||||
import coursier.cache.CacheLogger
|
||||
import coursier.cache.{CacheLogger, FileCache}
|
||||
import coursier.ProjectCache
|
||||
import coursier.core._
|
||||
import coursier.util.InMemoryRepository
|
||||
import coursier.util.{InMemoryRepository, Task}
|
||||
import sbt.librarymanagement.{Resolver, URLRepository}
|
||||
|
||||
final case class ResolutionParams(
|
||||
|
|
@ -20,7 +20,8 @@ final case class ResolutionParams(
|
|||
sbtClassifiers: Boolean,
|
||||
projectName: String,
|
||||
loggerOpt: Option[CacheLogger],
|
||||
cacheParams: coursier.params.CacheParams,
|
||||
cache: coursier.cache.FileCache[Task],
|
||||
parallel: Int,
|
||||
params: coursier.params.ResolutionParams
|
||||
) {
|
||||
|
||||
|
|
@ -48,8 +49,16 @@ final case class ResolutionParams(
|
|||
repositories,
|
||||
copy(
|
||||
parentProjectCache = Map.empty,
|
||||
loggerOpt = None
|
||||
loggerOpt = None,
|
||||
cache = null, // temporary, until we can use https://github.com/coursier/coursier/pull/1090
|
||||
parallel = 0
|
||||
),
|
||||
ResolutionParams.cacheKey {
|
||||
cache
|
||||
.withPool(null)
|
||||
.withLogger(null)
|
||||
.withSync[Task](null)
|
||||
},
|
||||
sbtClassifiers
|
||||
)
|
||||
|
||||
|
|
@ -60,6 +69,18 @@ final case class ResolutionParams(
|
|||
|
||||
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(): Map[String, String] = {
|
||||
|
||||
val ivyHome = sys.props.getOrElse(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package coursier.lmcoursier
|
||||
|
||||
import coursier.cache.FileCache
|
||||
import coursier.{Resolution, Resolve}
|
||||
import coursier.cache.loggers.{ProgressBarRefreshDisplay, RefreshLogger}
|
||||
import coursier.core._
|
||||
|
|
@ -64,7 +63,7 @@ object ResolutionRun {
|
|||
if (verbosityLevel >= 2)
|
||||
log.info(initialMessage)
|
||||
|
||||
Sync.withFixedThreadPool(params.cacheParams.parallel) { pool =>
|
||||
Sync.withFixedThreadPool(params.parallel) { pool =>
|
||||
|
||||
Resolve()
|
||||
.withDependencies(
|
||||
|
|
@ -83,12 +82,9 @@ object ResolutionRun {
|
|||
.withTypelevel(params.params.typelevel && isCompileConfig)
|
||||
)
|
||||
.withCache(
|
||||
FileCache()
|
||||
.withLocation(params.cacheParams.cacheLocation)
|
||||
.withCachePolicies(params.cacheParams.cachePolicies)
|
||||
.withChecksums(params.cacheParams.checksum)
|
||||
params
|
||||
.cache
|
||||
.withPool(pool)
|
||||
.withTtl(params.cacheParams.ttl)
|
||||
.withLogger(
|
||||
params.loggerOpt.getOrElse {
|
||||
RefreshLogger.create(
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ object SbtCoursierCache {
|
|||
dependencies: Seq[(Configuration, Dependency)],
|
||||
repositories: Seq[Repository],
|
||||
params: ResolutionParams,
|
||||
tmpCacheKey: Object, // temporary, until we can use https://github.com/coursier/coursier/pull/1090
|
||||
sbtClassifiers: Boolean
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package coursier.sbtcoursier
|
|||
import java.io.File
|
||||
|
||||
import coursier.Artifact
|
||||
import coursier.cache.FileCache
|
||||
import coursier.core._
|
||||
import coursier.lmcoursier._
|
||||
import coursier.params.CacheParams
|
||||
import coursier.sbtcoursier.Keys._
|
||||
import coursier.sbtcoursiershared.SbtCoursierShared.autoImport.{coursierCache, coursierLogger}
|
||||
import sbt.Def
|
||||
|
|
@ -60,12 +60,12 @@ object ArtifactsTasks {
|
|||
loggerOpt = createLogger,
|
||||
projectName = projectName,
|
||||
sbtClassifiers = sbtClassifiers,
|
||||
cacheParams = CacheParams()
|
||||
.withParallel(parallelDownloads)
|
||||
.withCacheLocation(cache)
|
||||
.withChecksum(artifactsChecksums)
|
||||
cache = FileCache()
|
||||
.withLocation(cache)
|
||||
.withChecksums(artifactsChecksums)
|
||||
.withTtl(ttl)
|
||||
.withCachePolicies(cachePolicies)
|
||||
.withCachePolicies(cachePolicies),
|
||||
parallel = parallelDownloads
|
||||
)
|
||||
|
||||
val resOrError = ArtifactsRun.artifacts(
|
||||
|
|
@ -77,8 +77,8 @@ object ArtifactsTasks {
|
|||
resOrError match {
|
||||
case Left(err) =>
|
||||
throw err
|
||||
case Right(res) =>
|
||||
res
|
||||
case Right(res0) =>
|
||||
res0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package coursier.sbtcoursier
|
||||
|
||||
import coursier.ProjectCache
|
||||
import coursier.cache.FileCache
|
||||
import coursier.core._
|
||||
import coursier.internal.Typelevel
|
||||
import coursier.lmcoursier._
|
||||
|
|
@ -122,13 +123,13 @@ object ResolutionTasks {
|
|||
sbtClassifiers = sbtClassifiers,
|
||||
projectName = projectName,
|
||||
loggerOpt = createLogger,
|
||||
cacheParams = coursier.params.CacheParams()
|
||||
.withCacheLocation(cache)
|
||||
cache = FileCache()
|
||||
.withLocation(cache)
|
||||
.withCachePolicies(cachePolicies)
|
||||
.withTtl(ttl)
|
||||
.withChecksum(checksums)
|
||||
.withParallel(parallelDownloads)
|
||||
.withChecksums(checksums)
|
||||
,
|
||||
parallel = parallelDownloads,
|
||||
params = coursier.params.ResolutionParams()
|
||||
.withMaxIterations(maxIterations)
|
||||
.withProfiles(userEnabledProfiles)
|
||||
|
|
|
|||
Loading…
Reference in New Issue