Bug 54790 - Platform.getProduct() returns null unless -product specified
Summary: Platform.getProduct() returns null unless -product specified
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Update (deprecated - use Eclipse>Equinox>p2) (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M8   Edit
Assignee: Dorian Birsan CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 26596 54547 54548
  Show dependency tree
 
Reported: 2004-03-15 00:22 EST by Nick Edgar CLA
Modified: 2004-03-22 13:28 EST (History)
3 users (show)

See Also:


Attachments
Zip file containing platform.cfg and platform.xml (2.02 KB, application/x-zip-compressed)
2004-03-15 11:55 EST, Nick Edgar CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2004-03-15 00:22:17 EST
build I20040310 + latest from HEAD

Platform.getProduct() returns null when self-hosting.
In the implementation, Platform.getProduct() looks up the product id via 
System.getProperty(PROP_PRODUCT) but this property is only set if you specify -
product on the command line.

In order for us to migrate to using IProduct and IBundleGroup (bug 54547 and 
bug 54548), the Workbench should always be able to obtain an IProduct.

For backwards compatibility, can the IProduct be inferred from the primary 
feature, as specified in the install.ini, if not specified explicitly?
Comment 1 Jeff McAffer CLA 2004-03-15 07:57:47 EST
This feels like an update or PDE issue.  The runtime is not able to infer 
productness.  It must be told.  This can be done either via the -product 
command line option or the eclipse.product system property.  The property can 
be set as a VM arg (-D on the command line) or in one of the properties files 
(e.g., config.ini).  

I believe previously PDE would build a platform.cfg that identified 
org.eclipse.platform as the default primary feature.  If that is still true, 
then update should see that and generate a product for org.eclipse.platform.  
Assuming that is true, someone still has to tell the runtime which product is 
the current one (there may be many).

On the UI side, getProduct() is spec'd to return null in the case where there 
is no product defined.  There is no way for the runtime to enforce the presence 
of a product definition.  Is it possible for the UI to use defaults when there 
is no product?

Not sure where to move this so will add a few people to the CC list and see 
what they think.
Comment 2 Wassim Melhem CLA 2004-03-15 08:27:12 EST
In the platform.xml/platform.cfg that PDE generates for the runtime workbench, 
we do set the primary feature id if an install.ini file is found in the target 
platform and has such feature.primary.id key.

PDE is not aware of -product xxx, but if the user (let's arbitrarily call him 
Nick, for a lack of a better name) enters it on the Prog Args field in the 
configuration, we just append it to the list of prog args that we load on the 
vmrunner.

One thing I found suspicious in the PDE code, which may or may not have 
anything to do with this, is that if we find a primary feature id in the 
install.ini, we also automatically set the "-feature primaryfeatureid" prog 
arg.  Right now, for some reason, we only set it only if the target platform 
is NOT an OSGi runtime.  I don't recall why.  Maybe it's a bug.  Maybe there 
is a good reason for it.  Maybe it does not matter.
Comment 3 Wassim Melhem CLA 2004-03-15 08:35:47 EST
Nick, it would be good if you could attach the platform.xml/platform.cfg that 
PDE generates for the runtime workbench.  

You could determine its location by:
Go to the debug view > Right-click on the process corresponding to the runtime 
workbench in question > examine the value of the "-configuration" prog arg > 
Go to that directory on disk and attach the platform.xml/platform.cfg that you 
find.

It would also be halpful if you paste the command line that PDE sets up for 
the runtime workbench, i.e. the entire content of the Properties dialog 
mentioned above.

Comment 4 Jeff McAffer CLA 2004-03-15 09:10:27 EST
To my knowledge, -feature is no longer used.  The runtime certainly does not do 
anything with it.  Update may do something with it.  Perhaps this is the root 
of the conditional use of -feature in PDE?
Comment 5 Pascal Rapicault CLA 2004-03-15 09:20:23 EST
This seems to be related to the bug #54283 comment #3.
Comment 6 Nick Edgar CLA 2004-03-15 11:55:37 EST
Created attachment 8573 [details]
Zip file containing platform.cfg and platform.xml

I've attached the platform.cfg and platform.xml as requested.
Comment 7 Dorian Birsan CLA 2004-03-15 15:46:54 EST
Update does not use the -feature or any other flag.
The update configurator defines a product provider, and the startup code is 
supposed to be selecting the desired "product". Update maps primary features 
to products.
As Jeff suggests, I think PDE may need to set the -product (or create the 
appropriate entry in config.ini) instead of -feature.
Comment 8 Nick Edgar CLA 2004-03-15 16:02:05 EST
PDE can only set it for the self-hosting case.  Who sets it for the outer 
instance?  It seems like only update.configurator could do this.

Comment 9 Dorian Birsan CLA 2004-03-15 16:12:12 EST
I think the config.ini has the product in it (or should have it).
In the past we were relying on eclipse/install.ini for the default feature 
(aka default product), but Jeff and I were discussing having this info in 
config.ini that ships with eclipse.
Comment 10 Jeff McAffer CLA 2004-03-15 18:06:15 EST
yes, we "decided" that the install.ini info could be consolidated into the 
config.ini.  I believe we should press forward on this.
Comment 11 Jeff McAffer CLA 2004-03-15 22:41:13 EST
more to the point, the interesting values in install.ini are now superceded by 
values in config.ini.  

- feature.default.id => eclipse.product
- feature.default.application => eclipse.application

I think the only use of install.ini is in update for the reconciler.  If we 
setup the standard config.ini appropriately (i.e., to identify the product) and 
change the reconciler to read the product id and map it onto a feature, we 
should be happy.
Comment 12 Dorian Birsan CLA 2004-03-15 22:56:36 EST
Jeff, I am releasing code to set the eclipse.product variable if not already 
set. Its value will be the primary feature id, which is what is defined in 
install.ini, or org.eclipse.platform if undefined.
After you make the changes to define eclipse.product inside config.ini, I will 
change the update code accordingly, and we can also scrap the install.ini file.
Comment 13 Jeff McAffer CLA 2004-03-15 23:39:47 EST
great.  Lets do scrap install.ini after the I build tomorrow and test then put 
in M8 next week.
Comment 14 Jeff McAffer CLA 2004-03-20 20:18:24 EST
moving to Update.

We resolved to remove install.ini and include eclipse.product and 
eclipse.application in the config.ini instead.
Comment 15 Dorian Birsan CLA 2004-03-21 21:24:17 EST
The update configurator is setting the product only when eclipse.product is 
not already set. So, if config.ini has the setting, update will not change it.
Install.ini is still looked at to obtain the default feature it, but this code 
will be removed Monday (if install.ini is no longer part of the build) and get 
PrimaryFeatureId() will return the value of eclipse.product. 
Similarly for eclipse.application.
Comment 16 Jeff McAffer CLA 2004-03-22 09:15:23 EST
Can you remove install.ini from the build or do you want me to?  Let me know 
either way
Comment 17 Dorian Birsan CLA 2004-03-22 09:34:19 EST
Jeff, it would be faster if you handle this. Thanks!
Comment 18 Jeff McAffer CLA 2004-03-22 09:41:09 EST
just to be extra clear on this, let me know when it is safe to remove the file.
Comment 19 Dorian Birsan CLA 2004-03-22 09:44:30 EST
Thanks Jeff.
It is safe to remove it now. 
Update configurator works even when install.ini is not present.
Comment 20 Dorian Birsan CLA 2004-03-22 13:28:41 EST
Update configurator no longer reads the install.ini.
The default feature is obtained from eclipse.product, and if not set it is the 
org.eclipse.platform.
Similarly, the default application is obtained from eclipse.application, and 
if not set, it is obtained from the default feature (see above).