[GRADLE-1107] OSGi instruction Include-Resource not working Created: 11/Aug/10 Updated: 10/Feb/17 Resolved: 10/Feb/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 0.9.1 |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Thomas Glaeser | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 3 |
Issue Links: |
|
Description |
According to the Bnd documentation an OSGi bundle is constructed from 3 different arguments: Export-Package Using the Include-Resource instruction seems to have no effect on the resulting bundle. This might be an documentation issue. My understanding is that Bnd uses the Include-Resource instruction to add e.g additional Java archives to an OSGi bundle. If Gradle proposes a different approach to allow the same than it would be helpful if this could be documented. |
Comments |
Comment by Hans Dockter [ 16/Aug/10 ] |
The osgi plugin does not address your use case currently. It does only generate the manifest. We will address this issue for 1.0. The workaround you have at the moment is to use the bnd ant task and then to merge the generated manifest and other files into the jar task. |
Comment by Thomas Glaeser [ 20/Sep/10 ] |
This is actually only a problem if the resource is a Java ARchive that shall get embedded into the OSGi bundle. Simple resources can just be added to the production resources source set and will be automatically added to the OSGi bundle from there. For JAR resources two things have to happen to get this working.
In order to separate the embedded JARs from the provided once I'm proposing the addition of two more configurations to the OSGi Plugin:
My understanding is that the runtime configuration should not be extended by embeddedRuntime, only compile should be extended by embeddedCompile as the associated artifacts are embedded and only available via the bundle classpath. If interested, I can provide the code for this change. Also note that AFAIK this change will require the OSGi plugin to directly apply the Java plugin. |
Comment by Thomas Glaeser [ 26/Sep/10 ] |
In contrast to the POJO world where the runtime configuration is just an ordered list of containers, in OSGi, the containers from the runtime classpath itself can be ordered lists of container paths. The effective bundle classpath will be calculated based on headers Bundle-Classpath and Fragment-Host. Therefore it is probably required to introduce a new osgiRuntime configuration. In a scenario where all of the containers from the effective bundle classpath are Java ARchives, the new osgiRuntime configuration could be constructed from the entries found in configurations runtime and embeddedRuntime. In a scenario where the effective bundle classpath contains Java Package entries, the osgiRuntime configuration would have to become Java Package sensitive. |
Comment by Thomas Glaeser [ 26/Sep/10 ] |
Consequences of the previously said are that additional bundleRuntime* configurations are needed beyond the osgiRuntime configuration. In a POJO world:Configuration embeddedCompile SHALL NOT be part of the runtime configuration:
This has a side effect on the IDE plugins as the libraries from the embeddedCompile configuration have to be available in the IDE In OSGi:The OSGi plugin needs to dynamically create additional bundleRuntime* configurations:
|
Comment by Hans Dockter [ 29/Sep/10 ] |
Thanks a lot for explaining the issue. One generic improvement for this will be our upcoming dependency DSL which enables to easily subtract, filter, ... dependency configurations. We will also add some other constructs that might provide alternative to using configurations for modeling this. Kind of similar to the 'provided' problem of container apps. |
Comment by Thomas Glaeser [ 07/Dec/10 ] |
It appears to me that we also need configurations
representing the OSGi Execution Environment. |
Comment by Thomas Glaeser [ 13/Dec/10 ] |
After comparing different container apps, it is now clear to me that the initially proposed embedded* configurations would be the wrong approach Instead the following configurations would make sense in an OSGi world:
I'm unsure about the naming for the supply* configurations. There might be another terminology matching this configuration better!? |
Comment by Thomas Glaeser [ 22/Mar/11 ] |
The issue was discussed via gradle-dev as well under subject "Gradle's OSGi plugin". Adam propose the following approach:
This approach allows:
|
Comment by Thomas Glaeser [ 22/Mar/11 ] |
I like Adam's proposal a lot. The questions is still how to describe your target environment - what is provided by the container, what needs to be supplied to the container when deploying into it, and what will be available embedded only!? |
Comment by Todor Boev [ 15/Nov/11 ] |
I am adding additional comments prompted by our use of the OSGi gradle plugin: Currently BND is used only to calculate the bundle manifest. This means that none of BND powerful packaging capabilities are used. Here are some use-cases:
In short BND is not a manifest calculator but a powerful bundle building tool and it is a good idea for us to support it to it's full extent. |
Comment by Szczepan Faber [ 17/Nov/11 ] |
The goals and potential implementation plan is described at the thread: http://gradle.1045684.n5.nabble.com/Gradle-s-OSGi-plugin-td3408224.html |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Benjamin Muschko [ 10/Feb/17 ] |
Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved. |