Removing auto-credentials, because they fundamentally cannot work behind a password-gated artifact server.
This commit is contained in:
parent
862405422d
commit
56622729e2
2 changed files with 34 additions and 33 deletions
|
@ -1,5 +1,7 @@
|
|||
package gs;
|
||||
|
||||
import sbt._
|
||||
|
||||
object Gs {
|
||||
/**
|
||||
* Standard compiler options used by GS projects.
|
||||
|
@ -81,4 +83,36 @@ object Gs {
|
|||
val MavenUser: String = "GS_MAVEN_USER"
|
||||
val MavenToken: String = "GS_MAVEN_TOKEN"
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefers to load credentials from file, if a file is available. Otherwise
|
||||
* mandates that the following environment variables exist:
|
||||
*
|
||||
* - `GS_MAVEN_USER`
|
||||
* - `GS_MAVEN_TOKEN`
|
||||
*
|
||||
* @return The selected credentials for GS Maven.
|
||||
*/
|
||||
def selectCredentials(): Credentials =
|
||||
if ((Path.userHome / ".sbt" / ".credentials").exists())
|
||||
Credentials(Path.userHome / ".sbt" / ".credentials")
|
||||
else
|
||||
Credentials.apply(
|
||||
realm =Gs.MavenRealm,
|
||||
host = Gs.MavenHost,
|
||||
userName = sys.env
|
||||
.get(Gs.Environment.MavenUser)
|
||||
.getOrElse(
|
||||
throw new RuntimeException(
|
||||
s"You must either provide ~/.sbt/.credentials or specify the ${Gs.Environment.MavenUser} environment variable."
|
||||
)
|
||||
),
|
||||
passwd = sys.env
|
||||
.get(Gs.Environment.MavenToken)
|
||||
.getOrElse(
|
||||
throw new RuntimeException(
|
||||
s"You must either provide ~/.sbt/.credentials or specify the ${Gs.Environment.MavenToken} environment variable."
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -10,40 +10,7 @@ object GsPlugin extends AutoPlugin {
|
|||
|
||||
import autoImport._
|
||||
|
||||
/**
|
||||
* Prefers to load credentials from file, if a file is available. Otherwise
|
||||
* mandates that the following environment variables exist:
|
||||
*
|
||||
* - `GS_MAVEN_USER`
|
||||
* - `GS_MAVEN_TOKEN`
|
||||
*
|
||||
* @return The selected credentials for GS Maven.
|
||||
*/
|
||||
def selectCredentials(): Credentials =
|
||||
if ((Path.userHome / ".sbt" / ".credentials").exists())
|
||||
Credentials(Path.userHome / ".sbt" / ".credentials")
|
||||
else
|
||||
Credentials.apply(
|
||||
realm =Gs.MavenRealm,
|
||||
host = Gs.MavenHost,
|
||||
userName = sys.env
|
||||
.get(Gs.Environment.MavenUser)
|
||||
.getOrElse(
|
||||
throw new RuntimeException(
|
||||
s"You must either provide ~/.sbt/.credentials or specify the ${Gs.Environment.MavenUser} environment variable."
|
||||
)
|
||||
),
|
||||
passwd = sys.env
|
||||
.get(Gs.Environment.MavenToken)
|
||||
.getOrElse(
|
||||
throw new RuntimeException(
|
||||
s"You must either provide ~/.sbt/.credentials or specify the ${Gs.Environment.MavenToken} environment variable."
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
override def projectSettings: Seq[Setting[_]] = Seq(
|
||||
credentials += selectCredentials(),
|
||||
publishMavenStyle := true,
|
||||
Test / Keys.publishArtifact := false,
|
||||
pomIncludeRepository := Function.const(false),
|
||||
|
|
Loading…
Add table
Reference in a new issue