summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-06-01 10:35:55 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2016-06-01 13:00:49 +0200
commit8384ebda45724b5a4e47dd2a508ecbbc3bca56f4 (patch)
treee272dfcc8c35db3b95b62ae8e4ce26b4b8175f89 /project
parent20dd825ec6b5d4015ce36cf4373ba1c1d917da94 (diff)
parent139f6bf9d709fc18a23530f2f84afa8a1f97b464 (diff)
downloadscala-8384ebda45724b5a4e47dd2a508ecbbc3bca56f4.tar.gz
scala-8384ebda45724b5a4e47dd2a508ecbbc3bca56f4.tar.bz2
scala-8384ebda45724b5a4e47dd2a508ecbbc3bca56f4.zip
Merge commit '139f6bf' into merge-2.11-to-2.12-june-1
Diffstat (limited to 'project')
-rw-r--r--project/Osgi.scala13
1 files changed, 11 insertions, 2 deletions
diff --git a/project/Osgi.scala b/project/Osgi.scala
index 36803c0e44..9b00379760 100644
--- a/project/Osgi.scala
+++ b/project/Osgi.scala
@@ -1,6 +1,7 @@
import aQute.bnd.osgi.Builder
import aQute.bnd.osgi.Constants._
import java.util.Properties
+import java.util.jar.Attributes
import sbt._
import sbt.Keys._
import collection.JavaConverters._
@@ -16,6 +17,7 @@ object Osgi {
val bundleName = SettingKey[String]("osgiBundleName", "The Bundle-Name for the manifest.")
val bundleSymbolicName = SettingKey[String]("osgiBundleSymbolicName", "The Bundle-SymbolicName for the manifest.")
val headers = SettingKey[Seq[(String, String)]]("osgiHeaders", "Headers and processing instructions for BND.")
+ val jarlist = SettingKey[Boolean]("osgiJarlist", "List classes in manifest.")
def settings: Seq[Setting[_]] = Seq(
bundleName := description.value,
@@ -33,9 +35,10 @@ object Osgi {
"-eclipse" -> "false"
)
},
+ jarlist := false,
bundle <<= Def.task {
val res = (products in Compile in packageBin).value
- bundleTask(headers.value.toMap, (products in Compile in packageBin).value,
+ bundleTask(headers.value.toMap, jarlist.value, (products in Compile in packageBin).value,
(artifactPath in (Compile, packageBin)).value, res, streams.value)
},
packagedArtifact in (Compile, packageBin) <<= (artifact in (Compile, packageBin), bundle).identityMap,
@@ -48,7 +51,7 @@ object Osgi {
)
)
- def bundleTask(headers: Map[String, String], fullClasspath: Seq[File], artifactPath: File,
+ def bundleTask(headers: Map[String, String], jarlist: Boolean, fullClasspath: Seq[File], artifactPath: File,
resourceDirectories: Seq[File], streams: TaskStreams): File = {
val log = streams.log
val builder = new Builder
@@ -63,6 +66,12 @@ object Osgi {
builder.getWarnings.asScala.foreach(s => log.warn(s"bnd: $s"))
builder.getErrors.asScala.foreach(s => log.error(s"bnd: $s"))
IO.createDirectory(artifactPath.getParentFile)
+ if (jarlist) {
+ val entries = jar.getManifest.getEntries
+ for ((name, resource) <- jar.getResources.asScala if name.endsWith(".class")) {
+ entries.put(name, new Attributes)
+ }
+ }
jar.write(artifactPath)
artifactPath
}