Bug 365799 - [product] Launching from feature based product editor does not include required features
Summary: [product] Launching from feature based product editor does not include requir...
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.8 M6   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 278431 (view as bug list)
Depends on:
Blocks: 372373
  Show dependency tree
 
Reported: 2011-12-06 14:38 EST by Brian de Alwis CLA
Modified: 2012-03-23 13:25 EDT (History)
4 users (show)

See Also:


Attachments
Patch to cause feature-based products to create feature-based launches (5.61 KB, patch)
2012-02-23 13:58 EST, Brian de Alwis CLA
no flags Details | Diff
Alternative approach to populate bundle list by processing imported (required) features (1.72 KB, patch)
2012-02-29 10:51 EST, Brian de Alwis CLA
no flags Details | Diff
Screenshot (22.01 KB, image/png)
2012-03-14 10:33 EDT, Lars Vogel CLA
no flags Details
Screenshot after pressing add required again (19.89 KB, image/png)
2012-03-14 10:33 EDT, Lars Vogel CLA
no flags Details
Example project to test (17.24 KB, application/zip)
2012-03-14 10:34 EDT, Lars Vogel CLA
no flags Details
Example Project (16.71 KB, application/zip)
2012-03-17 17:26 EDT, Lars Vogel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brian de Alwis CLA 2011-12-06 14:38:12 EST
Version: 4.2.0 (for M4)

Getting a simple RCP product to launch is somewhat complicated in 4.2.  With Platform-UI now being based on EMF, RCP apps can no longer simply include the Platform RCP feature (org.eclipse.rcp) and expect things to work.

Part of the problem is that the two Platform UI RCP features (org.eclipse.rcp and org.eclipse.e4.rcp) are a bit broken (see bug 362147).  But even once those features are restructured, we have some difficulties as these features rely on EMF, but at the request of the EMF team (see bug 356644) these must be expressed as feature dependencies, not inclusions, and so are not automatically pulled in.

I have also seen other RCP apps using dependencies to pull in things like p2.

It would be helpful if the PDE Product editor's "Dependencies" tab had a button to "Add Required Features" that would trawl the feature dependencies.  Something like the Feature editor's computed feature dependencies.
Comment 1 Brian de Alwis CLA 2012-01-27 11:23:56 EST
Actually, I think the product editor should be including the required features.  p2 seems to do the right thing.
Comment 2 Lars Vogel CLA 2012-01-27 11:35:11 EST
This bug is hunting me for years now, without me being able to reproduce it. Thanks for nailing it down!
Comment 3 Curtis Windatt CLA 2012-02-23 11:09:55 EST
This impacts the ability to launch products in 4.2, needs investigation.
Comment 4 Curtis Windatt CLA 2012-02-23 11:46:54 EST
There are two solutions here:

1) Add a 'add required features' button to the editor. The user would have to recognize that some dependencies were not satisfied and use the button to add what was missing.

2) When using a feature based product editor, the launch button would create a launch configuration that used a feature based launch configuration. The feature based launch configs calculate any missing dependencies and add them to the launched bundles.

Solution (1) is more in line with how the product editor is expected to work. When using a plug-in based product, users want strict control over what is included in their product. Solution (2) makes it easier for users to launch (and export assuming we fixed that as well), but the user would no longer have control over what features/bundles their product ended up containing.
Comment 5 Lars Vogel CLA 2012-02-23 12:25:22 EST
@Curtis: I think the desired solution would be:

3.)If the launch configuration is updated via the product, it checks if a feature is defined as dependent in another feature and adds the included plug-ins in the dependent feature to the launch configuration.

This means also to happen during product export.
Comment 6 Curtis Windatt CLA 2012-02-23 12:44:45 EST
(In reply to comment #5)
> @Curtis: I think the desired solution would be:
> 
> 3.)If the launch configuration is updated via the product, it checks if a
> feature is defined as dependent in another feature and adds the included
> plug-ins in the dependent feature to the launch configuration.
> 
> This means also to happen during product export.

