initial implementation of OSGiWrapperProject, applied to jgroups dependency to make it OSGi-friendly

This commit is contained in:
Andreas Kollegger 2010-06-06 20:05:26 -04:00
parent b4ab04af56
commit 691e344b2c
3 changed files with 57 additions and 1 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="akka 0.9">
<feature name="akka-core" version="0.9-SNAPSHOT">
<bundle>mvn:se.scalablesolutions.akka.akka-wrap/jgroups-wrapper_2.8.0.RC3_osgi/2.9.0.GA</bundle>
<bundle>mvn:se.scalablesolutions.akka/akka-core_2.8.0.RC3_osgi/0.9</bundle>
</feature>
</features>

View file

@ -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("*")
}
}

Binary file not shown.