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