Merge pull request #54 from alexarchambault/coursier-1.1.0-M14

Switch to coursier 1.1.0-M14
This commit is contained in:
Alexandre Archambault 2019-04-05 10:14:14 +02:00 committed by GitHub
commit fa23ba2dfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 200 additions and 72 deletions

View File

@ -21,7 +21,7 @@ lazy val `lm-coursier` = project
.settings(
shared,
libraryDependencies ++= Seq(
"io.get-coursier" %% "coursier" % "1.1.0-M13-2",
"io.get-coursier" %% "coursier" % "1.1.0-M14-1",
// We depend on librarymanagement-ivy rather than just
// librarymanagement-core to handle the ModuleDescriptor passed
// to DependencyResolutionInterface.update, which is an

View File

@ -23,24 +23,24 @@ final class CoursierConfiguration private (
val scalaOrganization: Option[String],
val scalaVersion: Option[String],
val authenticationByRepositoryId: Vector[(String, coursier.core.Authentication)],
val authenticationByHost: Vector[(String, coursier.core.Authentication)],
val credentials: Seq[coursier.credentials.Credentials],
val logger: Option[coursier.cache.CacheLogger],
val cache: Option[java.io.File]) extends Serializable {
private def this() = this(None, sbt.librarymanagement.Resolver.defaults, true, 6, 100, None, None, Vector.empty, Vector.empty, Vector.empty, Vector.empty, true, false, Vector.empty, Vector.empty, None, None, Vector.empty, Vector.empty, None, None)
override def equals(o: Any): Boolean = o match {
case x: CoursierConfiguration => (this.log == x.log) && (this.resolvers == x.resolvers) && (this.reorderResolvers == x.reorderResolvers) && (this.parallelDownloads == x.parallelDownloads) && (this.maxIterations == x.maxIterations) && (this.sbtScalaOrganization == x.sbtScalaOrganization) && (this.sbtScalaVersion == x.sbtScalaVersion) && (this.sbtScalaJars == x.sbtScalaJars) && (this.interProjectDependencies == x.interProjectDependencies) && (this.excludeDependencies == x.excludeDependencies) && (this.fallbackDependencies == x.fallbackDependencies) && (this.autoScalaLibrary == x.autoScalaLibrary) && (this.hasClassifiers == x.hasClassifiers) && (this.classifiers == x.classifiers) && (this.mavenProfiles == x.mavenProfiles) && (this.scalaOrganization == x.scalaOrganization) && (this.scalaVersion == x.scalaVersion) && (this.authenticationByRepositoryId == x.authenticationByRepositoryId) && (this.authenticationByHost == x.authenticationByHost) && (this.logger == x.logger) && (this.cache == x.cache)
case x: CoursierConfiguration => (this.log == x.log) && (this.resolvers == x.resolvers) && (this.reorderResolvers == x.reorderResolvers) && (this.parallelDownloads == x.parallelDownloads) && (this.maxIterations == x.maxIterations) && (this.sbtScalaOrganization == x.sbtScalaOrganization) && (this.sbtScalaVersion == x.sbtScalaVersion) && (this.sbtScalaJars == x.sbtScalaJars) && (this.interProjectDependencies == x.interProjectDependencies) && (this.excludeDependencies == x.excludeDependencies) && (this.fallbackDependencies == x.fallbackDependencies) && (this.autoScalaLibrary == x.autoScalaLibrary) && (this.hasClassifiers == x.hasClassifiers) && (this.classifiers == x.classifiers) && (this.mavenProfiles == x.mavenProfiles) && (this.scalaOrganization == x.scalaOrganization) && (this.scalaVersion == x.scalaVersion) && (this.authenticationByRepositoryId == x.authenticationByRepositoryId) && (this.credentials == x.credentials) && (this.logger == x.logger) && (this.cache == x.cache)
case _ => false
}
override def hashCode: Int = {
37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "coursier.lmcoursier.CoursierConfiguration".##) + log.##) + resolvers.##) + reorderResolvers.##) + parallelDownloads.##) + maxIterations.##) + sbtScalaOrganization.##) + sbtScalaVersion.##) + sbtScalaJars.##) + interProjectDependencies.##) + excludeDependencies.##) + fallbackDependencies.##) + autoScalaLibrary.##) + hasClassifiers.##) + classifiers.##) + mavenProfiles.##) + scalaOrganization.##) + scalaVersion.##) + authenticationByRepositoryId.##) + authenticationByHost.##) + logger.##) + cache.##)
37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "coursier.lmcoursier.CoursierConfiguration".##) + log.##) + resolvers.##) + reorderResolvers.##) + parallelDownloads.##) + maxIterations.##) + sbtScalaOrganization.##) + sbtScalaVersion.##) + sbtScalaJars.##) + interProjectDependencies.##) + excludeDependencies.##) + fallbackDependencies.##) + autoScalaLibrary.##) + hasClassifiers.##) + classifiers.##) + mavenProfiles.##) + scalaOrganization.##) + scalaVersion.##) + authenticationByRepositoryId.##) + credentials.##) + logger.##) + cache.##)
}
override def toString: String = {
"CoursierConfiguration(" + log + ", " + resolvers + ", " + reorderResolvers + ", " + parallelDownloads + ", " + maxIterations + ", " + sbtScalaOrganization + ", " + sbtScalaVersion + ", " + sbtScalaJars + ", " + interProjectDependencies + ", " + excludeDependencies + ", " + fallbackDependencies + ", " + autoScalaLibrary + ", " + hasClassifiers + ", " + classifiers + ", " + mavenProfiles + ", " + scalaOrganization + ", " + scalaVersion + ", " + authenticationByRepositoryId + ", " + authenticationByHost + ", " + logger + ", " + cache + ")"
"CoursierConfiguration(" + log + ", " + resolvers + ", " + reorderResolvers + ", " + parallelDownloads + ", " + maxIterations + ", " + sbtScalaOrganization + ", " + sbtScalaVersion + ", " + sbtScalaJars + ", " + interProjectDependencies + ", " + excludeDependencies + ", " + fallbackDependencies + ", " + autoScalaLibrary + ", " + hasClassifiers + ", " + classifiers + ", " + mavenProfiles + ", " + scalaOrganization + ", " + scalaVersion + ", " + authenticationByRepositoryId + ", " + credentials + ", " + logger + ", " + cache + ")"
}
private[this] def copy(log: Option[xsbti.Logger] = log, resolvers: Vector[sbt.librarymanagement.Resolver] = resolvers, reorderResolvers: Boolean = reorderResolvers, parallelDownloads: Int = parallelDownloads, maxIterations: Int = maxIterations, sbtScalaOrganization: Option[String] = sbtScalaOrganization, sbtScalaVersion: Option[String] = sbtScalaVersion, sbtScalaJars: Vector[java.io.File] = sbtScalaJars, interProjectDependencies: Vector[coursier.core.Project] = interProjectDependencies, excludeDependencies: Vector[(String, String)] = excludeDependencies, fallbackDependencies: Vector[coursier.lmcoursier.FallbackDependency] = fallbackDependencies, autoScalaLibrary: Boolean = autoScalaLibrary, hasClassifiers: Boolean = hasClassifiers, classifiers: Vector[String] = classifiers, mavenProfiles: Vector[String] = mavenProfiles, scalaOrganization: Option[String] = scalaOrganization, scalaVersion: Option[String] = scalaVersion, authenticationByRepositoryId: Vector[(String, coursier.core.Authentication)] = authenticationByRepositoryId, authenticationByHost: Vector[(String, coursier.core.Authentication)] = authenticationByHost, logger: Option[coursier.cache.CacheLogger] = logger, cache: Option[java.io.File] = cache): CoursierConfiguration = {
new CoursierConfiguration(log, resolvers, reorderResolvers, parallelDownloads, maxIterations, sbtScalaOrganization, sbtScalaVersion, sbtScalaJars, interProjectDependencies, excludeDependencies, fallbackDependencies, autoScalaLibrary, hasClassifiers, classifiers, mavenProfiles, scalaOrganization, scalaVersion, authenticationByRepositoryId, authenticationByHost, logger, cache)
private[this] def copy(log: Option[xsbti.Logger] = log, resolvers: Vector[sbt.librarymanagement.Resolver] = resolvers, reorderResolvers: Boolean = reorderResolvers, parallelDownloads: Int = parallelDownloads, maxIterations: Int = maxIterations, sbtScalaOrganization: Option[String] = sbtScalaOrganization, sbtScalaVersion: Option[String] = sbtScalaVersion, sbtScalaJars: Vector[java.io.File] = sbtScalaJars, interProjectDependencies: Vector[coursier.core.Project] = interProjectDependencies, excludeDependencies: Vector[(String, String)] = excludeDependencies, fallbackDependencies: Vector[coursier.lmcoursier.FallbackDependency] = fallbackDependencies, autoScalaLibrary: Boolean = autoScalaLibrary, hasClassifiers: Boolean = hasClassifiers, classifiers: Vector[String] = classifiers, mavenProfiles: Vector[String] = mavenProfiles, scalaOrganization: Option[String] = scalaOrganization, scalaVersion: Option[String] = scalaVersion, authenticationByRepositoryId: Vector[(String, coursier.core.Authentication)] = authenticationByRepositoryId, credentials: Seq[coursier.credentials.Credentials] = credentials, logger: Option[coursier.cache.CacheLogger] = logger, cache: Option[java.io.File] = cache): CoursierConfiguration = {
new CoursierConfiguration(log, resolvers, reorderResolvers, parallelDownloads, maxIterations, sbtScalaOrganization, sbtScalaVersion, sbtScalaJars, interProjectDependencies, excludeDependencies, fallbackDependencies, autoScalaLibrary, hasClassifiers, classifiers, mavenProfiles, scalaOrganization, scalaVersion, authenticationByRepositoryId, credentials, logger, cache)
}
def withLog(log: Option[xsbti.Logger]): CoursierConfiguration = {
copy(log = log)
@ -111,8 +111,8 @@ final class CoursierConfiguration private (
def withAuthenticationByRepositoryId(authenticationByRepositoryId: Vector[(String, coursier.core.Authentication)]): CoursierConfiguration = {
copy(authenticationByRepositoryId = authenticationByRepositoryId)
}
def withAuthenticationByHost(authenticationByHost: Vector[(String, coursier.core.Authentication)]): CoursierConfiguration = {
copy(authenticationByHost = authenticationByHost)
def withCredentials(credentials: Seq[coursier.credentials.Credentials]): CoursierConfiguration = {
copy(credentials = credentials)
}
def withLogger(logger: Option[coursier.cache.CacheLogger]): CoursierConfiguration = {
copy(logger = logger)
@ -130,6 +130,6 @@ final class CoursierConfiguration private (
object CoursierConfiguration {
def apply(): CoursierConfiguration = new CoursierConfiguration()
def apply(log: Option[xsbti.Logger], resolvers: Vector[sbt.librarymanagement.Resolver], reorderResolvers: Boolean, parallelDownloads: Int, maxIterations: Int, sbtScalaOrganization: Option[String], sbtScalaVersion: Option[String], sbtScalaJars: Vector[java.io.File], interProjectDependencies: Vector[coursier.core.Project], excludeDependencies: Vector[(String, String)], fallbackDependencies: Vector[coursier.lmcoursier.FallbackDependency], autoScalaLibrary: Boolean, hasClassifiers: Boolean, classifiers: Vector[String], mavenProfiles: Vector[String], scalaOrganization: Option[String], scalaVersion: Option[String], authenticationByRepositoryId: Vector[(String, coursier.core.Authentication)], authenticationByHost: Vector[(String, coursier.core.Authentication)], logger: Option[coursier.cache.CacheLogger], cache: Option[java.io.File]): CoursierConfiguration = new CoursierConfiguration(log, resolvers, reorderResolvers, parallelDownloads, maxIterations, sbtScalaOrganization, sbtScalaVersion, sbtScalaJars, interProjectDependencies, excludeDependencies, fallbackDependencies, autoScalaLibrary, hasClassifiers, classifiers, mavenProfiles, scalaOrganization, scalaVersion, authenticationByRepositoryId, authenticationByHost, logger, cache)
def apply(log: xsbti.Logger, resolvers: Vector[sbt.librarymanagement.Resolver], reorderResolvers: Boolean, parallelDownloads: Int, maxIterations: Int, sbtScalaOrganization: String, sbtScalaVersion: String, sbtScalaJars: Vector[java.io.File], interProjectDependencies: Vector[coursier.core.Project], excludeDependencies: Vector[(String, String)], fallbackDependencies: Vector[coursier.lmcoursier.FallbackDependency], autoScalaLibrary: Boolean, hasClassifiers: Boolean, classifiers: Vector[String], mavenProfiles: Vector[String], scalaOrganization: String, scalaVersion: String, authenticationByRepositoryId: Vector[(String, coursier.core.Authentication)], authenticationByHost: Vector[(String, coursier.core.Authentication)], logger: coursier.cache.CacheLogger, cache: java.io.File): CoursierConfiguration = new CoursierConfiguration(Option(log), resolvers, reorderResolvers, parallelDownloads, maxIterations, Option(sbtScalaOrganization), Option(sbtScalaVersion), sbtScalaJars, interProjectDependencies, excludeDependencies, fallbackDependencies, autoScalaLibrary, hasClassifiers, classifiers, mavenProfiles, Option(scalaOrganization), Option(scalaVersion), authenticationByRepositoryId, authenticationByHost, Option(logger), Option(cache))
def apply(log: Option[xsbti.Logger], resolvers: Vector[sbt.librarymanagement.Resolver], reorderResolvers: Boolean, parallelDownloads: Int, maxIterations: Int, sbtScalaOrganization: Option[String], sbtScalaVersion: Option[String], sbtScalaJars: Vector[java.io.File], interProjectDependencies: Vector[coursier.core.Project], excludeDependencies: Vector[(String, String)], fallbackDependencies: Vector[coursier.lmcoursier.FallbackDependency], autoScalaLibrary: Boolean, hasClassifiers: Boolean, classifiers: Vector[String], mavenProfiles: Vector[String], scalaOrganization: Option[String], scalaVersion: Option[String], authenticationByRepositoryId: Vector[(String, coursier.core.Authentication)], credentials: Seq[coursier.credentials.Credentials], logger: Option[coursier.cache.CacheLogger], cache: Option[java.io.File]): CoursierConfiguration = new CoursierConfiguration(log, resolvers, reorderResolvers, parallelDownloads, maxIterations, sbtScalaOrganization, sbtScalaVersion, sbtScalaJars, interProjectDependencies, excludeDependencies, fallbackDependencies, autoScalaLibrary, hasClassifiers, classifiers, mavenProfiles, scalaOrganization, scalaVersion, authenticationByRepositoryId, credentials, logger, cache)
def apply(log: xsbti.Logger, resolvers: Vector[sbt.librarymanagement.Resolver], reorderResolvers: Boolean, parallelDownloads: Int, maxIterations: Int, sbtScalaOrganization: String, sbtScalaVersion: String, sbtScalaJars: Vector[java.io.File], interProjectDependencies: Vector[coursier.core.Project], excludeDependencies: Vector[(String, String)], fallbackDependencies: Vector[coursier.lmcoursier.FallbackDependency], autoScalaLibrary: Boolean, hasClassifiers: Boolean, classifiers: Vector[String], mavenProfiles: Vector[String], scalaOrganization: String, scalaVersion: String, authenticationByRepositoryId: Vector[(String, coursier.core.Authentication)], credentials: Seq[coursier.credentials.Credentials], logger: coursier.cache.CacheLogger, cache: java.io.File): CoursierConfiguration = new CoursierConfiguration(Option(log), resolvers, reorderResolvers, parallelDownloads, maxIterations, Option(sbtScalaOrganization), Option(sbtScalaVersion), sbtScalaJars, interProjectDependencies, excludeDependencies, fallbackDependencies, autoScalaLibrary, hasClassifiers, classifiers, mavenProfiles, Option(scalaOrganization), Option(scalaVersion), authenticationByRepositoryId, credentials, Option(logger), Option(cache))
}

View File

@ -116,8 +116,8 @@
"since": "0.0.1"
},
{
"name": "authenticationByHost",
"type": "(String, coursier.core.Authentication)*",
"name": "credentials",
"type": "Seq[coursier.credentials.Credentials]",
"default": "Vector.empty",
"since": "0.0.1"
},

View File

@ -4,8 +4,7 @@ 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, FileCache}
import coursier.cache.{CacheDefaults, FileCache}
import coursier.internal.Typelevel
import sbt.internal.librarymanagement.IvySbt
import sbt.librarymanagement._
@ -75,7 +74,7 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
val ttl = CacheDefaults.ttl
val loggerOpt = conf.logger
val cache = conf.cache.getOrElse(CacheDefaults.location)
val cachePolicies = CachePolicy.default
val cachePolicies = CacheDefaults.cachePolicies
val checksums = CacheDefaults.checksums
val projectName = "" // used for logging only
@ -98,7 +97,6 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
authenticationByRepositoryId.get(resolver.name)
)
}
.map(withAuthenticationByHost(_, conf.authenticationByHost.toMap))
val interProjectRepo = InterProjectRepository(conf.interProjectDependencies)
@ -123,6 +121,13 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
val typelevel = so == Typelevel.typelevelOrg
val cache0 = coursier.cache.FileCache()
.withLocation(cache)
.withCachePolicies(cachePolicies)
.withTtl(ttl)
.withChecksums(checksums)
.withCredentials(conf.credentials)
val resolutionParams = ResolutionParams(
dependencies = dependencies,
fallbackDependencies = conf.fallbackDependencies,
@ -135,11 +140,7 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
sbtClassifiers = false,
projectName = projectName,
loggerOpt = loggerOpt,
cache = coursier.cache.FileCache()
.withLocation(cache)
.withCachePolicies(cachePolicies)
.withTtl(ttl)
.withChecksums(checksums),
cache = cache0,
parallel = conf.parallelDownloads,
params = coursier.params.ResolutionParams()
.withMaxIterations(conf.maxIterations)
@ -156,11 +157,7 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
loggerOpt = loggerOpt,
projectName = projectName,
sbtClassifiers = false,
cache = FileCache()
.withLocation(cache)
.withChecksums(checksums)
.withTtl(ttl)
.withCachePolicies(cachePolicies),
cache = cache0,
parallel = conf.parallelDownloads
)

View File

@ -5,6 +5,7 @@ import java.util.Properties
import coursier.core.Authentication
@deprecated("Use coursierExtraCredentials rather than coursierCredentials", "1.1.0-M14")
sealed abstract class Credentials extends Product with Serializable {
def user: String
def password: String
@ -15,11 +16,11 @@ sealed abstract class Credentials extends Product with Serializable {
object Credentials {
final case class Direct(user: String, password: String) extends Credentials {
private final case class Direct(user: String, password: String) extends Credentials {
override def toString = s"Direct($user, ******)"
}
final case class FromFile(file: File) extends Credentials {
private final case class FromFile(file: File) extends Credentials {
private lazy val props = {
val p = new Properties()
@ -41,16 +42,18 @@ object Credentials {
lazy val password: String = findKey(FromFile.filePasswordKeys)
}
object FromFile {
private object FromFile {
// from sbt.Credentials
private val fileUserKeys = Seq("user", "user.name", "username")
private val filePasswordKeys = Seq("password", "pwd", "pass", "passwd")
}
@deprecated("Use coursierExtraCredentials rather than coursierCredentials", "1.1.0-M14")
def apply(user: String, password: String): Credentials =
Direct(user, password)
@deprecated("Use coursierExtraCredentials rather than coursierCredentials", "1.1.0-M14")
def apply(file: File): Credentials =
FromFile(file)

View File

@ -1,6 +1,7 @@
package coursier.sbtcoursiershared
import coursier.core._
import coursier.credentials.DirectCredentials
import coursier.lmcoursier._
import coursier.sbtcoursiershared.SbtCoursierShared.autoImport._
import coursier.sbtcoursiershared.Structure._
@ -181,32 +182,40 @@ object InputsTasks {
}
}
val authenticationByHostTask = Def.taskDyn {
val credentialsTask = Def.taskDyn {
val useSbtCredentials = coursierUseSbtCredentials.value
if (useSbtCredentials)
Def.task {
val log = streams.value.log
val fromSbt =
if (useSbtCredentials)
Def.task {
val log = streams.value.log
sbt.Keys.credentials.value
.flatMap {
case dc: sbt.DirectCredentials => List(dc)
case fc: sbt.FileCredentials =>
sbt.Credentials.loadCredentials(fc.path) match {
case Left(err) =>
log.warn(s"$err, ignoring it")
Nil
case Right(dc) => List(dc)
}
}
.map { c =>
c.host -> Authentication(c.userName, c.passwd)
}
.toMap
}
else
Def.task(Map.empty[String, Authentication])
sbt.Keys.credentials.value
.flatMap {
case dc: sbt.DirectCredentials => List(dc)
case fc: sbt.FileCredentials =>
sbt.Credentials.loadCredentials(fc.path) match {
case Left(err) =>
log.warn(s"$err, ignoring it")
Nil
case Right(dc) => List(dc)
}
}
.map { c =>
DirectCredentials()
.withHost(c.host)
.withUsername(c.userName)
.withPassword(c.passwd)
.withRealm(Some(c.realm).filter(_.nonEmpty))
}
}
else
Def.task(Seq.empty[DirectCredentials])
Def.task {
fromSbt.value ++ coursierExtraCredentials.value
}
}
}

View File

@ -3,8 +3,9 @@ package coursier.sbtcoursiershared
import java.io.File
import coursier.cache.{CacheDefaults, CacheLogger}
import coursier.Credentials
import coursier.{Credentials => LegacyCredentials}
import coursier.core.{Configuration, Project, Publication}
import coursier.credentials.Credentials
import coursier.lmcoursier.{FallbackDependency, SbtCoursierCache}
import sbt.{AutoPlugin, Classpaths, Compile, Setting, TaskKey, Test, settingKey, taskKey}
import sbt.Keys._
@ -35,7 +36,9 @@ object SbtCoursierShared extends AutoPlugin {
val mavenProfiles = settingKey[Set[String]]("")
val coursierUseSbtCredentials = settingKey[Boolean]("")
val coursierCredentials = taskKey[Map[String, Credentials]]("")
@deprecated("Use coursierExtraCredentials rather than coursierCredentials", "1.1.0-M14")
val coursierCredentials = taskKey[Map[String, LegacyCredentials]]("")
val coursierExtraCredentials = taskKey[Seq[Credentials]]("")
val coursierLogger = taskKey[Option[CacheLogger]]("")
@ -49,12 +52,17 @@ object SbtCoursierShared extends AutoPlugin {
def publicationsSetting(packageConfigs: Seq[(sbt.Configuration, Configuration)]): Setting[_] =
coursierPublications := ArtifactsTasks.coursierPublicationsTask(packageConfigs: _*).value
override def globalSettings: Seq[Setting[_]] =
Seq(
coursierUseSbtCredentials := true,
coursierCredentials := Map.empty,
coursierExtraCredentials := Nil
)
override def buildSettings: Seq[Setting[_]] =
Seq(
coursierReorderResolvers := true,
coursierKeepPreloaded := false,
coursierUseSbtCredentials := true,
coursierCredentials := Map.empty,
coursierLogger := None,
coursierCache := CacheDefaults.location
)

View File

@ -7,6 +7,7 @@ import coursier.cache.FileCache
import coursier.core._
import coursier.lmcoursier._
import coursier.sbtcoursier.Keys._
import coursier.sbtcoursiershared.InputsTasks.credentialsTask
import coursier.sbtcoursiershared.SbtCoursierShared.autoImport.{coursierCache, coursierLogger}
import sbt.Def
import sbt.Keys._
@ -45,6 +46,7 @@ object ArtifactsTasks {
val ttl = coursierTtl.value
val cache = coursierCache.value
val createLogger = coursierLogger.value
val credentials = credentialsTask.value
val log = streams.value.log
@ -64,7 +66,8 @@ object ArtifactsTasks {
.withLocation(cache)
.withChecksums(artifactsChecksums)
.withTtl(ttl)
.withCachePolicies(cachePolicies),
.withCachePolicies(cachePolicies)
.withCredentials(credentials),
parallel = parallelDownloads
)

View File

@ -191,7 +191,7 @@ object CoursierPlugin extends AutoPlugin {
coursierMaxIterations := ResolutionProcess.defaultMaxIterations,
coursierChecksums := Seq(Some("SHA-1"), None),
coursierArtifactsChecksums := Seq(None),
coursierCachePolicies := CachePolicy.default,
coursierCachePolicies := CacheDefaults.cachePolicies,
coursierTtl := CacheDefaults.ttl,
coursierVerbosity := Settings.defaultVerbosityLevel(sLog.value)
)

View File

@ -2,9 +2,10 @@ package coursier.sbtcoursier
import coursier.core._
import coursier.lmcoursier._
import coursier.parse.ModuleParser
import coursier.sbtcoursier.Keys._
import coursier.sbtcoursiershared.SbtCoursierShared.autoImport._
import coursier.util.{Parse, Print}
import coursier.util.Print
import sbt.Def
import sbt.Keys._
@ -102,7 +103,7 @@ object DisplayTasks {
sbtClassifiers: Boolean = false,
ignoreArtifactErrors: Boolean = false
) = Def.task {
val module = Parse.module(moduleName, scalaVersion.value)
val module = ModuleParser.module(moduleName, scalaVersion.value)
.right
.getOrElse(throw new RuntimeException(s"Could not parse module `$moduleName`"))

View File

@ -5,9 +5,8 @@ import coursier.cache.FileCache
import coursier.core._
import coursier.internal.Typelevel
import coursier.lmcoursier._
import coursier.lmcoursier.Inputs.withAuthenticationByHost
import coursier.sbtcoursier.Keys._
import coursier.sbtcoursiershared.InputsTasks.authenticationByHostTask
import coursier.sbtcoursiershared.InputsTasks.credentialsTask
import coursier.sbtcoursiershared.SbtCoursierShared.autoImport._
import sbt.Def
import sbt.Keys._
@ -92,7 +91,7 @@ object ResolutionTasks {
// TODO Warn about possible duplicated modules from source repositories?
val authenticationByHost = authenticationByHostTask.value
val credentials = credentialsTask.value
val parentProjectCache: ProjectCache = coursierParentProjectCache.value
.get(resolvers)
@ -108,7 +107,6 @@ object ResolutionTasks {
authenticationByRepositoryId.get(resolver.name)
)
}
.map(withAuthenticationByHost(_, authenticationByHost))
val resOrError = ResolutionRun.resolutions(
ResolutionParams(
@ -128,7 +126,7 @@ object ResolutionTasks {
.withCachePolicies(cachePolicies)
.withTtl(ttl)
.withChecksums(checksums)
,
.withCredentials(credentials),
parallel = parallelDownloads,
params = coursier.params.ResolutionParams()
.withMaxIterations(maxIterations)

View File

@ -0,0 +1,7 @@
scalaVersion := "2.11.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
coursierCredentials += "authenticated" -> coursier.Credentials(file("credentials"))
libraryDependencies += "com.abc" % "test" % "0.1"

View File

@ -0,0 +1,13 @@
addSbtPlugin {
val name = sys.props.getOrElse(
"plugin.name",
sys.error("plugin.name Java property not set")
)
val version = sys.props.getOrElse(
"plugin.version",
sys.error("plugin.version Java property not set")
)
"io.get-coursier" % name % version
}

View File

@ -1,7 +1,18 @@
import java.nio.file.Files
scalaVersion := "2.11.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
coursierCredentials += "authenticated" -> coursier.Credentials(file("credentials"))
coursierExtraCredentials += {
val content =
s"""foo.host=${uri(sys.env("TEST_REPOSITORY")).getHost}
|foo.username=user
|foo.password=pass
""".stripMargin
val dest = baseDirectory.in(ThisBuild).value / "project" / "target" / "cred"
Files.write(dest.toPath, content.getBytes("UTF-8"))
coursier.credentials.Credentials(dest)
}
libraryDependencies += "com.abc" % "test" % "0.1"

View File

@ -0,0 +1,5 @@
scalaVersion := "2.11.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
libraryDependencies += "com.abc" % "test" % "0.1"

View File

@ -0,0 +1,5 @@
coursierExtraCredentials += coursier.credentials.Credentials(
uri(sys.env("TEST_REPOSITORY")).getHost,
sys.env("TEST_REPOSITORY_USER"),
sys.env("TEST_REPOSITORY_PASSWORD")
)

View File

@ -0,0 +1,13 @@
addSbtPlugin {
val name = sys.props.getOrElse(
"plugin.name",
sys.error("plugin.name Java property not set")
)
val version = sys.props.getOrElse(
"plugin.version",
sys.error("plugin.version Java property not set")
)
"io.get-coursier" % name % version
}

View File

@ -0,0 +1 @@
object Main extends App

View File

@ -0,0 +1 @@
> update

View File

@ -0,0 +1,10 @@
scalaVersion := "2.11.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
coursierCredentials += "authenticated" -> coursier.Credentials(
sys.env("TEST_REPOSITORY_USER"),
sys.env("TEST_REPOSITORY_PASSWORD")
)
libraryDependencies += "com.abc" % "test" % "0.1"

View File

@ -0,0 +1,13 @@
addSbtPlugin {
val name = sys.props.getOrElse(
"plugin.name",
sys.error("plugin.name Java property not set")
)
val version = sys.props.getOrElse(
"plugin.version",
sys.error("plugin.version Java property not set")
)
"io.get-coursier" % name % version
}

View File

@ -0,0 +1 @@
object Main extends App

View File

@ -0,0 +1 @@
> update

View File

@ -0,0 +1,5 @@
scalaVersion := "2.11.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
libraryDependencies += "com.abc" % "test" % "0.1"

View File

@ -0,0 +1,6 @@
credentials += Credentials(
"",
sys.env("TEST_REPOSITORY_HOST"),
sys.env("TEST_REPOSITORY_USER"),
sys.env("TEST_REPOSITORY_PASSWORD")
)

View File

@ -0,0 +1,13 @@
addSbtPlugin {
val name = sys.props.getOrElse(
"plugin.name",
sys.error("plugin.name Java property not set")
)
val version = sys.props.getOrElse(
"plugin.version",
sys.error("plugin.version Java property not set")
)
"io.get-coursier" % name % version
}

View File

@ -0,0 +1 @@
object Main extends App

View File

@ -0,0 +1 @@
> update

View File

@ -2,7 +2,6 @@ scalaVersion := "2.11.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
coursierUseSbtCredentials := true
credentials += Credentials(
"",
sys.env("TEST_REPOSITORY_HOST"),

View File

@ -2,7 +2,8 @@ scalaVersion := "2.11.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
coursierCredentials += "authenticated" -> coursier.Credentials(
coursierExtraCredentials += coursier.credentials.Credentials(
uri(sys.env("TEST_REPOSITORY")).getHost,
sys.env("TEST_REPOSITORY_USER"),
sys.env("TEST_REPOSITORY_PASSWORD")
)

View File

@ -2,7 +2,7 @@ package coursier.sbtlmcoursier
import coursier.core.Classifier
import coursier.lmcoursier.{CoursierConfiguration, CoursierDependencyResolution, Inputs}
import coursier.sbtcoursiershared.InputsTasks.authenticationByHostTask
import coursier.sbtcoursiershared.InputsTasks.credentialsTask
import coursier.sbtcoursiershared.SbtCoursierShared
import sbt.{AutoPlugin, Classpaths, Def, Setting, Task, taskKey}
import sbt.Project.inTask
@ -88,7 +88,7 @@ object LmCoursierPlugin extends AutoPlugin {
val profiles = mavenProfiles.value
val authenticationByRepositoryId = coursierCredentials.value.mapValues(_.authentication)
val authenticationByHost = authenticationByHostTask.value
val credentials = credentialsTask.value
val createLogger = coursierLogger.value
@ -124,7 +124,7 @@ object LmCoursierPlugin extends AutoPlugin {
.withScalaOrganization(scalaOrg)
.withScalaVersion(scalaVer)
.withAuthenticationByRepositoryId(authenticationByRepositoryId.toVector.sortBy(_._1))
.withAuthenticationByHost(authenticationByHost.toVector.sortBy(_._1))
.withCredentials(credentials)
.withLogger(createLogger)
.withCache(cache)
.withLog(s.log)

View File

@ -1 +1 @@
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.1.0-M13-3")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.1.0-M13-4")