Coder Social home page Coder Social logo

sbt-osgi's Introduction

sbt-osgi

Build Status

Plugin for sbt to create OSGi bundles.

Installing sbt-osgi

sbt-osgi is a plugin for sbt. In order to install sbt, please refer to the sbt 1.x). Please make sure that you are using a suitable version of sbt:

  • sbt-osgi 0.9.{4-x} -> sbt 1.6.2+ (older versions of sbt may work but 1.6.2+ supports all JDK LTS versions)

As sbt-osgi is a plugin for sbt, it is installed like any other sbt plugin, that is by mere configuration: just add sbt-osgi to your global or local plugin definition. Global plugins are defined in ~/.sbt/<SBT_VERSION>/plugins/plugins.sbt and local plugins are defined in project/plugins.sbt in your project.

In order to add sbt-osgi as a plugin, just add the below setting to the relevant plugin definition, paying attention to blank lines between settings:

// Other stuff

addSbtPlugin("com.github.sbt" % "sbt-osgi" % "0.9.11")

If you want to use the latest and greatest features, you can instead have sbt depend on and locally build the current source snapshot by adding the following to your plugin definition file. Example <PROJECT_ROOT>/project/plugins.sbt:

lazy val plugins = (project in file("."))
  .dependsOn(sbtOsgi)

// Other stuff

def sbtOsgi = uri("git://github.com/sbt/sbt-osgi.git")

Using sbt-osgi

Version 0.8.0 and above

As, since version 0.8.0, sbt-osgi uses the sbt 0.13.5 Autoplugin feature, it can be enabled for individual projects like any other sbt Autoplugin. For more information on enabling and disabling plugins, refer to the sbt plugins tutorial.

Example <PROJECT_ROOT>/build.sbt:

enablePlugins(SbtOsgi)

To also override the default publish behaviour, also add the osgiSettings settings to your project via your preferred method.

Example <PROJECT_ROOT>/build.sbt:

// Other settings

osgiSettings

Version 0.7.0 and below

Add the below line to your sbt build definition, which adds the task osgiBundle which creates an OSGi bundle for your project and also changes the publish task to publish an OSGi bundle instead of a raw JAR archive. Again, pay attention to the blank line between settings:

// Other stuff

osgiSettings

If you just want osgiBundle, i.e. don't want to change the behavior of publish:

// Other stuff

defaultOsgiSettings

Settings

sbt-osgi can be configured with the following settings:

  • bundleActivator: value for Bundle-Activator header, default is None
  • bundleRequiredExecutionEnvironment: value for Bundle-RequiredExecutionEnvironment header, default is an empty string.
  • bundleSymbolicName: value for Bundle-SymbolicName header, default is organization plus name
  • bundleVersion: value for Bundle-Version header, default is version
  • dynamicImportPackage: values for Dynamic-ImportPackage header, default is the empty sequence
  • exportPackage: values for Export-Package header, default is the empty sequence
  • importPackage: values for Import-Package header, default is *
  • fragmentHost: value for Fragment-Host header, default is None
  • privatePackage: values for Private-Package header, default is OsgiKeys.bundleSymbolicName plus .*
  • requireBundle: values for Require-Bundle header, default is the empty sequence
  • additionalHeaders: map of additional headers to be passed to BND, default is the empty sequence
  • embeddedJars: list of dependencies to embed inside the bundle which are automatically added to Bundle-Classpath
  • explodedJars: list of jarfiles to explode into the bundle
  • requireCapability: value for Require-Capability header, defaults to osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=*PROJECT JAVAC VERSION*))"
  • failOnUndecidedPackage: allows failing the build when a package is neither exported nor private (instead of silently dropping it), false by default to be compatible with previous behaviour

Example build.sbt:

organization := "com.github.sbt"

name := "osgi.demo"

version := "1.0.0"

enablePlugins(SbtOsgi)

libraryDependencies += "org.osgi" % "org.osgi.core" % "4.3.0" % "provided"

osgiSettings

OsgiKeys.exportPackage := Seq("com.github.sbt.osgidemo")

OsgiKeys.bundleActivator := Option("com.github.sbt.osgidemo.internal.Activator")

License

This code is open source software licensed under the Apache 2.0 License.

sbt-osgi's People

Contributors

arashi01 avatar chbaranowski avatar eed3si9n avatar he-pin avatar isomarcte avatar johanandren avatar ktoso avatar larsrh avatar lefou avatar mdedetrich avatar michalj avatar mkurz avatar philippus avatar reggert avatar retronym avatar romainreuillon avatar scala-steward avatar seratch avatar sethtisue avatar stsatlantis avatar sullis avatar szeiger avatar tpolecat avatar wsargent avatar xuwei-k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sbt-osgi's Issues

