diff --git a/project/Release.scala b/project/Release.scala index 6d80f5b50..12d5d3a55 100644 --- a/project/Release.scala +++ b/project/Release.scala @@ -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) => diff --git a/project/Sbt.scala b/project/Sbt.scala index 6d97d15be..0af48a1d2 100644 --- a/project/Sbt.scala +++ b/project/Sbt.scala @@ -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" ::