From 2bc84f57740984cfe62511e10d0140ce4ff19a93 Mon Sep 17 00:00:00 2001 From: Peter Vlugter Date: Fri, 21 Jan 2011 16:29:26 +1300 Subject: [PATCH] Add build-release task --- akka-sbt-plugin/project/build.properties | 7 --- .../project/build/AkkaPluginProject.scala | 7 --- .../src/main/scala/AkkaProject.scala | 4 +- project/build/AkkaProject.scala | 49 ++++++++++++++++--- 4 files changed, 44 insertions(+), 23 deletions(-) delete mode 100644 akka-sbt-plugin/project/build.properties delete mode 100644 akka-sbt-plugin/project/build/AkkaPluginProject.scala diff --git a/akka-sbt-plugin/project/build.properties b/akka-sbt-plugin/project/build.properties deleted file mode 100644 index cad220e416..0000000000 --- a/akka-sbt-plugin/project/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -project.name=Akka SBT Plugin -# need full domain name for publishing to scala-tools -project.organization=se.scalablesolutions.akka -# mirrors akka version -project.version=1.1-SNAPSHOT -sbt.version=0.7.4 -build.scala.versions=2.7.7 diff --git a/akka-sbt-plugin/project/build/AkkaPluginProject.scala b/akka-sbt-plugin/project/build/AkkaPluginProject.scala deleted file mode 100644 index 976915aaf3..0000000000 --- a/akka-sbt-plugin/project/build/AkkaPluginProject.scala +++ /dev/null @@ -1,7 +0,0 @@ -import sbt._ - -class AkkaPluginProject(info: ProjectInfo) extends PluginProject(info) { - override def managedStyle = ManagedStyle.Maven - val publishTo = "Scala Tools Nexus" at "http://nexus.scala-tools.org/content/repositories/releases/" - Credentials(Path.userHome / ".ivy2" / ".scala-tools-credentials", log) -} diff --git a/akka-sbt-plugin/src/main/scala/AkkaProject.scala b/akka-sbt-plugin/src/main/scala/AkkaProject.scala index cebc98353c..7266b1f851 100644 --- a/akka-sbt-plugin/src/main/scala/AkkaProject.scala +++ b/akka-sbt-plugin/src/main/scala/AkkaProject.scala @@ -1,7 +1,7 @@ import sbt._ object AkkaRepositories { - val AkkaRepo = MavenRepository("Akka Repository", "http://scalablesolutions.se/akka/repository") + val AkkaRepo = MavenRepository("Akka Repository", "http://akka.io/repository") val ScalaToolsRepo = MavenRepository("Scala-Tools Repo", "http://scala-tools.org/repo-releases") val ClojarsRepo = MavenRepository("Clojars Repo", "http://clojars.org/repo") val CodehausRepo = MavenRepository("Codehaus Repo", "http://repository.codehaus.org") @@ -22,7 +22,7 @@ trait AkkaBaseProject extends BasicScalaProject { // is resolved from a ModuleConfiguration. This will result in a significant acceleration of the update action. // for development version resolve to .ivy2/local - // val akkaModuleConfig = ModuleConfiguration("se.scalablesolutions.akka", AkkaRepo) + // release: val akkaModuleConfig = ModuleConfiguration("se.scalablesolutions.akka", AkkaRepo) val aspectwerkzModuleConfig = ModuleConfiguration("org.codehaus.aspectwerkz", AkkaRepo) val cassandraModuleConfig = ModuleConfiguration("org.apache.cassandra", AkkaRepo) diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala index e0d95f87da..3628945c76 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -30,9 +30,11 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- // Deploy/dist settings // ------------------------------------------------------------------------------------------------------------------- - def distName = "%s-%s".format(name, version) - lazy val deployPath = info.projectPath / "deploy" - lazy val distPath = info.projectPath / "dist" + val distName = "%s-%s".format(name, version) + val distArchiveName = distName + ".zip" + val deployPath = info.projectPath / "deploy" + val distPath = info.projectPath / "dist" + val distArchive = (distPath ##) / distArchiveName lazy override val `package` = task { None } @@ -53,12 +55,10 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { //Temporary directory to hold the dist currently being generated val currentDist = genDistDir / distName - //ArchiveName = name of the zip file distribution that will be generated - val archiveName = distName + ".zip" FileUtilities.copy(allArtifacts.get, currentDist, log).left.toOption orElse //Copy all needed artifacts into the root archive - FileUtilities.zip(List(currentDist),distName + ".zip",true,log) orElse //Compress the root archive into a zipfile - transferFile(info.projectPath / archiveName,distPath / archiveName) orElse //Move the archive into the dist folder + FileUtilities.zip(List(currentDist), distArchiveName, true, log) orElse //Compress the root archive into a zipfile + transferFile(info.projectPath / distArchiveName, distArchive) orElse //Move the archive into the dist folder FileUtilities.clean(genDistDir,log) //Cleanup the generated jars } dependsOn (`package`) describedAs("Zips up the distribution.") @@ -215,6 +215,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val akka_remote = project("akka-remote", "akka-remote", new AkkaRemoteProject(_), akka_typed_actor) lazy val akka_http = project("akka-http", "akka-http", new AkkaHttpProject(_), akka_remote) lazy val akka_samples = project("akka-samples", "akka-samples", new AkkaSamplesParentProject(_)) + lazy val akka_sbt_plugin = project("akka-sbt-plugin", "akka-sbt-plugin", new AkkaSbtPluginProject(_)) // ------------------------------------------------------------------------------------------------------------------- // Miscellaneous @@ -289,6 +290,24 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { None } dependsOn(dist) describedAs("Run mvn install for artifacts in dist.") + + // Build release + + val localReleasePath = outputPath / "release" / version.toString + val localReleaseRepository = Resolver.file("Local Release", localReleasePath / "repository" asFile) + val localReleaseDownloads = localReleasePath / "downloads" + + override def otherRepositories = super.otherRepositories ++ Seq(localReleaseRepository) + + lazy val publishRelease = { + val releaseConfiguration = new DefaultPublishConfiguration(localReleaseRepository, "release", false) + publishTask(publishIvyModule, releaseConfiguration) dependsOn (deliver, publishLocal, makePom) + } + + lazy val buildRelease = task { + FileUtilities.copy(Seq(distArchive), localReleaseDownloads, log).left.toOption + } dependsOn (publishRelease, dist) + // ------------------------------------------------------------------------------------------------------------------- // akka-actor subproject // ------------------------------------------------------------------------------------------------------------------- @@ -406,6 +425,17 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { new AkkaSampleRemoteProject(_), akka_remote) } + // ------------------------------------------------------------------------------------------------------------------- + // akka-sbt-plugin subproject + // ------------------------------------------------------------------------------------------------------------------- + + class AkkaSbtPluginProject(info: ProjectInfo) extends PluginProject(info) { + lazy val publishRelease = { + val releaseConfiguration = new DefaultPublishConfiguration(localReleaseRepository, "release", false) + publishTask(publishIvyModule, releaseConfiguration) dependsOn (deliver, publishLocal, makePom) + } + } + // ------------------------------------------------------------------------------------------------------------------- // Helpers // ------------------------------------------------------------------------------------------------------------------- @@ -464,6 +494,11 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { case _ => false }) :: Nil } + + lazy val publishRelease = { + val releaseConfiguration = new DefaultPublishConfiguration(localReleaseRepository, "release", false) + publishTask(publishIvyModule, releaseConfiguration) dependsOn (deliver, publishLocal, makePom) + } } }