diffplug / goomph

IDE as build artifact
Apache License 2.0
130 stars 30 forks source link

Question about bundling ? #89

Open reyman opened 5 years ago

reyman commented 5 years ago

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 commented 5 years ago

but this is not the case

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

reyman commented 5 years ago

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 commented 5 years ago

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

reyman commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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