Merge remote branch 'akollegger/master' into osgi

Conflicts:
	project/build/AkkaProject.scala
	project/plugins/Plugins.scala
This commit is contained in:
Roman Roelofsen 2010-06-18 11:20:10 +02:00
commit dff7cc65d1
6 changed files with 135 additions and 21 deletions

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="akka 0.9">
<feature name="scala-osgi" version="1.5">
<bundle>mvn:com.weiglewilczek.scala-lang-osgi/scala-library/2.8.0.RC2</bundle>
<bundle>mvn:org.eclipse.scalamodules/scalamodules-core/2.0-M2</bundle>
</feature>
<feature name="sjson" version="0.6-SNAPSHOT">
<bundle>mvn:se.scalablesolutions.akka.akka-wrap/dispatch-json_2.8.0.RC3_osgi/0.7.4</bundle>
<bundle>mvn:org.objenesis/objenesis/1.2</bundle>
<bundle>mvn:sjson.json/sjson/0.6-SNAPSHOT</bundle>
</feature>
<feature name="akka-core" version="0.9-SNAPSHOT">
<feature>sjson</feature>
<bundle>mvn:se.scalablesolutions.akka.akka-wrap/jgroups-wrapper_2.8.0.RC3_osgi/2.9.0.GA</bundle>
<bundle>mvn:org.jboss.netty/netty/3.2.0.CR1</bundle>
<bundle>mvn:se.scalablesolutions.akka/akka-core_2.8.0.RC3_osgi/0.9</bundle>
</feature>
</features>

View file

@ -12,10 +12,8 @@ class Activator extends BundleActivator {
def start(context: BundleContext) { def start(context: BundleContext) {
println("Start") println("Start")
val osgiActor = new OSGiActor val osgiActor = new OSGiActor
osgiActor ! "Hello" //osgiActor ! "Hello"
Unit
} }
def stop(context: BundleContext) { def stop(context: BundleContext) {

View file

@ -10,7 +10,7 @@ import java.util.jar.Attributes
import java.util.jar.Attributes.Name._ import java.util.jar.Attributes.Name._
import java.io.File import java.io.File
import com.weiglewilczek.bnd4sbt.BNDPlugin import com.weiglewilczek.bnd4sbt._
class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { 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 LIFT_VERSION = "2.0-scala280-SNAPSHOT"
val SCALATEST_VERSION = "1.2-for-scala-2.8.0.RC3-SNAPSHOT" val SCALATEST_VERSION = "1.2-for-scala-2.8.0.RC3-SNAPSHOT"
val MULTIVERSE_VERSION = "0.5.2" val MULTIVERSE_VERSION = "0.5.2"
val COMMONS_CODEC_VERSION = "1.4"
// ------------------------------------------------------------ // ------------------------------------------------------------
lazy val deployPath = info.projectPath / "deploy" lazy val deployPath = info.projectPath / "deploy"
@ -171,7 +172,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
" -Dpackaging=jar -DgeneratePom=true" " -Dpackaging=jar -DgeneratePom=true"
command ! log command ! log
} }
None None
} dependsOn(dist) describedAs("Run mvn install for artifacts in dist.") } 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) { class AkkaRedisProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
val redis = "com.redis" % "redisclient" % "2.8.0.RC3-1.4-SNAPSHOT" % "compile" 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 override def testOptions = TestFilter((name: String) => name.endsWith("Test")) :: Nil
} }
@ -298,11 +299,6 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
} }
// ================= OSGi Packaging ================== // ================= 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 { class AkkaOSGiDependenciesBundleProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with BNDPlugin {
override def bndClasspath = compileClasspath override def bndClasspath = compileClasspath
@ -381,12 +377,15 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
} }
class AkkaOSGiParentProject(info: ProjectInfo) extends ParentProject(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", 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", 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 ================== // ================= TEST ==================
@ -433,7 +432,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
class AkkaSampleSecurityProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) { class AkkaSampleSecurityProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) {
val jsr311 = "javax.ws.rs" % "jsr311-api" % "1.1.1" % "compile" val jsr311 = "javax.ws.rs" % "jsr311-api" % "1.1.1" % "compile"
val jsr250 = "javax.annotation" % "jsr250-api" % "1.0" % "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 { 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") !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 { trait DeployProject extends DefaultProject {
// defines where the deployTask copies jars to // 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) FileUtilities.copyFile(jar, toDir / jar.name, log)
} else None } else None
} }
trait OSGiProject extends DefaultProject with BNDPlugin {
override def artifactID = moduleID + "_osgi"
override def bndExportPackage = Seq("se.scalablesolutions.akka.*;version=0.9")
}
} }

View file

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------\
| Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se> |
\---------------------------------------------------------------------------*/
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("*")
}
}

Binary file not shown.

View file

@ -6,5 +6,5 @@ class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
// val repo = "GH-pages repo" at "http://mpeltonen.github.com/maven/" // val repo = "GH-pages repo" at "http://mpeltonen.github.com/maven/"
// val idea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.1-SNAPSHOT" // 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"
} }