mirror of https://github.com/sbt/sbt.git
Cleanup release settings not existing and credentials check/enforcement craziness.
This commit is contained in:
parent
6f28f08b78
commit
4cd5657ac1
|
|
@ -8,21 +8,29 @@ object Release extends Build {
|
||||||
lazy val remoteID = SettingKey[String]("remote-id")
|
lazy val remoteID = SettingKey[String]("remote-id")
|
||||||
lazy val launcherRemotePath = SettingKey[String]("launcher-remote-path")
|
lazy val launcherRemotePath = SettingKey[String]("launcher-remote-path")
|
||||||
lazy val deployLauncher = TaskKey[Unit]("deploy-launcher", "Upload the launcher to its traditional location for compatibility with existing scripts.")
|
lazy val deployLauncher = TaskKey[Unit]("deploy-launcher", "Upload the launcher to its traditional location for compatibility with existing scripts.")
|
||||||
|
lazy val checkCredentials = TaskKey[Unit]("checkCredentials", "Checks to ensure credentials for this user exists.")
|
||||||
|
|
||||||
val PublishRepoHost = "private-repo.typesafe.com"
|
val PublishRepoHost = "private-repo.typesafe.com"
|
||||||
|
|
||||||
def settings(nonRoots: => Seq[ProjectReference], launcher: TaskKey[File]): Seq[Setting[_]] =
|
def settings(nonRoots: => Seq[ProjectReference], launcher: TaskKey[File]): Seq[Setting[_]] =
|
||||||
if (CredentialsFile.exists) releaseSettings(nonRoots, launcher) else Nil
|
releaseSettings(nonRoots, launcher)
|
||||||
|
|
||||||
|
// Add credentials if they exist.
|
||||||
|
def lameCredentialSettings: Seq[Setting[_]] =
|
||||||
|
if(CredentialsFile.exists) Seq(credentials in ThisBuild += Credentials(CredentialsFile))
|
||||||
|
else Nil
|
||||||
def releaseSettings(nonRoots: => Seq[ProjectReference], launcher: TaskKey[File]): Seq[Setting[_]] = Seq(
|
def releaseSettings(nonRoots: => Seq[ProjectReference], launcher: TaskKey[File]): Seq[Setting[_]] = Seq(
|
||||||
publishTo in ThisBuild <<= publishResolver,
|
publishTo in ThisBuild <<= publishResolver,
|
||||||
remoteID <<= publishStatus("typesafe-ivy-" + _),
|
remoteID <<= publishStatus("typesafe-ivy-" + _),
|
||||||
credentials in ThisBuild += Credentials(CredentialsFile),
|
|
||||||
remoteBase <<= publishStatus("https://" + PublishRepoHost + "/typesafe/ivy-" + _),
|
remoteBase <<= publishStatus("https://" + PublishRepoHost + "/typesafe/ivy-" + _),
|
||||||
launcherRemotePath <<= (organization, version, moduleName) { (org, v, n) => List(org, n, v, n + ".jar").mkString("/") },
|
launcherRemotePath <<= (organization, version, moduleName) { (org, v, n) => List(org, n, v, n + ".jar").mkString("/") },
|
||||||
publish <<= Seq(publish, Release.deployLauncher).dependOn,
|
publish <<= Seq(publish, Release.deployLauncher).dependOn,
|
||||||
deployLauncher <<= deployLauncher(launcher)
|
deployLauncher <<= deployLauncher(launcher),
|
||||||
)
|
checkCredentials := {
|
||||||
|
// Note - This will eitehr issue a failure or succeed.
|
||||||
|
getCredentials(credentials.value, streams.value.log)
|
||||||
|
}
|
||||||
|
) ++ lameCredentialSettings
|
||||||
|
|
||||||
def snapshotPattern(version: String) = Resolver.localBasePattern.replaceAll("""\[revision\]""", version)
|
def snapshotPattern(version: String) = Resolver.localBasePattern.replaceAll("""\[revision\]""", version)
|
||||||
def publishResolver: Project.Initialize[Option[Resolver]] = (remoteID, remoteBase) { (id, base) =>
|
def publishResolver: Project.Initialize[Option[Resolver]] = (remoteID, remoteBase) { (id, base) =>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,10 @@ import LaunchProguard.{ proguard, Proguard }
|
||||||
|
|
||||||
object Sbt extends Build {
|
object Sbt extends Build {
|
||||||
override lazy val settings = super.settings ++ buildSettings ++ Status.settings ++ nightlySettings
|
override lazy val settings = super.settings ++ buildSettings ++ Status.settings ++ nightlySettings
|
||||||
|
|
||||||
|
// Aggregate task for 2.11
|
||||||
|
private def lameAgregateTask(task: String): String =
|
||||||
|
s"all control/$task collections/$task io/$task completion/$task"
|
||||||
def buildSettings = Seq(
|
def buildSettings = Seq(
|
||||||
organization := "org.scala-sbt",
|
organization := "org.scala-sbt",
|
||||||
version := "0.13.6-SNAPSHOT",
|
version := "0.13.6-SNAPSHOT",
|
||||||
|
|
@ -43,8 +47,6 @@ object Sbt extends Build {
|
||||||
},
|
},
|
||||||
// TODO - To some extent these should take args to figure out what to do.
|
// TODO - To some extent these should take args to figure out what to do.
|
||||||
commands += Command.command("release-libs-211") { state =>
|
commands += Command.command("release-libs-211") { state =>
|
||||||
def lameAgregateTask(task: String): String =
|
|
||||||
s"all control/$task collections/$task io/$task completion/$task"
|
|
||||||
"setupBuildScala211" ::
|
"setupBuildScala211" ::
|
||||||
/// First test
|
/// First test
|
||||||
lameAgregateTask("test") ::
|
lameAgregateTask("test") ::
|
||||||
|
|
@ -53,8 +55,16 @@ object Sbt extends Build {
|
||||||
// Now restore the defaults.
|
// Now restore the defaults.
|
||||||
"reload" :: state
|
"reload" :: state
|
||||||
},
|
},
|
||||||
|
commands += Command.command("release-sbt-local") { state =>
|
||||||
|
"publishLocal" ::
|
||||||
|
"setupBuildScala211" ::
|
||||||
|
lameAgregateTask("publishLocal") ::
|
||||||
|
"reload" ::
|
||||||
|
state
|
||||||
|
},
|
||||||
commands += Command.command("release-sbt") { state =>
|
commands += Command.command("release-sbt") { state =>
|
||||||
// TODO - Any sort of validation
|
// TODO - Any sort of validation
|
||||||
|
"checkCredentials" ::
|
||||||
"publishSigned" ::
|
"publishSigned" ::
|
||||||
"publishLauncher" ::
|
"publishLauncher" ::
|
||||||
"release-libs-211" ::
|
"release-libs-211" ::
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue