Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about bundling ? #89

Open
reyman opened this issue Dec 3, 2018 · 7 comments
Open

Question about bundling ? #89

reyman opened this issue Dec 3, 2018 · 7 comments
Labels

Comments

@reyman
Copy link

reyman commented Dec 3, 2018

Hi

I'm upgrading the GenStar repository with latest version of goomph plugin 1.7.0, and i see something strange.

I have a specific way to bundle my sources after compilation, i use this bnd to create a manifest :


// configure the OSGi bundle
jar.manifest.attributes(
        //'-exportcontents': 'core.*, gospl.*, spin.*, spll.*, gaml.*, genstar.*',
        '-removeheaders': 'Bnd-LastModified,Bundle-Name,Created-By,Tool,Private-Package,Require-Capability',
        'Conditional-Package': '!org.w3c.*, !org.xml.*, !javax.*, !org.jfree.*, !org.graphstream.*, !msi.*, *',
        'Import-Package': '!*',
        'Require-Bundle': 'msi.gama.core',
        'Export-Package': 'gama.genstar.plugin',
        'Bundle-Version': '1.0.0.${tstamp;yyyyMMddHHmm}',
        'Bundle-SymbolicName': project.name +";singleton:=true",
        'Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8',
        'Require-Capability': 'osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"',
        'Bundle-Vendor': 'Gama team',
        'Bundle-License': "http://www.apache.org/licenses/LICENSE-2.0"
)

osgiBndManifest {
    copyTo 'META-INF/MANIFEST.MF'
}

Normally this code generate a big Jar with all java classes statically linked when i run gradle build ( effect of conditional Package option), but this is not the case.

Any idea ? Some bugs ?

@nedtwigg
Copy link
Member

nedtwigg commented Dec 3, 2018

but this is not the case

What is it doing instead? An empty jar? An exception?

@reyman
Copy link
Author

reyman commented Dec 4, 2018

I have only the java class file from the src into the jar, and not all the class dependencies required by the static linking.

@nedtwigg
Copy link
Member

nedtwigg commented Dec 4, 2018

I think we'll need to see where you modify the jar task. I bet it has to do with changes from #79.

@reyman
Copy link
Author

reyman commented Dec 4, 2018

ok, i push my latest files, see the project in this branch into gradlebuild/genstar.plugin.bundle-all folder : https://github.com/ANRGenstar/gamaplugin/tree/dissociateLocalCompilation

@hacki11
Copy link
Contributor

hacki11 commented Dec 4, 2018

i can not reach the given repository, can't run a build.

never used this mechanism to include the dependency, is it possible to include the dependencies like described here:
https://discuss.diffplug.com/t/parting-out-eclipse/49

// embed the eclipse jars into our "fat jar"
jar {
    from {
        configurations.embeddedJars.collect { it.isDirectory() ? it : zipTree(it) }
    }
    // the eclipse jars are signed, and our fat jar breaks the signatures
    // so we've gotta be sure to filter out the signatures
    exclude 'META-INF/*.RSA'
    exclude 'META-INF/*.SF'
}

we are using the shadow plugin to embed our eclipse dependencies in our bundles. can provide some code if you want.

@reyman
Copy link
Author

reyman commented Dec 6, 2018

Hi @hacki11 , strange that repository is not accessible, probably a mistake in the build, i check that today.

The solution you propose take all jar and zip ip into one jar. In my case this answer is not possible because the jar is very very fat. "Static linking" is very different, during bundle phase the system put into jar only the java *.class needed during compilation of the plugin. see https://bnd.bndtools.org/instructions/conditionalpackage.html & https://blogs.paremus.com/2014/05/static-linking-in-osgi/

@hacki11
Copy link
Contributor

hacki11 commented Dec 9, 2018

can confirm the behavior and brought it down to release 3.16.0.
Something was changed from 3.15.0 to 3.16.0, did not found the issue yet.
e.g. bndlib version change from 3.5 to 4.0
v3.15.0...v3.16.0
bndtools/bnd@3.5.0.REL...4.0.0.REL

@nedtwigg nedtwigg added the bug label Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants