Rewrote distribution generation, now it also packages sources and docs

This commit is contained in:
Jonas Bonér 2010-03-30 18:56:34 +02:00
parent dc9cae4797
commit 8800f70ff2
3 changed files with 200 additions and 165 deletions

View file

@ -17,4 +17,4 @@ the License.
---------------
Licenses for dependency projects can be found here:
[http://doc.akkasource.org/licenses]
[http://doc.akkasource.org/licenses]

View file

@ -598,7 +598,7 @@ trait Actor extends TransactionManagement with Logging {
"\n\t\t2. Send a message from an instance that is *not* an actor" +
"\n\t\t3. Send a message to an Active Object annotated with the '@oneway' annotation? " +
"\n\tIf so, switch to '!!' (or remove '@oneway') which passes on an implicit future" +
"\n\tthat will be bound by the argument passed to 'reply'."
"\n\tthat will be bound by the argument passed to 'reply'." +
"\n\tAlternatively, you can use setReplyToAddress to make sure the actor can be contacted over the network.")
case Some(future) =>
future.completeWithResult(message)

View file

@ -35,10 +35,159 @@
-------------------------------------------------------------------------------*/
import sbt._
import java.io.File
import sbt.CompileOrder._
import scala.Array
import java.util.jar.Attributes
import java.util.jar.Attributes.Name._
import java.io.File
class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
abstract class AkkaDefaults(info: ProjectInfo) extends DefaultProject(info) with AutoCompilerPlugins {
// ------------------------------------------------------------
lazy val akkaHome = {
val home = System.getenv("AKKA_HOME")
if (home == null) throw new Error(
"You need to set the $AKKA_HOME environment variable to the root of the Akka distribution")
home
}
val encodingUtf8 = List("-encoding", "UTF-8")
lazy val deployPath = Path.fromFile(new java.io.File(akkaHome + "/deploy"))
lazy val distPath = Path.fromFile(new java.io.File(akkaHome + "/dist"))
override def javaCompileOptions = JavaCompileOption("-Xlint:unchecked") :: super.javaCompileOptions.toList
def distName = "%s_%s-%s.zip".format(name, buildScalaVersion, version)
// ------------------------------------------------------------
// publishing
override def managedStyle = ManagedStyle.Maven
def publishTo = Resolver.file("maven-local", Path.userHome / ".m2" / "repository" asFile)
// Credentials(Path.userHome / ".akka_publish_credentials", log)
override def documentOptions = encodingUtf8.map(SimpleDocOption(_))
override def packageDocsJar = defaultJarPath("-doc.jar")
override def packageSrcJar= defaultJarPath("-src.jar")
override def packageToPublishActions = super.packageToPublishActions ++ Seq(packageDocs, packageSrc)
override def pomExtra =
<inceptionYear>2009</inceptionYear>
<url>http://akkasource.org</url>
<organization>
<name>Scalable Solutions AB</name>
<url>http://scalablesolutions.se</url>
</organization>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
// ------------------------------------------------------------
// create executable jar
override def mainClass = Some("se.scalablesolutions.akka.kernel.Main")
override def packageOptions =
manifestClassPath.map(cp => ManifestAttributes(
(Attributes.Name.CLASS_PATH, cp),
(IMPLEMENTATION_TITLE, "Akka"),
(IMPLEMENTATION_URL, "http://akkasource.org"),
(IMPLEMENTATION_VENDOR, "The Akka Project"),
(SEALED, "true"))).toList :::
getMainClass(false).map(MainClass(_)).toList
// create a manifest with all akka jars and dependency jars on classpath
override def manifestClassPath = Some(allArtifacts.getFiles
.filter(_.getName.endsWith(".jar"))
.map("lib_managed/scala_%s/compile/".format(buildScalaVersion) + _.getName)
.mkString(" ") +
" dist/akka-util_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-util-java_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-core_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-cluster-shoal_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-cluster-jgroups_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-rest_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-comet_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-camel_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-security_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-amqp_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-patterns_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-persistence-common_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-persistence-redis_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-persistence-mongo_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-persistence-cassandra_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-kernel_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-spring_%s-%s.jar".format(buildScalaVersion, version)
)
// ------------------------------------------------------------
// helper functions
def removeDupEntries(paths: PathFinder) =
Path.lazyPathFinder {
val mapped = paths.get map { p => (p.relativePath, p) }
(Map() ++ mapped).values.toList
}
def allArtifacts = {
(removeDupEntries(runClasspath filter ClasspathUtilities.isArchive) +++
((outputPath ##) / defaultJarName) +++
mainResources +++
mainDependencies.scalaJars +++
descendents(info.projectPath, "*.conf") +++
descendents(info.projectPath / "dist", "*.jar") +++
descendents(info.projectPath / "deploy", "*.jar") +++
descendents(path("lib") ##, "*.jar") +++
descendents(configurationPath(Configurations.Compile) ##, "*.jar"))
.filter(jar => // remove redundant libs
!jar.toString.endsWith("stax-api-1.0.1.jar") &&
!jar.toString.endsWith("scala-library-2.7.5.jar") &&
!jar.toString.endsWith("scala-library-2.7.6.jar"))
}
def deployTask(info: ProjectInfo, toDir: Path) = task {
val projectPath = info.projectPath.toString
val moduleName = projectPath.substring(
projectPath.lastIndexOf(System.getProperty("file.separator")) + 1, projectPath.length)
// FIXME need to find out a way to grab these paths from the sbt system
// binary
val JAR_FILE_NAME = moduleName + "_%s-%s.jar".format(buildScalaVersion, version)
val JAR_FILE_PATH = projectPath + "/target/scala_%s/".format(buildScalaVersion) + JAR_FILE_NAME
val fromJar = Path.fromFile(new java.io.File(JAR_FILE_PATH))
val toJar = Path.fromFile(new java.io.File(toDir + "/" + JAR_FILE_NAME))
log.info("Deploying bits " + toJar)
FileUtilities.copyFile(fromJar, toJar, log)
// docs
val DOC_FILE_NAME = moduleName + "_%s-%s-%s.jar".format(buildScalaVersion, version, "doc")
val DOC_FILE_PATH = projectPath + "/target/scala_%s/".format(buildScalaVersion) + DOC_FILE_NAME
val fromDoc = Path.fromFile(new java.io.File(DOC_FILE_PATH))
val toDoc = Path.fromFile(new java.io.File(toDir + "/" + DOC_FILE_NAME))
log.info("Deploying docs " + toDoc)
FileUtilities.copyFile(fromDoc, toDoc, log)
// sources
val SRC_FILE_NAME = moduleName + "_%s-%s-%s.jar".format(buildScalaVersion, version, "src")
val SRC_FILE_PATH = projectPath + "/target/scala_%s/".format(buildScalaVersion) + SRC_FILE_NAME
val fromSrc = Path.fromFile(new java.io.File(SRC_FILE_PATH))
val toSrc = Path.fromFile(new java.io.File(toDir + "/" + SRC_FILE_NAME))
log.info("Deploying sources " + toSrc)
FileUtilities.copyFile(fromSrc, toSrc, log)
}
}
class AkkaParent(info: ProjectInfo) extends AkkaDefaults(info) {
// These lines need to be here instead of in AkkaDefaults to be able to resolve project.name in build.properties
val sourceArtifact = Artifact(artifactID, "src", "jar", Some("src"), Nil, None)
val docsArtifact = Artifact(artifactID, "docs", "jar", Some("doc"), Nil, None)
lazy val dist = zipTask(allArtifacts, "dist", distName) dependsOn (`package`) describedAs("Zips up the distribution.")
// ------------------------------------------------------------
// project versions
@ -48,20 +197,6 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
val LIFT_VERSION = "2.0-scala280-SNAPSHOT"
val SCALATEST_VERSION = "1.0.1-for-scala-2.8.0.Beta1-with-test-interfaces-0.3-SNAPSHOT"
// ------------------------------------------------------------
lazy val akkaHome = {
val home = System.getenv("AKKA_HOME")
if (home == null) throw new Error(
"You need to set the $AKKA_HOME environment variable to the root of the Akka distribution")
home
}
lazy val deployPath = Path.fromFile(new java.io.File(akkaHome + "/deploy"))
lazy val distPath = Path.fromFile(new java.io.File(akkaHome + "/dist"))
lazy val dist = zipTask(allArtifacts, "dist", distName) dependsOn (`package`) describedAs("Zips up the distribution.")
def distName = "%s_%s-%s.zip".format(name, buildScalaVersion, version)
// ------------------------------------------------------------
// repositories
val embeddedrepo = "embedded repo" at new File(akkaHome, "embedded-repo").toURI.toString
@ -100,71 +235,9 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
// examples
lazy val akka_samples = project("akka-samples", "akka-samples", new AkkaSamplesParentProject(_))
override def javaCompileOptions = JavaCompileOption("-Xlint:unchecked") :: super.javaCompileOptions.toList
// ------------------------------------------------------------
// create executable jar
override def mainClass = Some("se.scalablesolutions.akka.kernel.Main")
override def packageOptions =
manifestClassPath.map(cp => ManifestAttributes((Attributes.Name.CLASS_PATH, cp))).toList :::
getMainClass(false).map(MainClass(_)).toList
// create a manifest with all akka jars and dependency jars on classpath
override def manifestClassPath = Some(allArtifacts.getFiles
.filter(_.getName.endsWith(".jar"))
.map("lib_managed/scala_%s/compile/".format(buildScalaVersion) + _.getName)
.mkString(" ") +
" dist/akka-util_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-util-java_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-core_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-cluster-shoal_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-cluster-jgroups_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-rest_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-comet_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-camel_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-security_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-amqp_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-patterns_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-persistence-common_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-persistence-redis_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-persistence-mongo_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-persistence-cassandra_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-kernel_%s-%s.jar".format(buildScalaVersion, version) +
" dist/akka-spring_%s-%s.jar".format(buildScalaVersion, version)
)
// ------------------------------------------------------------
// publishing
override def managedStyle = ManagedStyle.Maven
val publishTo = Resolver.file("maven-local", Path.userHome / ".m2" / "repository" asFile)
// Credentials(Path.userHome / ".akka_publish_credentials", log)
val sourceArtifact = Artifact(artifactID, "src", "jar", Some("sources"), Nil, None)
//val docsArtifact = Artifact(artifactID, "docs", "jar", Some("javadoc"), Nil, None)
override def packageDocsJar = defaultJarPath("-javadoc.jar")
override def packageSrcJar= defaultJarPath("-sources.jar")
override def packageToPublishActions = super.packageToPublishActions ++ Seq(packageDocs, packageSrc)
override def pomExtra =
<inceptionYear>2009</inceptionYear>
<url>http://akkasource.org</url>
<organization>
<name>Scalable Solutions AB</name>
<url>http://scalablesolutions.se</url>
</organization>
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
// ------------------------------------------------------------
// subprojects
class AkkaCoreProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaCoreProject(info: ProjectInfo) extends AkkaDefaults(info) {
val netty = "org.jboss.netty" % "netty" % "3.2.0.BETA1" % "compile"
val commons_io = "commons-io" % "commons-io" % "1.4" % "compile"
val dispatch_json = "net.databinder" % "dispatch-json_2.8.0.Beta1" % "0.6.6" % "compile"
@ -177,30 +250,30 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
// testing
val scalatest = "org.scalatest" % "scalatest" % SCALATEST_VERSION % "test"
val junit = "junit" % "junit" % "4.5" % "test"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaUtilProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaUtilProject(info: ProjectInfo) extends AkkaDefaults(info) {
val werkz = "org.codehaus.aspectwerkz" % "aspectwerkz-nodeps-jdk5" % "2.1" % "compile"
val werkz_core = "org.codehaus.aspectwerkz" % "aspectwerkz-jdk5" % "2.1" % "compile"
val configgy = "net.lag" % "configgy" % "2.8.0.Beta1-1.5-SNAPSHOT" % "compile"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaJavaUtilProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaJavaUtilProject(info: ProjectInfo) extends AkkaDefaults(info) {
val guicey = "org.guiceyfruit" % "guice-core" % "2.0-beta-4" % "compile"
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.2.0" % "compile"
val multiverse = "org.multiverse" % "multiverse-alpha" % "0.4" % "compile"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaAMQPProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaAMQPProject(info: ProjectInfo) extends AkkaDefaults(info) {
val commons_io = "commons-io" % "commons-io" % "1.4" % "compile"
val rabbit = "com.rabbitmq" % "amqp-client" % "1.7.2"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaRestProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaRestProject(info: ProjectInfo) extends AkkaDefaults(info) {
val jackson_core_asl = "org.codehaus.jackson" % "jackson-core-asl" % "1.2.1" % "compile"
val stax_api = "javax.xml.stream" % "stax-api" % "1.0-2" % "compile"
val servlet = "javax.servlet" % "servlet-api" % "2.5" % "compile"
@ -209,31 +282,31 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
val jersey_json = "com.sun.jersey" % "jersey-json" % JERSEY_VERSION % "compile"
val jersey_contrib = "com.sun.jersey.contribs" % "jersey-scala" % JERSEY_VERSION % "compile"
val jsr311 = "javax.ws.rs" % "jsr311-api" % "1.1" % "compile"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaCometProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaCometProject(info: ProjectInfo) extends AkkaDefaults(info) {
val grizzly = "com.sun.grizzly" % "grizzly-comet-webserver" % "1.9.18-i" % "compile"
val servlet = "javax.servlet" % "servlet-api" % "2.5" % "compile"
val atmo = "org.atmosphere" % "atmosphere-annotations" % ATMO_VERSION % "compile"
val atmo_jersey = "org.atmosphere" % "atmosphere-jersey" % ATMO_VERSION % "compile"
val atmo_runtime = "org.atmosphere" % "atmosphere-runtime" % ATMO_VERSION % "compile"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaCamelProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaCamelProject(info: ProjectInfo) extends AkkaDefaults(info) {
val camel_core = "org.apache.camel" % "camel-core" % "2.2.0" % "compile"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaPatternsProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaPatternsProject(info: ProjectInfo) extends AkkaDefaults(info) {
// testing
val scalatest = "org.scalatest" % "scalatest" % SCALATEST_VERSION % "test"
val junit = "junit" % "junit" % "4.5" % "test"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaSecurityProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaSecurityProject(info: ProjectInfo) extends AkkaDefaults(info) {
val commons_logging = "commons-logging" % "commons-logging" % "1.1.1" % "compile"
val annotation = "javax.annotation" % "jsr250-api" % "1.0"
val jersey_server = "com.sun.jersey" % "jersey-server" % JERSEY_VERSION % "compile"
@ -244,28 +317,28 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
val scalatest = "org.scalatest" % "scalatest" % SCALATEST_VERSION % "test"
val junit = "junit" % "junit" % "4.5" % "test"
val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaPersistenceCommonProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaPersistenceCommonProject(info: ProjectInfo) extends AkkaDefaults(info) {
val thrift = "com.facebook" % "thrift" % "1.0" % "compile"
val commons_pool = "commons-pool" % "commons-pool" % "1.5.4" % "compile"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaRedisProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaRedisProject(info: ProjectInfo) extends AkkaDefaults(info) {
val redis = "com.redis" % "redisclient" % "2.8.0.Beta1-1.2-SNAPSHOT" % "compile"
override def testOptions = TestFilter((name: String) => name.endsWith("Test")) :: Nil
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaMongoProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaMongoProject(info: ProjectInfo) extends AkkaDefaults(info) {
val mongo = "org.mongodb" % "mongo-java-driver" % "1.1" % "compile"
override def testOptions = TestFilter((name: String) => name.endsWith("Test")) :: Nil
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaCassandraProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaCassandraProject(info: ProjectInfo) extends AkkaDefaults(info) {
val cassandra = "org.apache.cassandra" % "cassandra" % CASSANDRA_VERSION % "compile"
val high_scale = "org.apache.cassandra" % "high-scale-lib" % CASSANDRA_VERSION % "test"
val cassandra_clhm = "org.apache.cassandra" % "clhm-production" % CASSANDRA_VERSION % "test"
@ -275,7 +348,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
val slf4j_log4j = "org.slf4j" % "slf4j-log4j12" % "1.5.8" % "test"
val log4j = "log4j" % "log4j" % "1.2.15" % "test"
override def testOptions = TestFilter((name: String) => name.endsWith("Test")) :: Nil
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaPersistenceParentProject(info: ProjectInfo) extends ParentProject(info) {
@ -289,15 +362,15 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
new AkkaCassandraProject(_), akka_persistence_common)
}
class AkkaJgroupsProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaJgroupsProject(info: ProjectInfo) extends AkkaDefaults(info) {
val jgroups = "jgroups" % "jgroups" % "2.8.0.CR7" % "compile"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaShoalProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaShoalProject(info: ProjectInfo) extends AkkaDefaults(info) {
val shoal = "shoal-jxta" % "shoal" % "1.1-20090818" % "compile"
val shoal_extra = "shoal-jxta" % "jxta" % "1.1-20090818" % "compile"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaClusterParentProject(info: ProjectInfo) extends ParentProject(info) {
@ -307,21 +380,21 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
new AkkaShoalProject(_), akka_core)
}
class AkkaKernelProject(info: ProjectInfo) extends DefaultProject(info) {
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
class AkkaKernelProject(info: ProjectInfo) extends AkkaDefaults(info) {
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaSpringProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaSpringProject(info: ProjectInfo) extends AkkaDefaults(info) {
val spring_beans = "org.springframework" % "spring-beans" % "3.0.1.RELEASE"
val spring_context = "org.springframework" % "spring-context" % "3.0.1.RELEASE"
// testing
val scalatest = "org.scalatest" % "scalatest" % SCALATEST_VERSION % "test"
val junit = "junit" % "junit" % "4.5" % "test"
lazy val dist = deployTask(info, distPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, distPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
// examples
class AkkaFunTestProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaFunTestProject(info: ProjectInfo) extends AkkaDefaults(info) {
val jackson_core_asl = "org.codehaus.jackson" % "jackson-core-asl" % "1.2.1" % "compile"
val stax_api = "javax.xml.stream" % "stax-api" % "1.0-2" % "compile"
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.2.0"
@ -334,11 +407,11 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
val jmock = "org.jmock" % "jmock" % "2.4.0" % "test"
}
class AkkaSampleChatProject(info: ProjectInfo) extends DefaultProject(info) {
lazy val dist = deployTask(info, deployPath) dependsOn(`package`) describedAs("Deploying")
class AkkaSampleChatProject(info: ProjectInfo) extends AkkaDefaults(info) {
lazy val dist = deployTask(info, deployPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaSampleLiftProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaSampleLiftProject(info: ProjectInfo) extends AkkaDefaults(info) {
val commons_logging = "commons-logging" % "commons-logging" % "1.1.1" % "compile"
val lift = "net.liftweb" % "lift-webkit" % LIFT_VERSION % "compile"
val lift_util = "net.liftweb" % "lift-util" % LIFT_VERSION % "compile"
@ -346,31 +419,31 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
// testing
val jetty = "org.mortbay.jetty" % "jetty" % "6.1.22" % "test"
val junit = "junit" % "junit" % "4.5" % "test"
lazy val dist = deployTask(info, deployPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, deployPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaSampleRestJavaProject(info: ProjectInfo) extends DefaultProject(info) {
lazy val dist = deployTask(info, deployPath) dependsOn(`package`) describedAs("Deploying")
class AkkaSampleRestJavaProject(info: ProjectInfo) extends AkkaDefaults(info) {
lazy val dist = deployTask(info, deployPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaSampleRestScalaProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaSampleRestScalaProject(info: ProjectInfo) extends AkkaDefaults(info) {
val jsr311 = "javax.ws.rs" % "jsr311-api" % "1.1.1" % "compile"
lazy val dist = deployTask(info, deployPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, deployPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaSampleCamelProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaSampleCamelProject(info: ProjectInfo) extends AkkaDefaults(info) {
val commons_codec = "commons-codec" % "commons-codec" % "1.3" % "compile"
val spring_jms = "org.springframework" % "spring-jms" % "3.0.1.RELEASE"
val camel_jetty = "org.apache.camel" % "camel-jetty" % "2.2.0" % "compile"
val camel_jms = "org.apache.camel" % "camel-jms" % "2.2.0" % "compile"
val activemq_core = "org.apache.activemq" % "activemq-core" % "5.3.0" % "compile"
lazy val dist = deployTask(info, deployPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, deployPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaSampleSecurityProject(info: ProjectInfo) extends DefaultProject(info) {
class AkkaSampleSecurityProject(info: ProjectInfo) extends AkkaDefaults(info) {
val jsr311 = "javax.ws.rs" % "jsr311-api" % "1.1.1" % "compile"
val jsr250 = "javax.annotation" % "jsr250-api" % "1.0"
lazy val dist = deployTask(info, deployPath) dependsOn(`package`) describedAs("Deploying")
lazy val dist = deployTask(info, deployPath) dependsOn(`package`, packageDocs, packageSrc) describedAs("Deploying")
}
class AkkaSamplesParentProject(info: ProjectInfo) extends ParentProject(info) {
@ -387,42 +460,4 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
lazy val akka_sample_security = project("akka-sample-security", "akka-sample-security",
new AkkaSampleSecurityProject(_), akka_kernel)
}
// ------------------------------------------------------------
// helper functions
def removeDupEntries(paths: PathFinder) =
Path.lazyPathFinder {
val mapped = paths.get map { p => (p.relativePath, p) }
(Map() ++ mapped).values.toList
}
def allArtifacts = {
(removeDupEntries(runClasspath filter ClasspathUtilities.isArchive) +++
((outputPath ##) / defaultJarName) +++
mainResources +++
mainDependencies.scalaJars +++
descendents(info.projectPath, "*.conf") +++
descendents(info.projectPath / "dist", "*.jar") +++
descendents(info.projectPath / "deploy", "*.jar") +++
descendents(path("lib") ##, "*.jar") +++
descendents(configurationPath(Configurations.Compile) ##, "*.jar"))
.filter(jar => // remove redundant libs
!jar.toString.endsWith("stax-api-1.0.1.jar") &&
!jar.toString.endsWith("scala-library-2.7.5.jar") &&
!jar.toString.endsWith("scala-library-2.7.6.jar"))
}
def deployTask(info: ProjectInfo, toDir: Path) = task {
val projectPath = info.projectPath.toString
val moduleName = projectPath.substring(
projectPath.lastIndexOf(System.getProperty("file.separator")) + 1, projectPath.length)
// FIXME need to find out a way to grab these paths from the sbt system
val JAR_FILE_NAME = moduleName + "_%s-%s.jar".format(buildScalaVersion, version)
val JAR_FILE_PATH = projectPath + "/target/scala_%s/".format(buildScalaVersion) + JAR_FILE_NAME
val from = Path.fromFile(new java.io.File(JAR_FILE_PATH))
val to = Path.fromFile(new java.io.File(toDir + "/" + JAR_FILE_NAME))
log.info("Deploying " + to)
FileUtilities.copyFile(from, to, log)
}
}