Add build-release task

This commit is contained in:
Peter Vlugter 2011-01-21 16:29:26 +13:00
parent 4b45ca952d
commit 2bc84f5774
4 changed files with 44 additions and 23 deletions

View file

@ -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

View file

@ -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)
}

View file

@ -1,7 +1,7 @@
import sbt._ import sbt._
object AkkaRepositories { 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 ScalaToolsRepo = MavenRepository("Scala-Tools Repo", "http://scala-tools.org/repo-releases")
val ClojarsRepo = MavenRepository("Clojars Repo", "http://clojars.org/repo") val ClojarsRepo = MavenRepository("Clojars Repo", "http://clojars.org/repo")
val CodehausRepo = MavenRepository("Codehaus Repo", "http://repository.codehaus.org") 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. // is resolved from a ModuleConfiguration. This will result in a significant acceleration of the update action.
// for development version resolve to .ivy2/local // 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 aspectwerkzModuleConfig = ModuleConfiguration("org.codehaus.aspectwerkz", AkkaRepo)
val cassandraModuleConfig = ModuleConfiguration("org.apache.cassandra", AkkaRepo) val cassandraModuleConfig = ModuleConfiguration("org.apache.cassandra", AkkaRepo)

View file

@ -30,9 +30,11 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
// Deploy/dist settings // Deploy/dist settings
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
def distName = "%s-%s".format(name, version) val distName = "%s-%s".format(name, version)
lazy val deployPath = info.projectPath / "deploy" val distArchiveName = distName + ".zip"
lazy val distPath = info.projectPath / "dist" val deployPath = info.projectPath / "deploy"
val distPath = info.projectPath / "dist"
val distArchive = (distPath ##) / distArchiveName
lazy override val `package` = task { None } 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 //Temporary directory to hold the dist currently being generated
val currentDist = genDistDir / distName 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.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 FileUtilities.zip(List(currentDist), distArchiveName, true, log) orElse //Compress the root archive into a zipfile
transferFile(info.projectPath / archiveName,distPath / archiveName) orElse //Move the archive into the dist folder transferFile(info.projectPath / distArchiveName, distArchive) orElse //Move the archive into the dist folder
FileUtilities.clean(genDistDir,log) //Cleanup the generated jars FileUtilities.clean(genDistDir,log) //Cleanup the generated jars
} dependsOn (`package`) describedAs("Zips up the distribution.") } 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_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_http = project("akka-http", "akka-http", new AkkaHttpProject(_), akka_remote)
lazy val akka_samples = project("akka-samples", "akka-samples", new AkkaSamplesParentProject(_)) 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 // Miscellaneous
@ -289,6 +290,24 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
None None
} dependsOn(dist) describedAs("Run mvn install for artifacts in dist.") } 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 // akka-actor subproject
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
@ -406,6 +425,17 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
new AkkaSampleRemoteProject(_), akka_remote) 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 // Helpers
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
@ -464,6 +494,11 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
case _ => false case _ => false
}) :: Nil }) :: Nil
} }
lazy val publishRelease = {
val releaseConfiguration = new DefaultPublishConfiguration(localReleaseRepository, "release", false)
publishTask(publishIvyModule, releaseConfiguration) dependsOn (deliver, publishLocal, makePom)
}
} }
} }