From 691e344b2ca81ac03a0c0a57bd0e2db382f59ae9 Mon Sep 17 00:00:00 2001 From: Andreas Kollegger Date: Sun, 6 Jun 2010 20:05:26 -0400 Subject: [PATCH] initial implementation of OSGiWrapperProject, applied to jgroups dependency to make it OSGi-friendly --- .../src/main/resources/features.xml | 7 +++ project/build/AkkaProject.scala | 51 +++++++++++++++++- project/plugins/.Plugins.scala.swp | Bin 12288 -> 0 bytes 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 akka-karaf/akka-features/src/main/resources/features.xml delete mode 100644 project/plugins/.Plugins.scala.swp 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..9176437f46 --- /dev/null +++ b/akka-karaf/akka-features/src/main/resources/features.xml @@ -0,0 +1,7 @@ + + + + mvn:se.scalablesolutions.akka.akka-wrap/jgroups-wrapper_2.8.0.RC3_osgi/2.9.0.GA + mvn:se.scalablesolutions.akka/akka-core_2.8.0.RC3_osgi/0.9 + + diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala index 47559ad865..2b96abb597 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -86,6 +86,9 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { // examples lazy val akka_samples = project("akka-samples", "akka-samples", new AkkaSamplesParentProject(_)) + // OSGi wrappers + lazy val akka_wrappers = project("akka-wrap", "akka-wrap", new AkkaWrappersParentProject(_)) + // ------------------------------------------------------------ // Run Akka microkernel using 'sbt run' + use for packaging executable JAR override def mainClass = Some("se.scalablesolutions.akka.kernel.Main") @@ -169,9 +172,28 @@ 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.") + 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.") + + + + // ------------------------------------------------------------ // subprojects class AkkaCoreProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { @@ -362,6 +384,23 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { new AkkaSampleRemoteProject(_), akka_kernel) } + + // ================= OSGi Wrappers ================== + class JgroupsWrapperProject(info: ProjectInfo) extends OSGiWrapperProject(info) { + override def wrappedVersion = "2.9.0.GA" + override def bndImportPackage = Set("org.testng.*;resolution:=optional", + "org.bouncycastle.jce.provider;resolution:=optional", + "bsh;resolution:=optional", + "*") + + val jgroups = "jgroups" % "jgroups" % wrappedVersion % "compile" + } + + class AkkaWrappersParentProject(info: ProjectInfo) extends ParentProject(info) { + lazy val jgroups_wrapper = project("jgroups-wrapper", "jgroups-wrapper", + new JgroupsWrapperProject(_)) + } + // ------------------------------------------------------------ // helper functions def removeDupEntries(paths: PathFinder) = @@ -390,6 +429,8 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { def akkaArtifacts = descendents(info.projectPath / "dist", "*" + buildScalaVersion + "_osgi-" + version + ".jar") + def wrappedArtifacts = descendents(info.projectPath / "akka-wrap", "*" + buildScalaVersion + "_osgi-" + "*.jar") + // ------------------------------------------------------------ class AkkaDefaultProject(info: ProjectInfo, val deployPath: Path) extends DefaultProject(info) with DeployProject with OSGiProject @@ -419,5 +460,13 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) { } + 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 bndEmbedDependencies = true + override def bndExportPackage = Set("*") + } + } diff --git a/project/plugins/.Plugins.scala.swp b/project/plugins/.Plugins.scala.swp deleted file mode 100644 index 39709506fa92639a4034a394fdcff22edf268002..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmYc?2=nw+FxN9;U|?VnU|?{5&Fv#s_Kdkeijg5PJ3l8UH9bAG2qcLcyCs&CRO3s$Q}1xG_*Gz5@CptK}S*MgV9*vQa8SxHerSSS=( zc9cCD0;3@?8UmvsFd71*Aut*OqaiRF0;3@?0z#mqfRW)p0|NsS0|Nsm0|Nsi6psL} zk9u)51V%$(Gz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONU^E0qOb8^VFffSoF);Y^LFWHK zV*sD|85lnCGcau6XJAO=XJC-!XJEL-$H36d$G{K>RV&BGz#zuQz`)7Jz`z00J7Pj? z)T5&zFd71*Aut*OqaiRF0;3@?8UmvsFd71*Auz;4pq9Z70u+oal3*MdZ3hxGHAzV{ zPqR!iGq$uyOR-EeO*A$)u`n<*F*Zz0GO;u_H8nM>Wl&HkOUzM7%1bdRPAXBbRZvRK z&($kW%}mcpEzitJu1d{TQczV;f+_&B4fITu6ciZr^&xsQQ&JOQ8q+gNGD?&5atl&( zO7ink^T6thlS*_!igY3C!NFn%dWO2eevSdb9{wRpaHEP+3-UomxqIjqB&MepD}V%) z6cS4mlrl<63as??;U?=rtxC?%)z3{VOU=_)g8HSnASE>z;+N85y^_@AjJ(X`#GIT; zJ&+98b`V1s