To me this sounds like the worst of both (1) and (2). The user creating the product would have no control over what bundles end up in their target and we would have to try to make a complete list of required bundles each time we update the product (feature based launches handle this much better).
Comment 7 Brian de Alwis CLA 2012-02-23 13:58:42 EST
Created attachment 211529 [details]
Patch to cause feature-based products to create feature-based launches

The attached patch modifies org.eclipse.pde.internal.ui.launcher.LaunchAction to create a feature-based launch configuration for feature-based products.  I didn't see anywhere for tests?

(It also includes a minor optimization to FeatureModelManager.findFeatureModel() to avoid doing a lookup on empty version string.)
Comment 8 Lars Vogel CLA 2012-02-23 17:00:33 EST
@Curtis: Thanks for the explanation, I just assumed that doing this is much faster then changing to feature based runtime configuration. I didn't know that Brian would be that fast. :-)
Comment 9 Brian de Alwis CLA 2012-02-29 10:51:26 EST
Created attachment 211814 [details]
Alternative approach to populate bundle list by processing imported (required) features

From talking to Curtis on IRC, one concern about creating a feature-based launcher is that the feature launcher's behaviour of automatically adding required features may not match the result produced by a product builder.

This patch instead just fixes the current behaviour to also include the plugins required by any imported features.
Comment 10 Curtis Windatt CLA 2012-02-29 16:16:32 EST
*** Bug 278431 has been marked as a duplicate of this bug. ***
Comment 11 Curtis Windatt CLA 2012-02-29 16:28:41 EST
I have pushed a fix to master that adds an Add Required button to the feature based product editor. This combined with the validate button in the toolbar should make it easier for users to add the requirements they are missing.

