Cleanup release settings not existing and credentials check/enforcement craziness.

This commit is contained in:
Josh Suereth 2014-06-04 11:26:30 -04:00
parent 6f28f08b78
commit 4cd5657ac1
2 changed files with 24 additions and 6 deletions

View File

@ -8,21 +8,29 @@ object Release extends Build {
lazy val remoteID = SettingKey[String]("remote-id")
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 checkCredentials = TaskKey[Unit]("checkCredentials", "Checks to ensure credentials for this user exists.")
val PublishRepoHost = "private-repo.typesafe.com"
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(
publishTo in ThisBuild <<= publishResolver,
remoteID <<= publishStatus("typesafe-ivy-" + _),
credentials in ThisBuild += Credentials(CredentialsFile),
remoteBase <<= publishStatus("https://" + PublishRepoHost + "/typesafe/ivy-" + _),
launcherRemotePath <<= (organization, version, moduleName) { (org, v, n) => List(org, n, v, n + ".jar").mkString("/") },
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 publishResolver: Project.Initialize[Option[Resolver]] = (remoteID, remoteBase) { (id, base) =>

View File

@ -11,6 +11,10 @@ import LaunchProguard.{ proguard, Proguard }
object Sbt extends Build {
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(
organization := "org.scala-sbt",
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.
commands += Command.command("release-libs-211") { state =>
def lameAgregateTask(task: String): String =
s"all control/$task collections/$task io/$task completion/$task"
"setupBuildScala211" ::
/// First test
lameAgregateTask("test") ::
@ -53,8 +55,16 @@ object Sbt extends Build {
// Now restore the defaults.
"reload" :: state
},
commands += Command.command("release-sbt-local") { state =>
"publishLocal" ::
"setupBuildScala211" ::
lameAgregateTask("publishLocal") ::
"reload" ::
state
},
commands += Command.command("release-sbt") { state =>
// TODO - Any sort of validation
"checkCredentials" ::
"publishSigned" ::
"publishLauncher" ::
"release-libs-211" ::