Unit test coverage is rather poor

The current unit test coverage for the plugin is rather poor. bundleTask is not covered at all, and that's where most of the work is done. bundleTask should be broken up into smaller, testable chunks, with unit tests written for each chunk. Ideally, an end-to-end test for bundleTask should also be written.

`Compile / sbt.Keys.packageBin := bundle.value` can cause infinite recursive loop

As a consequence of #95, its possible to create an infinite recursive loop which means that sbt never ends up fully starting.

To reproduce this, simply change https://github.com/sbt/sbt-osgi/blob/main/src/main/scala/com/typesafe/sbt/osgi/SbtOsgi.scala#L47 to (fullClasspath in Compile).value.map(_.data) and then navigate into src/sbt-test/sbt-osgi/test-05-exportJars/ to run the test (i.e. run sbt osgiBundle).

You will notice that sbt stalls forever, failing to start. My suspicion is that there is an interdependency between

Which causes the sbt task graph to not complete when evaluated. Apparently the intention of #95 was to prevent asynchronicity issues (see #79 (comment)) by forcefully evaluating Compile / sbt.Keys.packageBin.

@romainreuillon Maybe there is a better way to solve this otherwise I think I would have to revert the change since you can easily prevent sbt from even starting.

How to exclude libraries that are marked with Provided

Is there a way to create a fat jar using the OsgiKeys.embeddedJars attribute, but to exclude libraries that are marked as "Provided", like e.g.:

libraryDependencies += "org.apache.logging.log4j" % "log4j-api" % "2.7" % Provided
libraryDependencies +=  "com.typesafe.akka" %% "akka-actor" % akkaVersion

In this case com.typesafe.akka should be included in the fat jar while org.apache.logging.log4j should not be compiled into the jar.

Missing imported versions for packages from project dependencies

