Permalink
Browse files

Merge branch '19-hseeberger'

  • Loading branch information...
2 parents 0e540d6 + a077bdd commit 26c4984723c5917ccfd9b2204b8145d2439057be Heiko Seeberger committed Jul 22, 2010
View
@@ -1,8 +1,8 @@
#Project properties
-#Thu Jul 01 09:48:19 CEST 2010
+#Wed Jul 21 11:37:40 CEST 2010
project.organization=com.weiglewilczek.bnd4sbt
project.name=bnd4sbt
sbt.version=0.7.4
-project.version=1.0.0.RC4
+project.version=1.0.0.RC5
build.scala.versions=2.7.7
project.initialize=false
@@ -22,9 +22,9 @@ import sbt.DefaultProject
trait BNDPlugin extends DefaultProject with BNDPluginProperties {
/** Creates an OSGi bundle out of this project by using BND. Initialized by bndBundleAction which can be overridden in order to modify the behavior. */
- lazy val bndBundle = bndBundleAction
+ final lazy val bndBundle = bndBundleAction
- /** Creates an OSGi bundle out of this project by using BND. Override to modify the behavior of the bndBundle action. */
+ /** Creates an OSGi bundle out of this project by using BND. Attention: If you override this, you might loose the bnd4sbt functionality. */
protected def bndBundleAction =
task {
try {
@@ -38,20 +38,26 @@ trait BNDPlugin extends DefaultProject with BNDPluginProperties {
}
} dependsOn compile describedAs "Creates an OSGi bundle out of this project by using BND."
- /** Overrides the package action with the bndBundle action. */
+ /** Overrides the package action with the bndBundle action. Attention: If you override this, you might loose the bnd4sbt functionality. */
override protected def packageAction = bndBundle
/** This SBT project. */
- override protected val project = this
+ final override protected[bnd4sbt] val project = this
private def createBundle() {
val builder = new Builder
builder setProperties properties
- builder setClasspath bndClasspath.getFiles.toArray
+ builder setClasspath classpath
val jar = builder.build
jar write bndOutput.absolutePath
}
+ private def classpath = {
+ val cp = bndClasspath.getFiles.toArray
+ log debug "Using the following classpath for BND: %s".format(cp mkString ":")
+ cp
+ }
+
private def properties = {
val properties = new Properties
@@ -14,6 +14,7 @@ import scala.collection.immutable.Set
* Execution environments available for bnd4sbt. As Scala relies on Java 5, only Java 5 and later are supported.
*/
object ExecutionEnvironments extends Enumeration {
+ type ExecutionEnvironments = Value
val Java5 = Value("J2SE-1.5")
val Java6 = Value("JavaSE-1.6")
}
@@ -22,6 +23,7 @@ object ExecutionEnvironments extends Enumeration {
* Properties for BND with sensible defaults.
*/
private[bnd4sbt] trait BNDPluginProperties extends ProjectAccessor {
+ import ExecutionEnvironments._
/**
* The value for Bundle-SymbolicName. Defaults to projectOrganization.projectName with duplicate subsequences
@@ -55,10 +57,10 @@ private[bnd4sbt] trait BNDPluginProperties extends ProjectAccessor {
protected def bndBundleLicense: Option[String] = None
/** The value for Bundle-RequiredExecutionEnvironment. Defaults to empty set, i.e. no execution environments are defined. */
- protected def bndExecutionEnvironment = Set[ExecutionEnvironments.Value]()
+ protected def bndExecutionEnvironment = Set[ExecutionEnvironments]()
- /** The value for Private-Package. Defaults to "*", i.e. contains everything. */
- protected def bndPrivatePackage = Seq("*")
+ /** The value for Private-Package. Defaults to BNDPlugin.bndBundleSymbolicName.*, i.e. contains the root package and all subpackages. */
+ protected def bndPrivatePackage = Seq(bndBundleSymbolicName + ".*")
/** The value for Export-Package. Defaults to empty sequence, i.e. nothing is exported. */
protected def bndExportPackage = Seq[String]()
@@ -93,8 +95,8 @@ private[bnd4sbt] trait BNDPluginProperties extends ProjectAccessor {
/** The output path used by BND. Defaults to the outputPath of this project plus the value of BNDPlugin.bndFileName. ATTENTION: Better not change this, but the appropriate SBT default properties! */
protected def bndOutput = project.outputPath / bndFileName
- /** The classpath used by BND. Attention: Don't mistake this for the Bundle-Classpath! Defaults to the mainCompilePath of this project. */
- protected def bndClasspath: PathFinder = project.mainCompilePath
+ /** The classpath used by BND. Attention: Don't mistake this for the Bundle-Classpath! Defaults to the runClasspath of this project. */
+ protected def bndClasspath: PathFinder = project.runClasspath
private[bnd4sbt] def bundleClasspath =
if (bndEmbedDependencies) Set(".") ++ (project.publicClasspath.get filter { !_.isDirectory } map { _.name })
@@ -119,5 +121,5 @@ private[bnd4sbt] trait BNDPluginProperties extends ProjectAccessor {
private[bnd4sbt] trait ProjectAccessor {
/** The SBT project. */
- protected val project: DefaultProject
+ protected[bnd4sbt] val project: DefaultProject
}
@@ -1,4 +1,4 @@
-package a
+package com.weiglewilczek.bnd4sbttest.a
object A {
val name = "A"
@@ -1,6 +1,6 @@
-package b.internal
+package com.weiglewilczek.bnd4sbttest.b.internal
-import a.A
+import com.weiglewilczek.bnd4sbttest.a.A
import org.osgi.framework.{ BundleActivator, BundleContext }
class Activator extends BundleActivator {
@@ -1,4 +1,4 @@
-package c
+package com.weiglewilczek.bnd4sbttest.c
object C {
val name = "C"
@@ -1,3 +1,3 @@
-package c
+package com.weiglewilczek.bnd4sbttest.c
class Test
@@ -1,6 +1,6 @@
-package d.internal
+package com.weiglewilczek.bnd4sbttest.d.internal
-import c.C
+import com.weiglewilczek.bnd4sbttest.c.C
import org.apache.commons.logging.LogFactory
import org.osgi.framework.{ BundleActivator, BundleContext }
@@ -1,4 +1,4 @@
-package d
+package com.weiglewilczek.bnd4sbttest.d
object Test
@@ -1,7 +1,7 @@
#Project properties
#Mon May 10 09:58:30 CEST 2010
-project.organization=com.weiglewilczek
-project.name=bnd4sbt-test
+project.organization=com.weiglewilczek.bnd4sbttest
+project.name=bnd4sbttest
sbt.version=0.7.4
project.version=1.0
build.scala.versions=2.7.7
@@ -7,21 +7,21 @@ class TestProject(info: ProjectInfo) extends ParentProject(info: ProjectInfo) {
class A(info: ProjectInfo) extends DefaultProject(info) with BNDPlugin {
import com.weiglewilczek.bnd4sbt.ExecutionEnvironments._
override def bndBundleLicense = Some("Eclipse Public License v1.0")
- override def bndExportPackage = Seq("a;version=1.0")
+ override def bndExportPackage = Seq("com.weiglewilczek.bnd4sbttest.a;version=1.0")
override def bndExecutionEnvironment = Set(Java5, Java6)
override def bndDynamicImportPackage = Seq("x.y.z")
override def bndVersionPolicy = Some("[$(@),$(@)]")
override def bndNoUses = true
override def packageOptions =
ManifestAttributes("Bundle-Name" -> "ILLEGAL") ::
- ManifestAttributes("test" -> "TEST") ::
+ ManifestAttributes("Test" -> "TEST") :: // Only uppercase headers are copied to the manifest by BND!
Nil
}
lazy val b = project("b", "b", new B(_), a)
class B(info: ProjectInfo) extends DefaultProject(info) with BNDPlugin {
lazy val osgiCore = "org.osgi" % "org.osgi.core" % "4.2.0" % "provided"
- override def bndBundleActivator = Some("b.internal.Activator")
+ override def bndBundleActivator = Some("com.weiglewilczek.bnd4sbttest.b.internal.Activator")
}
lazy val c = project("c", "c", new C(_))
@@ -33,7 +33,7 @@ class TestProject(info: ProjectInfo) extends ParentProject(info: ProjectInfo) {
class D(info: ProjectInfo) extends DefaultProject(info) with BNDPlugin {
lazy val osgiCore = "org.osgi" % "org.osgi.core" % "4.2.0" % "provided"
lazy val commonsLogging = "commons-logging" % "commons-logging-api" % "1.1"
- override def bndBundleActivator = Some("d.internal.Activator")
+ override def bndBundleActivator = Some("com.weiglewilczek.bnd4sbttest.d.internal.Activator")
override def bndEmbedDependencies = true
}
}
@@ -2,10 +2,23 @@ import sbt._
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
+ // ===================================================================================================================
// Repositories
- def aquteRepo = "aQute Maven Repository" at "http://www.aqute.biz/repo"
- lazy val aquteModuleConfig = ModuleConfiguration("biz.aQute", aquteRepo)
+ // ===================================================================================================================
+ object Repositories {
+ lazy val aquteRepo = "aQute Maven Repository" at "http://www.aqute.biz/repo"
+ }
+
+ // ===================================================================================================================
+ // ModuleConfigurations
+ // ===================================================================================================================
+
+ lazy val aquteModuleConfig = ModuleConfiguration("biz.aQute", Repositories.aquteRepo)
+
+ // ===================================================================================================================
// Dependencies
- lazy val bnd4sbt = "com.weiglewilczek.bnd4sbt" % "bnd4sbt" % "1.0.0.RC3"
+ // ===================================================================================================================
+
+ lazy val bnd4sbt = "com.weiglewilczek.bnd4sbt" % "bnd4sbt" % "1.0.0.RC5"
}
@@ -1,3 +1,3 @@
#Project properties
-#Sun Jun 20 22:10:00 CEST 2010
+#Thu Jul 22 10:14:18 CEST 2010
plugin.uptodate=true

0 comments on commit 26c4984

Please sign in to comment.