Bug 309884 - Feature export from workspace is problematic
Summary: Feature export from workspace is problematic
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 RC2   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 312278 313388
Blocks:
  Show dependency tree
 
Reported: 2010-04-20 18:08 EDT by Samuel Wu CLA
Modified: 2010-05-21 11:21 EDT (History)
4 users (show)

See Also:
aniefer: review+
curtis.windatt.public: review+


Attachments
Log file (893 bytes, text/plain)
2010-04-20 18:08 EDT, Samuel Wu CLA
no flags Details
Screen shot (468.75 KB, image/jpeg)
2010-04-20 18:10 EDT, Samuel Wu CLA
no flags Details
Product properties file (1.80 KB, text/plain)
2010-04-20 18:18 EDT, Samuel Wu CLA
no flags Details
patch (1.43 KB, patch)
2010-05-17 15:21 EDT, Darin Wright CLA
no flags Details | Diff
suggested change (1.50 KB, patch)
2010-05-18 12:05 EDT, Andrew Niefer CLA
no flags Details | Diff
updated patch (1.67 KB, patch)
2010-05-18 13:45 EDT, Darin Wright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Wu CLA 2010-04-20 18:08:22 EDT
Build Identifier: Build id: N20100419-2000

failed to export a product

Reproducible: Always

Steps to Reproduce:
1. Start eclipse SDK and create a product file my_pdt.product
2. Export the product with the option Generate Metadata Repository checked
3. Got the following error message 
Processing inclusion from feature org.eclipse.platform: Unable to find plug-in: org.eclipse.platform_3.6.0.v201004192000. Please check the error log for more details.
Comment 1 Samuel Wu CLA 2010-04-20 18:08:59 EDT
Created attachment 165507 [details]
Log file
Comment 2 Samuel Wu CLA 2010-04-20 18:10:01 EDT
Created attachment 165508 [details]
Screen shot
Comment 3 Samuel Wu CLA 2010-04-20 18:18:28 EDT
Created attachment 165509 [details]
Product properties file
Comment 4 Curtis Windatt CLA 2010-04-22 15:58:57 EDT
Investigate in RC1.
Comment 5 Curtis Windatt CLA 2010-05-10 14:17:30 EDT
cc'ing Andrew.

The org.eclipse.platform plug-in must be included in the workspace, but it doesn't get put in the exported product, making it unavailable for the publisher.  The assemble script points to the correct workspace plug-in though, so I don't know why it isn't included.

I thought it might be a version mismatch because the script includes both the feature and the plug-in, but the export requires that the plug-in version matches the setting in the feature.xml.
Comment 6 Samuel Wu CLA 2010-05-10 14:39:09 EDT
I tried the same thing with 3.6M7 and it works fine now. I don't mind if you close this bug.
Comment 7 Chris Aniszczyk CLA 2010-05-10 14:40:09 EDT
Thanks.
Comment 8 Curtis Windatt CLA 2010-05-10 14:54:38 EDT
Reopening.  I can reproduce using the file provided.  Removing the milestone and reducing the severity because it isn't occurring for the original reporter.

1) Get the attached file into a project in your workspace
2) Try to export it, fails because the bundle containing the product isn't modifiable
3) Import org.eclipse.platform as a binary plug-in
4) Try to export it, fails on metadata generation

The metadata generation fails because the plug-in does not exist in the export.  I do not know why the plug-in is missing from the export as the assemble script specifies the correct location.
Comment 9 Darin Wright CLA 2010-05-17 14:21:17 EDT
I ran into a similar problem:

* import "org.eclipse.jdt-feature" from CVS
* I have many of the assocaited plug-ins as projets in my workspace
* For any project that is in my workspace I get errors like:

"Processing inclusion from feature org.eclipse.jdt: Unable to find plug-in: org.eclipse.jdt.debug.ui_3.5.0.v20100503. Please check the error log for more details."

