Giter Club home page Giter Club logo

Comments (6)

stempler avatar stempler commented on June 4, 2024

I admit I never tried adding a Java project directly to the platform. Really awesome that it actually works like this 😀

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).

from bnd-platform.

bartdag avatar bartdag commented on June 4, 2024

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.

from bnd-platform.

bartdag avatar bartdag commented on June 4, 2024

Hi, did you have time to look into this issue? Thanks!

from bnd-platform.

stempler avatar stempler commented on June 4, 2024

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:

  • Add the project Jar as a file dependency (then the source is automatically picked up based on the name)
bundle tasks.jar.outputs.files, {
  bnd {
    ...
  }
}
  • You also need to make sure that the bundles task is executed after the Jar is created, e.g.
tasks.bundles.dependsOn('assemble')
  • Include project dependency configurations in platform configuration, if applicable, to include the project's dependencies in the update site
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.

from bnd-platform.

bartdag avatar bartdag commented on June 4, 2024

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?

from bnd-platform.

stempler avatar stempler commented on June 4, 2024

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.

from bnd-platform.

Related Issues (20)

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.