The generated Manifest ist missing version information for those imported packages that come from other sub-projects (which are added via sbt's project.dependsOn syntax). It looks like sbtOsgi only sees the class files but not the generated manifests. Packages comming from libraryDependencies properly get their version information extracted and added to the Import-Package header.

Make a custom release of sbt-osgi 0.9.4 + Invalid CEN extra data field patch

At pekko we are using sbt-osgi and we have encountered a regression that occurred between 0.9.4 and 0.9.5 whereby there are duplicate classes/jars, see apache/pekko#745 (comment) for more info.

Ordinarily this regression wouldn't have been an issue since we could just stick to 0.9.4 but because of #81 0.9.4. no longer works. In the interests of unblocking pekko (currently both the main and 1.0.x branches are broken due to this) would it be possible to create patched release of 0.9.4. containing #81 ?

In my mind I would create a new branch based off of 0.9.4, cherry picking the relevant build/org updates along with the patch and then we can cut a release by pushing a git tag (I was thinking 0.9.4-INVALID-CEN-JAR-PATCH?)

@eed3si9n @xuwei-k @romainreuillon thoughts?

Capturing debug output from BND

BND output should be captured and integrated into the output of "show" when the plugin is run interactively. It's easy to misconfigure a tool like sbt-osgi, and if the user already knows bnd and could see what is being passed to it, they might have a better chance of self-diagnosing configuration issues.

"Reference to undefined setting" when adding "osgiSettings" to build.sbt

I am importing sbt-osgi to my project using the git link in my local project's plugins.sbt file.
Here are the contents of my plugins.sbt file:

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")

lazy val plugins = (project in file("."))
  .dependsOn(sbtOsgi)

def sbtOsgi = uri("git://github.com/sbt/sbt-osgi.git")

With that in my build, I can run "sbt compile" and "sbt eclipse" without any trouble. When I add "osgiSettings" with a blank line before it to the end of my build.sbt, I get the following:

Reference to undefined setting:

  *:osgiBundle from compile:packageBin::packagedArtifact (C:\dev\myproject\build.sbt:18)

        at sbt.Init$class.Uninitialized(Settings.scala:270)
        at sbt.Def$.Uninitialized(Def.scala:10)

Is there something wrong with the way that I configured my project, or is this a problem with the plugin?

Document how to publish OSGi bundles

In Akka, we publish OSGi bundles by replacing the packageBin task:

   Compile / packageBin := OsgiKeys.bundle.value

The advantage is that this way the bundle will be picked up correctly by other plugins publishing the packaged artifacts.

A nonobvious effect of this approach is that this will render customizations of the packageBin task, such as changing Compile / packageBin / mappings, ineffective.

Do we want to document/encourage publishing packages like this? Are there alternative solutions? If we recommend this, should we try to be as faithful as possible to the default packageBin behavior and try to honour the mappings?

Problems using a dash in bundleSymbolicName

We tried to move a maven-based build to sbt, using the same values. But, in our tests, when the bundleSymbolicName has a dash, the build won't find some classes (in our case, it was the bundle activator).

`ConcurrentModificationException` when bunding on JDK17

akka/akka#31132

[error] java.util.ConcurrentModificationException
[error] 	at java.base/java.util.TreeMap.callMappingFunctionWithCheck(TreeMap.java:750)
[error] 	at java.base/java.util.TreeMap.computeIfAbsent(TreeMap.java:604)
[error] 	at aQute.bnd.osgi.Jar.putResource(Jar.java:259)
[error] 	at aQute.bnd.osgi.Jar$1.visitFile(Jar.java:186)
[error] 	at aQute.bnd.osgi.Jar$1.visitFile(Jar.java:167)
[error] 	at java.base/java.nio.file.Files.walkFileTree(Files.java:2811)
[error] 	at aQute.bnd.osgi.Jar.buildFromDirectory(Jar.java:166)
[error] 	at aQute.bnd.osgi.Jar.<init>(Jar.java:109)
[error] 	at aQute.bnd.osgi.Jar.<init>(Jar.java:138)
[error] 	at aQute.bnd.osgi.Analyzer.setClasspath(Analyzer.java:1465)
[error] 	at com.typesafe.sbt.osgi.Osgi$.bundleTask(Osgi.scala:57)
[error] 	at com.typesafe.sbt.osgi.SbtOsgi$.$anonfun$defaultOsgiSettings$1(SbtOsgi.scala:55)

Bundling behavior change between 0.5 and 0.6

So, I upgraded to sbt 0.13 and sbt-osgi 0.6 on my project the other day only to discover that my project code now outputs stuff I didn't expect.

In my project, I take a bunch of project dependencies like scalatra and ice.tar, and convert them into bundles. Sometimes these dependencies have files and other non-class content embedded in them that must be copied to the resulting bundle, like with the bundle my project makes of the scala libs + akka. It used to be I could get these files with the privatePackage setting. For example, in my scala+akka bundle, I made the project depend on scala and akka, and set private packages to "*". This would pull in all the class files that were not exported, but also files like reference.conf in the root of the akka-actors jar, which is necessary for akka to work without a configuration file.

In sbt 0.6, privatePackage now only packages classes found on the classpath, not files. This is entirely an issue with aQute.bndlib being upgraded. I have a fork of this project here that downgrades aQute.bndlib and makes some minor changes to the plugin, and the behavior my project was relying on has returned. Looking at the bndlib documentation, it looks like include_resource is needed to do what I was doing, but there's no such key in sbt-osgi, and I'm not sure how exactly to do what I was doing before (package files found in the classpath into the resulting bundle).

Any idea how to fix this for the new version of bndlib and sbt-osgi?

Duplicated `META-INF/MANIFEST.MF` entries when using `packageWithJVMJar := true` on Windows

sbt:pekko-bench-jmh> last actor / osgiBundle
[info] Validating all packages are set private or exported for OSGi explicitly...
[warn] bnd: Unused -privatepackage instructions , no such package(s) on the class path: [org.apache.pekko.osgi.impl]
[warn] bnd: Unused Import-Package instructions: [scala.compat.java8.*]
[error] java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF
[error]         at java.base/java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:233)
[error]         at java.base/java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
[error]         at sbt.io.IO$.addFileEntry$1(IO.scala:717)
[error]         at sbt.io.IO$.$anonfun$writeZip$6(IO.scala:726)
[error]         at sbt.io.IO$.$anonfun$writeZip$6$adapted(IO.scala:726)
[error]         at scala.collection.immutable.Stream.foreach(Stream.scala:533)
[error]         at sbt.io.IO$.writeZip(IO.scala:726)
[error]         at sbt.io.IO$.$anonfun$archive$2(IO.scala:676)
[error]         at sbt.io.IO$.$anonfun$archive$2$adapted(IO.scala:673)
[error]         at sbt.io.IO$.$anonfun$withZipOutput$1(IO.scala:773)
[error]         at sbt.io.IO$.$anonfun$withZipOutput$1$adapted(IO.scala:753)
[error]         at sbt.io.Using.apply(Using.scala:28)
[error]         at sbt.io.IO$.withZipOutput(IO.scala:753)
[error]         at sbt.io.IO$.archive(IO.scala:673)
[error]         at sbt.io.IO$.jar(IO.scala:621)
[error]         at com.typesafe.sbt.osgi.Osgi$.$anonfun$bundleTask$1(Osgi.scala:187)
[error]         at scala.Option.getOrElse(Option.scala:189)
[error]         at com.typesafe.sbt.osgi.Osgi$.withCache(Osgi.scala:112)
[error]         at com.typesafe.sbt.osgi.Osgi$.bundleTask(Osgi.scala:139)
[error]         at com.typesafe.sbt.osgi.SbtOsgi$.$anonfun$defaultOsgiSettings$1(SbtOsgi.scala:57)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]         at sbt.Execute.work(Execute.scala:292)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:829)
[error] (actor / osgiBundle) java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF

