Closed bartdag closed 8 years ago
I admit I never tried adding a Java project directly to the platform. Really awesome that it actually works like this :grinning:
Does the rest work fine? i.e. are the instructions correctly represented in the bundle manifest?
Some of the settings you specify in the bnd-Closure are actually plugin settings, I'm not sure if they will work properly in there. Could you move those up to the platform call like this?
platform {
fetchSources = true
addQualifier = true
eclipseHome = new File(eclipseHomePath)
featureId = 'org.py4j.feature'
featureName = 'Py4J Library'
featureVersion = bundleVersion
featureProvider = 'Py4J'
categoryId = 'py4j'
categoryName = 'Py4J'
bundle project
bnd(project) {
symbolicName = 'py4j-java'
bundleName = 'py4j-java'
version = bundleVersion
instruction 'Eclipse-BuddyPolicy', 'global'
instruction 'Import-Package', '!javax.net'
instruction 'Export-Package', 'py4j,py4j.commands,py4j.model,py4j.reflection'
instruction 'Bundle-RequiredExecutionEnvironment', 'JavaSE-1.6'
instruction 'Bundle-Description', 'Bridge between Python and Java'
instruction 'Bundle-DocURL', 'http://www.py4j.org'
}
}
Can you provide a link to a repo for your project? Then I might be able to take a look during the weekend how this could be made to work (if the configuration change does not help).
Hi, thanks for your quick response. I admit I discovered how to add a java project directly to the platform after many trials and errors :-)
I moved the settings but it still did not create a source bundle. You can see the whole project here: https://github.com/bartdag/py4j/tree/gradle (the gradle config is in the gradle branch for now).
You can build the project like this:
cd py4j-java
gradle assemble
gradle bundles
gradle updateSite
As far as I can tell, the osgi bundle is valid and I can import it in Eclipse and other plugins can use it.
Hi, did you have time to look into this issue? Thanks!
Hi. I had a look at it. The mechanism that I use for getting the sources seems to only work for external dependencies. At this point I'm not sure how I could find the source Jar for the project based on the dependency.
A workaround is the following:
bundle tasks.jar.outputs.files, {
bnd {
...
}
}
bundles
task is executed after the Jar is created, e.g.tasks.bundles.dependsOn('assemble')
configurations {
platform {
extendsFrom compile
}
}
I tried this on your project with success, see my fork here: https://github.com/stempler/py4j/tree/gradle-wa1 The way you added the dependency is definitely the more elegant way, I'm open to ideas to include the source Jar in a different way, using the Gradle API.
Thanks a lot for you help, that seems to work. I'm not familiar with gradle subprojects, but would having a global project that depends on subprojects (e.g., py4j that would depend on py4j-java and py4j-python) makes it look like an external dependency?
No, that would still be project dependencies, with transitive project dependencies probably complicating it more. I did a few more attempts yesterday to solve the issue in a better way, but always had problems when it came to resolving sources for project dependencies. As a workaround I tried also letting the bundles task depend on the install task, and adding the dependency by group and name to the platform configuration. That was a way of trying to externalise it. But that failed because it seems to be a conflict to have an external dependency that is the same group and name as a project. Thus externalising it is probably only possible when using two different builds.
Hi, I am trying to generate a source bundle for my current gradle project, but I am not sure how to proceed. The
bundles
andupdateSite
tasks create a bundle/feature/update site for the jar defined in my project, but it does not create a corresponding source bundle.I am using bnd-platform 1.3 and gradle 2.11 on Java 8 (Mac OSX).
My platform config:
The sources jar generated for my project:
Thank you for this great gradle plug-in!