Handle credentials key from global settings

This commit is contained in:
Alexandre Archambault 2019-04-04 11:35:12 +02:00
parent 2c6a6503f1
commit 73c5d9737d
11 changed files with 59 additions and 3 deletions

View File

@ -52,13 +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,
coursierExtraCredentials := Nil,
coursierLogger := None,
coursierCache := CacheDefaults.location
)

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,5 @@
scalaVersion := "2.11.8"
resolvers += "authenticated" at sys.env("TEST_REPOSITORY")
libraryDependencies += "com.abc" % "test" % "0.1"

View File

@ -0,0 +1,7 @@
coursierUseSbtCredentials := true
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