goomph icon indicating copy to clipboard operation
goomph copied to clipboard

Question about bundling ?

Open reyman opened this issue 6 years ago • 7 comments

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 ?

reyman avatar Dec 03 '18 22:12 reyman

but this is not the case

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

nedtwigg avatar Dec 03 '18 22:12 nedtwigg

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

reyman avatar Dec 04 '18 08:12 reyman

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

nedtwigg avatar Dec 04 '18 08:12 nedtwigg

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

reyman avatar Dec 04 '18 08:12 reyman

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.

hacki11 avatar Dec 04 '18 19:12 hacki11

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/

reyman avatar Dec 06 '18 09:12 reyman

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 https://github.com/diffplug/goomph/compare/v3.15.0...v3.16.0 https://github.com/bndtools/bnd/compare/3.5.0.REL...4.0.0.REL

hacki11 avatar Dec 09 '18 17:12 hacki11