Instructions for snapshot are not valid

For the snapshot version, this import does not work. Following the instructions for the snapshot version does not work.

import com.typesafe.sbt.SbtOsgi.autoImport._

Add a way to include compile time libraryDependencies inside the Jar

I know this is maybe not the way "most" people would treat OSGI.
But actually in addition to osgiExplodedJars and osgiEmbeddedJars it would be great to actually have a setting that will automatically add every compile time + transitive compile time dependency to the jar, some kind of shading.

Translate Scala-style version numbers for OSGi

The current direct translation from Scala-style version numbers (as used for publishing in Maven repositories) to OSGi version numbers makes it difficult to get import version ranges right.

For instance, this is what we now do in slick-extensions:

  OsgiKeys.importPackage := Seq(
    osgiImport("scala.slick*", slickVersion, requireMicro=true),
    osgiImport("scala*", scalaVersion.value),
    "*"
  )

Where osgiImport is defined as:

  /** Create an OSGi version range for standard Scala / Typesafe versioning
    * schemes that describes binary compatible versions. */
  def osgiVersionRange(version: String, requireMicro: Boolean = false): String =
    if(version contains '-') "${@}" // M, RC or SNAPSHOT -> exact version
    else if(requireMicro) "${range;[===,=+)}" // At least the same micro version
    else "${range;[==,=+)}" // Any binary compatible version

  /** Create an OSGi Import-Package version specification. */
  def osgiImport(pattern: String, version: String, requireMicro: Boolean = false): String =
    pattern + ";version=\"" + osgiVersionRange(version, requireMicro) + "\""

This means that slick-extensions 2.0.2 imports slick [2.0.2,2.1) and slick-extensions 2.1.0 imports slick [2.1.0,2.2), which are the defined binary compatible versions. When we look at non-release versions (which have no binary compatibility guarantees), this also works fine: slick-extensions 2.1.0.M1 imports slick 2.1.0.M1.

Combining either multiple release versions, or multiple non-release versions in a container also poses no problems, but things break down when you try to mix release and non-release versions like slick-extensions 2.1.0.M1 and 2.1.0 because 2.1.0.M1 is matched by [2.1.0,2.2) even though it is incompatible and older than 2.1.0.

I think sbt-osgi would be a good place to solve this for all Scala libraries. It could translate the version from the sbt build to an OSGi version for the bundle and the exported packages, and do the same to dependency versions (or is that fully handled by bnd?).

I have some ideas how a suitable version number scheme could look but I'm sure this problem has already been solved by the OSGi community, so I'll leave it to others to suggest something.

As far as I can tell, the challenges are:

  • How to translate Maven version numbers (including milestones, RCs and possibly snapshots) into OSGi version numbers so that binary compatibility can be specified correctly
  • What are the implications of having different version numbers for the bundle + packages and the JARs in a Maven repo? Will this negatively affect discovery of packages?
  • Bonus: Define the translation scheme such that the standard version range [==,+) can be used.

The bundle task should not produce a bundle unless source (or bnd headers) has(/have) changed

One of the key uses os OSGI is dynamic code reloading, reloading bundles into an OSGI framework does require being able to detect when a bundle has changed. Current the plugin produces a new bundle everytime the bundle task is invoked.

I'm a novice with SBT development but I'm learning I have this question open on SO whilst trying to hack my way to some sort of a solution.

If someone could give me some pointers perhaps I can add this functionality.

test-08-failOnClassesExcludedFromJarStar fail