It seems like its trying to find a specific version of each plug-in that is in my target platform, even though it's in my workspace as a project.
Comment 10 Darin Wright CLA 2010-05-17 15:16:27 EDT
Problem arises when exporting a feature from the workspace that exist in the target platform as well. When this happens, two versions of the feature are available that point to different versions of bundles. The workspace feature points to version 0.0.0 of bundles, and the external feature points to specific versions of bundles in the target.

PDE build can end up choosing the external feature to build (it looks up the features in a tree, which has a list of all features available for the feature id - and happens to take the first match, which may be the external feature).
Comment 11 Darin Wright CLA 2010-05-17 15:21:25 EDT
Created attachment 168803 [details]
patch

This patch merges workspace features with external features so only one version of the features are present. Workspace features take precedence since that is all we allow users to export from the UI.
Comment 12 Darin Wright CLA 2010-05-17 15:22:08 EDT
Relies on bug 312278 that exposes workspace/external features in the feature model manager.
Comment 13 Andrew Niefer CLA 2010-05-17 15:42:52 EDT
(In reply to comment #10)

> PDE build can end up choosing the external feature to build (it looks up the
> features in a tree, which has a list of all features available for the feature
> id - and happens to take the first match, which may be the external feature).

This tree is expected to be sorted by version, so we should be taking the highest versioned feature.  Note that "qualifier" is a lower version than v2010...
Comment 14 Andrew Niefer CLA 2010-05-17 15:48:15 EDT
(In reply to comment #13)
> Note that "qualifier" is a lower version than v2010...
Sorry, "qualifier" is irrelevant, at this point the "qualifier" has already been replaced with the actual version.  But 0-9 (default timestamps) < v
Comment 15 Darin Wright CLA 2010-05-18 10:31:55 EDT
Since PDE only allows the user to select from features in the workspace (when exporting features) PDE should only be passing the workspace features to PDE build.

Note that this patch relies on the patch from bug 312278 as well.
Comment 16 Andrew Niefer CLA 2010-05-18 11:58:01 EDT
What happens if the workspace contains more than one project with the same feature-id?  If there are other projects with the same feature-id as the one we are exporting, we would need to ensure that the one we are exporting is the one that is in the map.
Comment 17 Andrew Niefer CLA 2010-05-18 12:05:04 EDT
Created attachment 168961 [details]
suggested change

This patch adds all the workspace models where the previous would have lost some models if the id was the same.  Export should be passing build the preferred version of the feature to export so we should be ok with multiple versions there.

I haven't run this patch myself.
Comment 18 Darin Wright CLA 2010-05-18 13:45:42 EDT
Created attachment 168978 [details]
updated patch

The suggested change caused an array store exception attempting to copy feature models into a string array. Fixed.

java.lang.ArrayStoreException
at java.lang.System.arraycopy(Native Method)
at org.eclipse.pde.internal.core.exports.FeatureExportOperation.getPaths(FeatureExportOperation.java:803)
at org.eclipse.pde.internal.core.exports.FeatureExportOperation.setupGenerator(FeatureExportOperation.java:673)
at org.eclipse.pde.internal.core.exports.FeatureExportOperation.doExport(FeatureExportOperation.java:257)
at org.eclipse.pde.internal.core.exports.FeatureExportOperation.doExport(FeatureExportOperation.java:225)
at org.eclipse.pde.internal.core.exports.FeatureExportOperation.run(FeatureExportOperation.java:109)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 19 Andrew Niefer CLA 2010-05-18 14:26:54 EDT
Sorry Darin, I just noticed this obvious mistake myself when I tried doing an export with it.  I was just about to re-attach a fixed patch, which turns out to be identical to yours.
Comment 20 Curtis Windatt CLA 2010-05-18 16:21:07 EDT
+1 Fixed in HEAD.
Comment 21 Darin Wright CLA 2010-05-21 11:21:46 EDT
Verified.