mirror of https://github.com/sbt/sbt.git
Add back former coursierCredentials key
Not to break compatibility with former plugins
This commit is contained in:
parent
973cce68ad
commit
2c6a6503f1
|
|
@ -22,24 +22,25 @@ final class CoursierConfiguration private (
|
|||
val mavenProfiles: Vector[String],
|
||||
val scalaOrganization: Option[String],
|
||||
val scalaVersion: Option[String],
|
||||
val authenticationByRepositoryId: 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, None, None)
|
||||
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.credentials == x.credentials) && (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 * (17 + "coursier.lmcoursier.CoursierConfiguration".##) + log.##) + resolvers.##) + reorderResolvers.##) + parallelDownloads.##) + maxIterations.##) + sbtScalaOrganization.##) + sbtScalaVersion.##) + sbtScalaJars.##) + interProjectDependencies.##) + excludeDependencies.##) + fallbackDependencies.##) + autoScalaLibrary.##) + hasClassifiers.##) + classifiers.##) + mavenProfiles.##) + scalaOrganization.##) + scalaVersion.##) + credentials.##) + 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 + ", " + credentials + ", " + 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, 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, 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, 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)
|
||||
|
|
@ -107,6 +108,9 @@ final class CoursierConfiguration private (
|
|||
def withScalaVersion(scalaVersion: String): CoursierConfiguration = {
|
||||
copy(scalaVersion = Option(scalaVersion))
|
||||
}
|
||||
def withAuthenticationByRepositoryId(authenticationByRepositoryId: Vector[(String, coursier.core.Authentication)]): CoursierConfiguration = {
|
||||
copy(authenticationByRepositoryId = authenticationByRepositoryId)
|
||||
}
|
||||
def withCredentials(credentials: Seq[coursier.credentials.Credentials]): CoursierConfiguration = {
|
||||
copy(credentials = credentials)
|
||||
}
|
||||
|
|
@ -126,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], 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, 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, 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), credentials, 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))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,12 @@
|
|||
"default": "None",
|
||||
"since": "0.0.1"
|
||||
},
|
||||
{
|
||||
"name": "authenticationByRepositoryId",
|
||||
"type": "(String, coursier.core.Authentication)*",
|
||||
"default": "Vector.empty",
|
||||
"since": "0.0.1"
|
||||
},
|
||||
{
|
||||
"name": "credentials",
|
||||
"type": "Seq[coursier.credentials.Credentials]",
|
||||
|
|
|
|||
|
|
@ -86,12 +86,15 @@ class CoursierDependencyResolution(conf: CoursierConfiguration) extends Dependen
|
|||
else
|
||||
None
|
||||
|
||||
val authenticationByRepositoryId = conf.authenticationByRepositoryId.toMap
|
||||
|
||||
val mainRepositories = resolvers
|
||||
.flatMap { resolver =>
|
||||
FromSbt.repository(
|
||||
resolver,
|
||||
ivyProperties,
|
||||
log
|
||||
log,
|
||||
authenticationByRepositoryId.get(resolver.name)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -195,12 +195,18 @@ object FromSbt {
|
|||
|
||||
private def mavenRepositoryOpt(
|
||||
root: String,
|
||||
log: Logger
|
||||
log: Logger,
|
||||
authentication: Option[Authentication]
|
||||
): Option[MavenRepository] =
|
||||
try {
|
||||
CacheUrl.url(root) // ensure root is a URL whose protocol can be handled here
|
||||
val root0 = if (root.endsWith("/")) root else root + "/"
|
||||
Some(MavenRepository(root0))
|
||||
Some(
|
||||
MavenRepository(
|
||||
root0,
|
||||
authentication = authentication
|
||||
)
|
||||
)
|
||||
} catch {
|
||||
case e: MalformedURLException =>
|
||||
log.warn(
|
||||
|
|
@ -216,11 +222,12 @@ object FromSbt {
|
|||
def repository(
|
||||
resolver: Resolver,
|
||||
ivyProperties: Map[String, String],
|
||||
log: Logger
|
||||
log: Logger,
|
||||
authentication: Option[Authentication]
|
||||
): Option[Repository] =
|
||||
resolver match {
|
||||
case r: sbt.librarymanagement.MavenRepository =>
|
||||
mavenRepositoryOpt(r.root, log)
|
||||
mavenRepositoryOpt(r.root, log, authentication)
|
||||
|
||||
case r: FileRepository
|
||||
if r.patterns.ivyPatterns.lengthCompare(1) == 0 &&
|
||||
|
|
@ -236,7 +243,8 @@ object FromSbt {
|
|||
metadataPatternOpt = Some("file://" + r.patterns.ivyPatterns.head),
|
||||
changing = Some(true),
|
||||
properties = ivyProperties,
|
||||
dropInfoAttributes = true
|
||||
dropInfoAttributes = true,
|
||||
authentication = authentication
|
||||
) match {
|
||||
case Left(err) =>
|
||||
sys.error(
|
||||
|
|
@ -249,18 +257,18 @@ object FromSbt {
|
|||
Some(repo)
|
||||
|
||||
case Some(mavenCompatibleBase) =>
|
||||
mavenRepositoryOpt("file://" + mavenCompatibleBase, log)
|
||||
mavenRepositoryOpt("file://" + mavenCompatibleBase, log, authentication)
|
||||
}
|
||||
|
||||
case r: URLRepository if patternMatchGuard(r.patterns) =>
|
||||
parseMavenCompatResolver(log, ivyProperties, r.patterns)
|
||||
parseMavenCompatResolver(log, ivyProperties, authentication, r.patterns)
|
||||
|
||||
case raw: RawRepository if raw.name == "inter-project" => // sbt.RawRepository.equals just compares names anyway
|
||||
None
|
||||
|
||||
// Pattern Match resolver-type-specific RawRepositories
|
||||
case IBiblioRepository(p) =>
|
||||
parseMavenCompatResolver(log, ivyProperties, p)
|
||||
parseMavenCompatResolver(log, ivyProperties, authentication, p)
|
||||
|
||||
case other =>
|
||||
log.warn(s"Unrecognized repository ${other.name}, ignoring it")
|
||||
|
|
@ -304,6 +312,7 @@ object FromSbt {
|
|||
private def parseMavenCompatResolver(
|
||||
log: Logger,
|
||||
ivyProperties: Map[String, String],
|
||||
authentication: Option[Authentication],
|
||||
patterns: Patterns
|
||||
): Option[Repository] = {
|
||||
val mavenCompatibleBaseOpt0 = mavenCompatibleBaseOpt(patterns)
|
||||
|
|
@ -316,7 +325,8 @@ object FromSbt {
|
|||
metadataPatternOpt = Some(patterns.ivyPatterns.head),
|
||||
changing = None,
|
||||
properties = ivyProperties,
|
||||
dropInfoAttributes = true
|
||||
dropInfoAttributes = true,
|
||||
authentication = authentication
|
||||
) match {
|
||||
case Left(err) =>
|
||||
sys.error(
|
||||
|
|
@ -329,7 +339,7 @@ object FromSbt {
|
|||
Some(repo)
|
||||
|
||||
case Some(mavenCompatibleBase) =>
|
||||
mavenRepositoryOpt(mavenCompatibleBase, log)
|
||||
mavenRepositoryOpt(mavenCompatibleBase, log, authentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
package coursier
|
||||
|
||||
import java.io.{File, FileInputStream}
|
||||
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
|
||||
|
||||
def authentication: Authentication =
|
||||
Authentication(user, password)
|
||||
}
|
||||
|
||||
object Credentials {
|
||||
|
||||
private final case class Direct(user: String, password: String) extends Credentials {
|
||||
override def toString = s"Direct($user, ******)"
|
||||
}
|
||||
|
||||
private final case class FromFile(file: File) extends Credentials {
|
||||
|
||||
private lazy val props = {
|
||||
val p = new Properties()
|
||||
p.load(new FileInputStream(file))
|
||||
p
|
||||
}
|
||||
|
||||
private def findKey(keys: Seq[String]) = keys
|
||||
.iterator
|
||||
.map(props.getProperty)
|
||||
.filter(_ != null)
|
||||
.toStream
|
||||
.headOption
|
||||
.getOrElse {
|
||||
throw new NoSuchElementException(s"${keys.head} key in $file")
|
||||
}
|
||||
|
||||
lazy val user: String = findKey(FromFile.fileUserKeys)
|
||||
lazy val password: String = findKey(FromFile.filePasswordKeys)
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package coursier.sbtcoursiershared
|
|||
import java.io.File
|
||||
|
||||
import coursier.cache.{CacheDefaults, CacheLogger}
|
||||
import coursier.{Credentials => LegacyCredentials}
|
||||
import coursier.core.{Configuration, Project, Publication}
|
||||
import coursier.credentials.Credentials
|
||||
import coursier.lmcoursier.{FallbackDependency, SbtCoursierCache}
|
||||
|
|
@ -35,6 +36,8 @@ object SbtCoursierShared extends AutoPlugin {
|
|||
val mavenProfiles = settingKey[Set[String]]("")
|
||||
|
||||
val coursierUseSbtCredentials = settingKey[Boolean]("")
|
||||
@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]]("")
|
||||
|
|
@ -54,6 +57,7 @@ object SbtCoursierShared extends AutoPlugin {
|
|||
coursierReorderResolvers := true,
|
||||
coursierKeepPreloaded := false,
|
||||
coursierUseSbtCredentials := true,
|
||||
coursierCredentials := Map.empty,
|
||||
coursierExtraCredentials := Nil,
|
||||
coursierLogger := None,
|
||||
coursierCache := CacheDefaults.location
|
||||
|
|
|
|||
|
|
@ -81,6 +81,8 @@ object ResolutionTasks {
|
|||
|
||||
val ivyProperties = ResolutionParams.defaultIvyProperties()
|
||||
|
||||
val authenticationByRepositoryId = coursierCredentials.value.mapValues(_.authentication)
|
||||
|
||||
val (currentProject, fallbackDependencies, configGraphs) = currentProjectTask.value
|
||||
|
||||
val autoScalaLib = autoScalaLibrary.value && scalaModuleInfo.value.forall(_.overrideScalaVersion)
|
||||
|
|
@ -101,7 +103,8 @@ object ResolutionTasks {
|
|||
FromSbt.repository(
|
||||
resolver,
|
||||
ivyProperties,
|
||||
log
|
||||
log,
|
||||
authenticationByRepositoryId.get(resolver.name)
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
user=user
|
||||
password=pass
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
object Main extends App
|
||||
|
|
@ -0,0 +1 @@
|
|||
> update
|
||||
|
|
@ -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"
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
object Main extends App
|
||||
|
|
@ -0,0 +1 @@
|
|||
> update
|
||||
|
|
@ -87,6 +87,7 @@ object LmCoursierPlugin extends AutoPlugin {
|
|||
val autoScalaLib = autoScalaLibrary.value && scalaModuleInfo.value.forall(_.overrideScalaVersion)
|
||||
val profiles = mavenProfiles.value
|
||||
|
||||
val authenticationByRepositoryId = coursierCredentials.value.mapValues(_.authentication)
|
||||
val credentials = credentialsTask.value
|
||||
|
||||
val createLogger = coursierLogger.value
|
||||
|
|
@ -122,6 +123,7 @@ object LmCoursierPlugin extends AutoPlugin {
|
|||
.withMavenProfiles(profiles.toVector.sorted)
|
||||
.withScalaOrganization(scalaOrg)
|
||||
.withScalaVersion(scalaVer)
|
||||
.withAuthenticationByRepositoryId(authenticationByRepositoryId.toVector.sortBy(_._1))
|
||||
.withCredentials(credentials)
|
||||
.withLogger(createLogger)
|
||||
.withCache(cache)
|
||||
|
|
|
|||
Loading…
Reference in New Issue