[info] [info] Validating all packages are set private or exported for OSGi explicitly...
[info] [success] Total time: 1 s, completed Aug 12, 2017 1:49:18 AM
[error] x sbt-osgi / test-08-failOnClassesExcludedFromJarStar
[error]    {line 1}  Command succeeded but failure was expected
[trace] Stack trace suppressed: run last *:scripted for the full output.
[error] (*:scripted) Failed tests:
[error] 	sbt-osgi / test-08-failOnClassesExcludedFromJarStar
[error] Total time: 27 s, completed Aug 12, 2017 1:49:19 AM

Race condition in the dependencies of the osgiBundle task

The race is very well analyzed in this issue, so please read that issue completely.

The issue was introduces as part of this change

Some known documented occurence of this issue are

The applied workaround in these issues was to downgrade to sbt-osgi 0.9.4, but said version does not work with Java 17 and newer.

Here are some solutions:

  1. Fix the race. This requires very thorough understanding of sbt, which I lack
  2. Revert #64, which will result in less accurate generated manifests
  3. Introduce a new config setting to fine control how accurate we analyze dependencies to generate proper Import-Package statements. This is effectively a way to switch #64 on and off. We could default to off. Also, it should come with some documentation.

sbt 0.13

Hi,
would it be possible to add a 0.13 version for sbt for testing ?
Thanks

Release 0.9.5

Can you please release current master as 0.9.5. We long await the fixes it includes.

Fix regression when using Jar's to force proper manifest files

So I did some digging to figure out the root cause of apache/pekko#757 and I managed to bisect the change which caused the regression which happens to be #64 . When using

log.info("CONTENT IS")
log.info(content.mkString("\n"))

at https://github.com/sbt/sbt-osgi/blob/main/src/main/scala/com/typesafe/sbt/osgi/Osgi.scala#L186 and sbt protobuf-v3/osgiBundle within pekko to diagnose the content that is being packaged, without #64 you get

[info] CONTENT IS
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/BufferAllocator.class,org/apache/pekko/protobufv3/internal/BufferAllocator.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/ApiOrBuilder.class,org/apache/pekko/protobufv3/internal/ApiOrBuilder.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/RepeatedFieldBuilderV3$MessageExternalList.class,org/apache/pekko/protobufv3/internal/RepeatedFieldBuilderV3$MessageExternalList.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/Protobuf.class,org/apache/pekko/protobufv3/internal/Protobuf.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache,org/apache)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/DescriptorProtos$EnumOptions.class,org/apache/pekko/protobufv3/internal/DescriptorProtos$EnumOptions.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/NewInstanceSchemaFull.class,org/apache/pekko/protobufv3/internal/NewInstanceSchemaFull.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/CanIgnoreReturnValue.class,org/apache/pekko/protobufv3/internal/CanIgnoreReturnValue.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/SourceContextOrBuilder.class,org/apache/pekko/protobufv3/internal/SourceContextOrBuilder.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/StringValue$1.class,org/apache/pekko/protobufv3/internal/StringValue$1.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/CodedInputStream$1.class,org/apache/pekko/protobufv3/internal/CodedInputStream$1.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/EmptyOrBuilder.class,org/apache/pekko/protobufv3/internal/EmptyOrBuilder.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/DescriptorProtos$MessageOptionsOrBuilder.class,org/apache/pekko/protobufv3/internal/DescriptorProtos$MessageOptionsOrBuilder.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/Method.class,org/apache/pekko/protobufv3/internal/Method.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/RpcController.class,org/apache/pekko/protobufv3/internal/RpcController.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/UninitializedMessageException.class,org/apache/pekko/protobufv3/internal/UninitializedMessageException.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/DescriptorProtos$SourceCodeInfo$Location$1.class,org/apache/pekko/protobufv3/internal/DescriptorProtos$SourceCodeInfo$Location$1.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/CheckReturnValue.class,org/apache/pekko/protobufv3/internal/CheckReturnValue.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/UInt32ValueOrBuilder.class,org/apache/pekko/protobufv3/internal/UInt32ValueOrBuilder.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/BinaryWriter$UnsafeHeapWriter.class,org/apache/pekko/protobufv3/internal/BinaryWriter$UnsafeHeapWriter.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/DescriptorProtos$EnumValueOptionsOrBuilder.class,org/apache/pekko/protobufv3/internal/DescriptorProtos$EnumValueOptionsOrBuilder.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/Syntax$1.class,org/apache/pekko/protobufv3/internal/Syntax$1.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/ByteString$2.class,org/apache/pekko/protobufv3/internal/ByteString$2.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/Int32Value$Builder.class,org/apache/pekko/protobufv3/internal/Int32Value$Builder.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/Option.class,org/apache/pekko/protobufv3/internal/Option.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/DynamicMessage.class,org/apache/pekko/protobufv3/internal/DynamicMessage.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/Type.class,org/apache/pekko/protobufv3/internal/Type.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/DescriptorProtos$MessageOptions$1.class,org/apache/pekko/protobufv3/internal/DescriptorProtos$MessageOptions$1.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/ListFieldSchema.class,org/apache/pekko/protobufv3/internal/ListFieldSchema.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/MessageInfoFactory.class,org/apache/pekko/protobufv3/internal/MessageInfoFactory.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/MapEntryLite$Metadata.class,org/apache/pekko/protobufv3/internal/MapEntryLite$Metadata.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/type.proto,google/protobuf/type.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/Int32Value.class,org/apache/pekko/protobufv3/internal/Int32Value.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/TimestampProto.class,org/apache/pekko/protobufv3/internal/TimestampProto.class)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/org/apache/pekko/protobufv3/internal/Duration$1.class,org/apache/pekko/protobufv3/internal/Duration$1.class)
... (truncated)

