diff --git a/akka-karaf/akka-features/src/main/resources/features.xml b/akka-karaf/akka-features/src/main/resources/features.xml new file mode 100644 index 0000000000..7506820024 --- /dev/null +++ b/akka-karaf/akka-features/src/main/resources/features.xml @@ -0,0 +1,22 @@ + + + + + mvn:com.weiglewilczek.scala-lang-osgi/scala-library/2.8.0.RC2 + mvn:org.eclipse.scalamodules/scalamodules-core/2.0-M2 + + + + + mvn:se.scalablesolutions.akka.akka-wrap/dispatch-json_2.8.0.RC3_osgi/0.7.4 + mvn:org.objenesis/objenesis/1.2 + mvn:sjson.json/sjson/0.6-SNAPSHOT + + + + sjson + mvn:se.scalablesolutions.akka.akka-wrap/jgroups-wrapper_2.8.0.RC3_osgi/2.9.0.GA + mvn:org.jboss.netty/netty/3.2.0.CR1 + mvn:se.scalablesolutions.akka/akka-core_2.8.0.RC3_osgi/0.9 + + diff --git a/akka-samples/akka-sample-osgi/src/main/scala/Activator.scala b/akka-samples/akka-sample-osgi/src/main/scala/Activator.scala index 81e2d25d97..04c7f165b9 100644 --- a/akka-samples/akka-sample-osgi/src/main/scala/Activator.scala +++ b/akka-samples/akka-sample-osgi/src/main/scala/Activator.scala @@ -12,10 +12,8 @@ class Activator extends BundleActivator { def start(context: BundleContext) { println("Start") val osgiActor = new OSGiActor - osgiActor ! "Hello" - - - + //osgiActor ! "Hello" + Unit } def stop(context: BundleContext) { diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala index 3742089c55..bef46f48cc 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -10,7 +10,7 @@ import java.util.jar.Attributes import java.util.jar.Attributes.Name._ import java.io.File -import com.weiglewilczek.bnd4sbt.BNDPlugin +import com.weiglewilczek.bnd4sbt._ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { @@ -22,6 +22,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { val LIFT_VERSION = "2.0-scala280-SNAPSHOT" val SCALATEST_VERSION = "1.2-for-scala-2.8.0.RC3-SNAPSHOT" val MULTIVERSE_VERSION = "0.5.2" + val COMMONS_CODEC_VERSION = "1.4" // ------------------------------------------------------------ lazy val deployPath = info.projectPath / "deploy" @@ -171,7 +172,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { " -Dpackaging=jar -DgeneratePom=true" command ! log } - None + None } dependsOn(dist) describedAs("Run mvn install for artifacts in dist.") // ------------------------------------------------------------ @@ -245,7 +246,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { class AkkaRedisProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { val redis = "com.redis" % "redisclient" % "2.8.0.RC3-1.4-SNAPSHOT" % "compile" - val commons_codec = "commons-codec" % "commons-codec" % "1.4" % "compile" + val commons_codec = "commons-codec" % "commons-codec" % COMMONS_CODEC_VERSION % "compile" override def testOptions = TestFilter((name: String) => name.endsWith("Test")) :: Nil } @@ -298,11 +299,6 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { } // ================= OSGi Packaging ================== - class AkkaOSGiBundleProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with BNDPlugin { - override def bndClasspath = compileClasspath - override def bndPrivatePackage = Seq("") - override def bndExportPackage = Seq("se.scalablesolutions.akka.*;version=0.9") - } class AkkaOSGiDependenciesBundleProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with BNDPlugin { override def bndClasspath = compileClasspath @@ -381,12 +377,15 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { } class AkkaOSGiParentProject(info: ProjectInfo) extends ParentProject(info) { - lazy val akka_osgi_bundle = project("akka-osgi-bundle", "akka-osgi-bundle", - new AkkaOSGiBundleProject(_), akka_kernel) lazy val akka_osgi_dependencies_bundle = project("akka-osgi-dependencies-bundle", "akka-osgi-dependencies-bundle", - new AkkaOSGiDependenciesBundleProject(_), akka_osgi_bundle) + new AkkaOSGiDependenciesBundleProject(_), akka_kernel, + akka_jta // akka_kernel does not depend on akka_jta (why?) therefore we list akka_jta here + ) lazy val akka_osgi_assembly = project("akka-osgi-assembly", "akka-osgi-assembly", - new AkkaOSGiAssemblyProject(_), akka_osgi_bundle, akka_osgi_dependencies_bundle) + new AkkaOSGiAssemblyProject(_), akka_osgi_dependencies_bundle, akka_core, akka_amqp, akka_http, + akka_camel, akka_spring, akka_jta, akka_persistence.akka_persistence_common, + akka_persistence.akka_persistence_redis, akka_persistence.akka_persistence_mongo, + akka_persistence.akka_persistence_cassandra) } // ================= TEST ================== @@ -433,7 +432,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { class AkkaSampleSecurityProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) { val jsr311 = "javax.ws.rs" % "jsr311-api" % "1.1.1" % "compile" val jsr250 = "javax.annotation" % "jsr250-api" % "1.0" % "compile" - val commons_codec = "commons-codec" % "commons-codec" % "1.3" % "compile" + val commons_codec = "commons-codec" % "commons-codec" % COMMONS_CODEC_VERSION % "compile" } class AkkaSampleOSGiProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with BNDPlugin { @@ -494,11 +493,11 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { !jar.toString.endsWith("scala-library-2.7.7.jar") ) } - - def akkaArtifacts = descendents(info.projectPath / "dist", "*" + buildScalaVersion + "-" + version + ".jar") + + def akkaArtifacts = descendents(info.projectPath / "dist", "*" + buildScalaVersion + "_osgi-" + version + ".jar") // ------------------------------------------------------------ - class AkkaDefaultProject(info: ProjectInfo, val deployPath: Path) extends DefaultProject(info) with DeployProject + class AkkaDefaultProject(info: ProjectInfo, val deployPath: Path) extends DefaultProject(info) with DeployProject with OSGiProject trait DeployProject extends DefaultProject { // defines where the deployTask copies jars to @@ -519,4 +518,11 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { FileUtilities.copyFile(jar, toDir / jar.name, log) } else None } + + trait OSGiProject extends DefaultProject with BNDPlugin { + override def artifactID = moduleID + "_osgi" + override def bndExportPackage = Seq("se.scalablesolutions.akka.*;version=0.9") + + } + } diff --git a/project/build/AkkaWrappersProject.scala b/project/build/AkkaWrappersProject.scala new file mode 100644 index 0000000000..f92e91d191 --- /dev/null +++ b/project/build/AkkaWrappersProject.scala @@ -0,0 +1,88 @@ + /*---------------------------------------------------------------------------\ +| Copyright (C) 2009-2010 Scalable Solutions AB | +\---------------------------------------------------------------------------*/ + +import sbt._ +import sbt.CompileOrder._ +import spde._ + +import java.util.jar.Attributes +import java.util.jar.Attributes.Name._ +import java.io.File + +import com.weiglewilczek.bnd4sbt._ + +trait AkkaWrappersProject extends DefaultProject { + + // ------------------------------------------------------------ + // project versions + val JERSEY_VERSION:String + val ATMO_VERSION:String + val CASSANDRA_VERSION:String + val LIFT_VERSION:String + val SCALATEST_VERSION:String + val MULTIVERSE_VERSION:String + + // OSGi wrappers + lazy val akka_wrappers = project("akka-wrap", "akka-wrap", new AkkaWrappersParentProject(_)) + + import Process._ + lazy val publishLocalMvnWrapped = runMvnInstallWrapped + def runMvnInstallWrapped = task { + for (absPath <- wrappedArtifacts.getPaths) { + val artifactRE = """.*/([^/]+)-([^-]+).jar""".r + val artifactRE(artifactId, artifactVersion) = absPath + val command = "mvn install:install-file" + + " -Dfile=" + absPath + + " -DgroupId=se.scalablesolutions.akka.akka-wrap" + + " -DartifactId=" + artifactId + + " -Dversion=" + artifactVersion + + " -Dpackaging=jar -DgeneratePom=true" + command ! log + } + None + } dependsOn(`package`) describedAs("Run mvn install for wrapped artifacts in akka-wrap.") + + // ================= OSGi Wrappers ================== + class JgroupsWrapperProject(info: ProjectInfo) extends OSGiWrapperProject(info) { + override def wrappedVersion = "2.9.0.GA" + override def bndImportPackage = Seq("org.testng.*;resolution:=optional", + "org.bouncycastle.jce.provider;resolution:=optional", + "bsh;resolution:=optional", + "*") + + val jgroups = "jgroups" % "jgroups" % wrappedVersion % "compile" + } + + class DispatchJsonWrapperProject(info: ProjectInfo) extends OSGiWrapperProject(info) { + override def wrappedVersion = "0.7.4" + + val dispatch_json = "net.databinder" % "dispatch-json_2.8.0.RC3" % wrappedVersion % "compile" + } + + class MultiverseWrapperProject(info: ProjectInfo) extends OSGiWrapperProject(info) { + override def wrappedVersion = "0.5.2" + + val multiverse = "org.multiverse" % "multiverse-alpha" % wrappedVersion % "compile" + } + + class AkkaWrappersParentProject(info: ProjectInfo) extends ParentProject(info) { + lazy val jgroups_wrapper = project("jgroups-wrapper", "jgroups-wrapper", + new JgroupsWrapperProject(_)) + lazy val dispath_json = project("dispatch-json", "dispatch-json", + new DispatchJsonWrapperProject(_)) + lazy val multiverse_wrapper = project("multiverse-wrapper", "multiverse-wrapper", + new MultiverseWrapperProject(_)) + } + + def wrappedArtifacts = descendents(info.projectPath / "akka-wrap", "*" + buildScalaVersion + "_osgi-" + "*.jar") + + abstract class OSGiWrapperProject(info: ProjectInfo) extends DefaultProject(info) with BNDPlugin { + def wrappedVersion:String + override def version = OpaqueVersion(wrappedVersion) + override def artifactID = moduleID + "_osgi" + override def bndExportPackage = Seq("*") + } + + +} diff --git a/project/build/lib/bnd4sbt.jar b/project/build/lib/bnd4sbt.jar new file mode 100644 index 0000000000..5906b49300 Binary files /dev/null and b/project/build/lib/bnd4sbt.jar differ diff --git a/project/plugins/Plugins.scala b/project/plugins/Plugins.scala index a133f55757..bee2aec2f2 100644 --- a/project/plugins/Plugins.scala +++ b/project/plugins/Plugins.scala @@ -6,5 +6,5 @@ class Plugins(info: ProjectInfo) extends PluginDefinition(info) { // val repo = "GH-pages repo" at "http://mpeltonen.github.com/maven/" // val idea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.1-SNAPSHOT" - lazy val bnd4sbt = "com.weiglewilczek.bnd4sbt" % "bnd4sbt" % "1.0.0.RC1" + val bnd4sbt = "com.weiglewilczek.bnd4sbt" % "bnd4sbt" % "1.0.0.RC2" }