(In reply to comment #9)
> This patch instead just fixes the current behaviour to also include the plugins
> required by any imported features.

This approach still goes against my main concern with changing the launch type. The patch bring in new things to the launch that aren't specified in the product configuration.  PDE assumes that the user creating the product configuration wants strict control over what goes into the product.

I am closing this as fixed, but I would appreciate feedback from Brian and Lars.  Brian's first patch is great for simplifying the launch, but it goes against the assumptions we make about the user.
Comment 12 Lars Vogel CLA 2012-03-01 03:15:48 EST
@Curtis: Personally I like the solution. This would have the launch config consistent with the product export.

Only briefly related it that I would like to see that the "Validate" flag is enabled per default, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=272076. This might also help to identify issues with feature based products. I also feel that the performance overhead is relatively small and Exports could disable it.
Comment 13 Lars Vogel CLA 2012-03-01 03:18:01 EST
@Curis: One additional point: I think that creating a feature based launch config would be consistent with the product definition. Perhaps you can use a modified version of Brians Feature patch (without adding the dependent feature automatically)?
Comment 14 Curtis Windatt CLA 2012-03-01 10:00:14 EST
(In reply to comment #13)
> @Curis: One additional point: I think that creating a feature based launch
> config would be consistent with the product definition. Perhaps you can use a
> modified version of Brians Feature patch (without adding the dependent feature
> automatically)?

The feature based launch always drags in additional dependencies, that is its primary selling point. Clearly the feature launch logically matches up with a feature based product.  However, there is currently no way to have a feature launch config results match the export results.

At this point I can't commit to working on fixing that. An alternative would be to look at a product based config (bug 326059) that would do a much better job keeping in sync.
Comment 15 Brian de Alwis CLA 2012-03-02 08:44:21 EST
I'm fine with Curtis' solution.  Thank you for doing it, Curtis.

I'll note that a p2-based builds deviate from traditional PDE/Build and the export functions in that p2 does install dependent features and bundles — the product-specified IUs are roots to be installed, and not the limited set to be installed.  I've opened bug 373089 to document this — it seems important information.
Comment 16 Lars Vogel CLA 2012-03-12 09:45:32 EDT
Just tested this in the latest integration build. Works well!

@Curtis: Thanks a lot for this enhancement
Comment 17 Curtis Windatt CLA 2012-03-13 15:32:02 EDT
Verified 

Version: 4.2.0
Build id: I20120313-0610
Comment 18 Lars Vogel CLA 2012-03-14 10:33:06 EDT
If I press "Add required" in the current build the number of included features changes. See screenshots
Comment 19 Lars Vogel CLA 2012-03-14 10:33:28 EDT
Created attachment 212653 [details]
Screenshot
Comment 20 Lars Vogel CLA 2012-03-14 10:33:47 EDT
Created attachment 212654 [details]
Screenshot after pressing add required again
Comment 21 Lars Vogel CLA 2012-03-14 10:34:32 EDT
Created attachment 212655 [details]
Example project to test
Comment 22 Curtis Windatt CLA 2012-03-14 15:58:18 EDT
I think this is a separate bug.  Typically I cannot reproduce the problem, the correct required bundles are added and pressing the button additional times changes nothing.  However, occasionally I get in a situation where pressing 'add required' or other buttons removes some of the entries.  In this case if I keep pressing the button I will eventually end up with nothing in the table.
Comment 23 Curtis Windatt CLA 2012-03-14 16:06:45 EDT
There is a problem with the button switch statement missing a break.  This means that if you have a selection and hit add required you also delete the selection.

I have pushed a fix for this.

However, I have on occasion seen other similar problems in the product editor.  Cases where the table and backing product model get out of synch so adding/removing doesn't do what you expect.  Closing and reopening the editor solves the issue.  I've never come up with a reproducible test case though, so if my fix for the switch doesn't solve your issue, let me know what your steps are.
Comment 24 Lars Vogel CLA 2012-03-17 17:23:10 EDT
Thanks Curtis, the included features seem stable to me now. 

I noticed that org.eclipse.e4.rcp is included if I press "Add Required" features. I don't think it is required, if I delete it the product still starts.

I attached a new example for you to look at.
Comment 25 Lars Vogel CLA 2012-03-17 17:26:40 EDT
Created attachment 212826 [details]
Example Project
Comment 26 Brian de Alwis CLA 2012-03-18 08:40:41 EDT
(In reply to comment #24)
> I noticed that org.eclipse.e4.rcp is included if I press "Add Required"
> features. I don't think it is required, if I delete it the product still
> starts.

If you're running on 4.2, then org.eclipse.e4.rcp *is* required.  Take a look at the org.eclipse.rcp definition: it hardly includes any bundles.
Comment 27 Lars Vogel CLA 2012-03-18 12:36:17 EDT
@Brian: Why doesn't the start fail, if I don't include it?
Comment 28 Brian de Alwis CLA 2012-03-18 20:15:21 EDT
(In reply to comment #27)
> @Brian: Why doesn't the start fail, if I don't include it?

Possibly because you already have a launch configuration that had the appropriate bundles already present?  And possibly that configuration was feature-based?

I just tested that the e4 contacts demo, which only included org.eclipse.e4.rcp and org.eclipse.e4.demo.contacts.feature, fails to start as the EMF features weren't listed.  Adding the two EMF features with "Add Required" allows the product to be launched.  (Now fixed in the repo.)
Comment 29 Lars Vogel CLA 2012-03-19 02:45:33 EDT
@Brian: We might be talking different things here. My last example in this bug is an Eclipse 3.x app running in comp layer. 

As far as I know org.eclipse.rcp has be upgraded to support this without adding the org.eclipse.e4.rcp feature. 

For the missing EMF features in org.eclipse.rcp I have opened Bug 372373.
Comment 30 Curtis Windatt CLA 2012-03-23 12:20:36 EDT
The add required action is searching for both feature dependencies and feature includes.  While org.eclipse.rcp doesn't depend on org.eclipse.e4.rcp, it does include it.  We assume that if it is included in a feature in your product you would want it exported as well.
Comment 31 Lars Vogel CLA 2012-03-23 13:21:03 EDT
Thanks Curtis for the clarification. Please close this bug again.
Comment 32 Curtis Windatt CLA 2012-03-23 13:25:06 EDT
(In reply to comment #31)
> Thanks Curtis for the clarification. Please close this bug again.

Closing.