where as with #64 you get

[info] CONTENT IS
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir,)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google,google)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf,google/protobuf)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/timestamp.proto,google/protobuf/timestamp.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/field_mask.proto,google/protobuf/field_mask.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/api.proto,google/protobuf/api.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/duration.proto,google/protobuf/duration.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/struct.proto,google/protobuf/struct.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/wrappers.proto,google/protobuf/wrappers.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/source_context.proto,google/protobuf/source_context.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/any.proto,google/protobuf/any.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/type.proto,google/protobuf/type.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/empty.proto,google/protobuf/empty.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/compiler,google/protobuf/compiler)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/compiler/plugin.proto,google/protobuf/compiler/plugin.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/google/protobuf/descriptor.proto,google/protobuf/descriptor.proto)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/META-INF,META-INF)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/META-INF/LICENSE,META-INF/LICENSE)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/META-INF/DISCLAIMER,META-INF/DISCLAIMER)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/META-INF/COPYING.protobuf,META-INF/COPYING.protobuf)
[info] (/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/pekko-protobuf-v3_2.13-1.1.0-M0-1-SNAPSHOT.jar_tmpdir/META-INF/NOTICE,META-INF/NOTICE)

As you can see the change means that all of the .class files end up getting stripped out of the osgi-bundle.

If we do some more digging we can see what is causing the regression, if I you do show protobuf-v3/Compile/fullClasspath which is what was used without #64 you get

[info] * Attributed(/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/stripped/stripped/pekko-protobuf-v3-assembly-1.1.0-M0-1-SNAPSHOT.jar)
[info] * Attributed(/Users/mdedetrich/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.20.3/protobuf-java-3.20.3.jar)

where as if you do show protobuf-v3/Compile/dependencyClasspathAsJars (which is with #64) you get

[info] * Attributed(/Users/mdedetrich/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.20.3/protobuf-java-3.20.3.jar)

The Attributed(/Users/mdedetrich/github/incubator-pekko/protobuf-v3/target/scala-2.13/stripped/stripped/pekko-protobuf-v3-assembly-1.1.0-M0-1-SNAPSHOT.jar) happens to be missing.

This is very likely a result of the bespoke way that we generate the jar for protobuf-v3 (see https://github.com/apache/incubator-pekko/blob/main/build.sbt#L359-L387)

@lefou Since you implemented #64 you know what the underlying motivation for the change. At least on a glance to me it seems like a quick way to fix this is to combine both (dependencyClasspathAsJars in Compile).value.map(_.data) ++ (products in Compile).value and (fullClasspath in Compile) but use (dependencyClasspathAsJars in Compile).value.map(_.data) ++ (products in Compile).value as a preference which should still solve the underlying problem described in #60 .

@raboof Maybe you can provide some underlying context here regarding the implementation of the protobuf-v3 sbt module.

@romainreuillon If you have time to look into this that would also be great.

Support for DS with _dsannotations? [Question]

I am trying get the xml generated for DS in conjunction with the org.osgi.service.component.annotations._ components (so not the aQute.bnd ones). Is this supported, aren't the instructions just passed onwards to bnd?

I have tried adding

OsgiKeys.additionalHeaders := Map(
  "_dsannotations" -> "*"
)

Working with version 0.7.0

tx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.