Bug 240821 - Binary projects/imported bundles result in nested jars during build
Summary: Binary projects/imported bundles result in nested jars during build
Status: RESOLVED WONTFIX
Alias: None
Product: PDE
Classification: Eclipse Project
Component: Build (show other bugs)
Version: 3.4.1   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: pde-build-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 267180 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-15 08:55 EDT by Markus Kuppe CLA
Modified: 2018-12-03 09:06 EST (History)
5 users (show)

See Also:


Attachments
draft patch (13.07 KB, patch)
2008-07-17 10:11 EDT, Markus Kuppe CLA
no flags Details | Diff
mylyn/context/zip (58.60 KB, application/octet-stream)
2008-07-17 10:11 EDT, Markus Kuppe CLA
no flags Details
revised patch (7.45 KB, patch)
2008-07-18 08:42 EDT, Markus Kuppe CLA
no flags Details | Diff
mylyn/context/zip (6.33 KB, application/octet-stream)
2008-07-18 08:42 EDT, Markus Kuppe CLA
no flags Details
as per previous comments yet again a revised patch (6.81 KB, patch)
2008-07-25 07:30 EDT, Markus Kuppe CLA
no flags Details | Diff
mylyn/context/zip (25.26 KB, application/octet-stream)
2008-07-25 07:31 EDT, Markus Kuppe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Kuppe CLA 2008-07-15 08:55:00 EDT
If a bundle is imported into the workspace and then used in a subsequent build,
PDE will create a jar for the bundle that contains the bundle itself. This doesn't cause a problem during build time, but at runtime.

Setting to major as it results in an unstartable product.

FYI Buckminster had the same problem and came up with a fixed in #212411
Comment 1 Markus Kuppe CLA 2008-07-17 09:55:33 EDT
Why isn't an imported bundle just extracted into the workspace and a builder-less .project and .classpath generated? During bundle export the disc contents then simply needs to be jarred again.
Comment 2 Markus Kuppe CLA 2008-07-17 10:11:19 EDT
Created attachment 107738 [details]
draft patch

This is my current take and I wonder if I'm on the right track so don't spare me with early feedback. :)

I know it has a couple of limitations:

- Utils.isBinaryProject(BundleDescription) isn't bullet proof yet
- non archived product export is broken (unpack is ignored)
- https://issues.apache.org/bugzilla/show_bug.cgi?id=42122 causes the extrated jar to have 000 permissions
- subsequent exports fail
- ...

patch applies against 3_4_maintenance
Comment 3 Markus Kuppe CLA 2008-07-17 10:11:24 EDT
Created attachment 107739 [details]
mylyn/context/zip
Comment 4 Markus Kuppe CLA 2008-07-18 08:42:06 EDT
Created attachment 107822 [details]
revised patch

This one works for us in our fairly complex product build (multi platform + archived and non archived product + update site). And even all the pde build tests pass. :)

However, if a feature sets unpack=true for a jarred bundle (either originating from target platform or binary project), pde fails. We probably want to file a separate bug since this isn't directly related to this one.
Comment 5 Markus Kuppe CLA 2008-07-18 08:42:12 EDT
Created attachment 107823 [details]
mylyn/context/zip
Comment 6 Andrew Niefer CLA 2008-07-23 16:56:29 EDT
Chris, Can you comment on the format of the project for the imported binary plugin.  This patch essentially tries to identify such projects, and then copies the nested jar instead of using the project itself.

One alternative would be for UI to identify such projects for us.  And provide the info in a map akin to the existing classpath & patch data set in FeatureExportOperation.setupGenerator's call generator.setStateExtraData.  Also, what about binary projects with linked content?    This could cover both cases if UI told us the location of the real jar.

Re: Comment #4 & unpack=true for jarred bundles, this is a long-standing problem.  I meant to look at it in 3.4, but it slipped.


Other Initial comments are:
Utils.isBinaryProject:
a) patch contains an extra "findDeltaPack" in Utils, leading to a compile error (gfindDeltaPacket)

b) Moot if UI provides the binary info, but Bundle-Classpath headers are already stored in PDEState.bundleClasspaths by bundleId.  We do not need to read the manifests again here.  (Note also, Properties should not be used to read manifests, it wouldn't handle the line continuations, can use ManifestElement.parseBundleManifest instead).

PackageConfigScriptGenerator:
- The last line changed (in the feature loop) is not an equivalent change.  This is a mistake?



Comment 7 Chris Aniszczyk CLA 2008-07-23 17:14:26 EDT
The respective code in UI that identifies such projects is in:

org.eclipse.pde.internal.core.WorkspaceModelManager.isBinaryProject(IProject)

During import, we mark projects as binary by setting a persistent property on the project. So Andrew, we could easily pass this info to you if need be, just let me know where to do it.
Comment 8 Markus Kuppe CLA 2008-07-24 16:53:09 EDT
(In reply to comment #6)
> Chris, Can you comment on the format of the project for the imported binary
> plugin.  This patch essentially tries to identify such projects, and then
> copies the nested jar instead of using the project itself.
> 
> One alternative would be for UI to identify such projects for us.  And provide
> the info in a map akin to the existing classpath & patch data set in
> FeatureExportOperation.setupGenerator's call generator.setStateExtraData. 

Does this work in headless mode where PDEUIState is null?

> Also, what about binary projects with linked content?    This could cover both
> cases if UI told us the location of the real jar.

Indeed, the current patch hasn't been tested with linked content.

> 
> Re: Comment #4 & unpack=true for jarred bundles, this is a long-standing
> problem.  I meant to look at it in 3.4, but it slipped.

Is there a bug open that tracks this issue? I have a partial patch lying around that handles this scenario partially.

> Other Initial comments are:
> Utils.isBinaryProject:
> a) patch contains an extra "findDeltaPack" in Utils, leading to a compile error
> (gfindDeltaPacket)

s/gfindDeltaPacket/getProperty

> 
> b) Moot if UI provides the binary info, but Bundle-Classpath headers are
> already stored in PDEState.bundleClasspaths by bundleId.  We do not need to
> read the manifests again here.  (Note also, Properties should not be used to
> read manifests, it wouldn't handle the line continuations, can use
> ManifestElement.parseBundleManifest instead).

Perfect, I wasn't aware of that API. I'll revise the patch again.

> PackageConfigScriptGenerator:
> - The last line changed (in the feature loop) is not an equivalent change. 
> This is a mistake?

Yep, damn you cut&replace.



Comment 9 Markus Kuppe CLA 2008-07-25 07:30:39 EDT
Created attachment 108432 [details]
as per previous comments yet again a revised patch
Comment 10 Markus Kuppe CLA 2008-07-25 07:31:01 EDT
Created attachment 108433 [details]
mylyn/context/zip
Comment 11 Chris Aniszczyk CLA 2008-12-14 21:23:13 EST
Any thoughts about this one for 3.5 Andrew?
Comment 12 Markus Kuppe CLA 2009-01-19 04:52:48 EST
(In reply to comment #11)
> Any thoughts about this one for 3.5 Andrew?

I'm not Andrew, but FWIW with bug #258820 and bug #260831 fixed in Buckminster, Versant doesn't need this fix any longer.
Comment 13 Andrew Niefer CLA 2009-06-19 16:39:26 EDT
*** Bug 267180 has been marked as a duplicate of this bug. ***
Comment 14 Lars Vogel CLA 2018-12-03 09:06:19 EST
Currently we are not actively enhancing PDE build anymore. Therefore, I close this bug as WONTFIX. 

Please reopen, if you plan to provide a fix.