Bug 195281 - Target platform should be able to specify different system.bundle
Summary: Target platform should be able to specify different system.bundle
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Danail Nachev CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
Depends on: 218625
Blocks:
  Show dependency tree
 
Reported: 2007-07-03 11:09 EDT by Danail Nachev CLA
Modified: 2008-06-04 15:28 EDT (History)
4 users (show)

See Also:
baumanbr: review?
tjwatson: review+


Attachments
Patch for the equinox resolver (14.21 KB, patch)
2007-12-14 07:34 EST, Danail Nachev CLA
no flags Details | Diff
Patch for PDE core (7.67 KB, patch)
2007-12-14 07:35 EST, Danail Nachev CLA
no flags Details | Diff
equinox resolver patch (36.41 KB, patch)
2008-01-28 18:49 EST, Thomas Watson CLA
no flags Details | Diff
equinox resolver patch (36.42 KB, patch)
2008-01-28 18:54 EST, Thomas Watson CLA
no flags Details | Diff
org.eclipse.pde.core.patch (14.60 KB, patch)
2008-01-29 20:01 EST, Chris Aniszczyk CLA
no flags Details | Diff
mylyn/context/zip (4.53 KB, application/octet-stream)
2008-01-29 20:01 EST, Chris Aniszczyk CLA
no flags Details
org.eclipse.pde.core.patch (14.69 KB, patch)
2008-01-29 20:22 EST, Chris Aniszczyk CLA
no flags Details | Diff
updated patch for pde.ui and pde.core (18.49 KB, patch)
2008-02-01 14:29 EST, Brian Bauman CLA
no flags Details | Diff
equinox framework patch (36.41 KB, patch)
2008-02-01 16:55 EST, Thomas Watson CLA
no flags Details | Diff
mylyn/context/zip (5.93 KB, application/octet-stream)
2008-02-12 10:47 EST, Chris Aniszczyk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Danail Nachev CLA 2007-07-03 11:09:51 EDT
Currently, the system.bundle is merely an alias to org.eclipse.osgi bundle. This is correct when the target platform is Equinox based. In case the target platform is not based on Equinox, the system.bundle alias is different bundle (usually:). So, if someone is developing against different platform, it becomes a bit messy, because, org.eclipse.osgi is no more the system.bundle

The bigger problem is that there is no way to specify and the PDE to find out, which bundle of the target platform is the system one. The only idea I have for now is to look for Eclipse-SystemBundle header (or some other header).
Comment 1 Thomas Watson CLA 2007-07-17 09:26:44 EDT
As Danail points out there are two issues:

1) The resolver PDE uses needs the ability to alias the system.bundle to another bundle other than org.eclipse.osgi.

2) PDE needs a way to figure out which bundle in the target is the system.bundle so it can use the correct system.bundle alias.

For the first issue the resolver could be enhanced to pass the system.bundle alias as a platform property.  Currently the resolver uses an internal framework method to obtain org.eclipse.osgi as its alias (org.eclipse.osgi.framework.internal.core.Constants#getInternalSymbolicName()).  This always returns org.eclipse.osgi.  We could require this information be passed as a platform property instead to the State.setPlatformProperties method.

For the second issue I'm not sure what the best approach is.  The spec does not give any guidance on the system.bundle manifest or file format.  The system.bundle is not even required to be a jar with a proper manifest.  Most implementations seem to use a jar file but I have seen some that do not even contain a proper bundle manifest file.  Perhaps we can get by with requiring a the system.bundle to be a jar file with a proper bundle manifest for PDE tooling.  If that is acceptable then I would suggest that the Eclipse-SystemBundle: true header be used to indicate the jar file is the system.bundle for PDE tooling.  Then PDE would search the target for this header and use that bundle's symbolic name as the system.bundle alias.  If multiple are found what should PDE do?  If org.eclipse.osgi is one then prefer that one I guess :) otherwise just pick the first one.

There is also an issue of java profiles.  Currently PDE uses the org.eclipse.osgi jar to provide java profiles for setting up the necessary execution environment information.  Should PDE require other system.bundle's to contain the execution environment profiles?
Comment 2 Danail Nachev CLA 2007-07-20 07:18:10 EDT
It sound reasonable that the execution environment profiles should be located in the system bundle.
Comment 3 Danail Nachev CLA 2007-12-14 07:33:34 EST
I have made some initial effort in implementing this enhancement. However, I'm not very familiar with all the aspects of the code to be changed.

As we kind of agreed on how this will be handled, I changed the resolver and the PDE states to look out for different system bundle specified via Eclipse-SystemBundle header. Here are some notes I taken while working:

1) System bundle setting is exposed as API on the State object. This is not mandatory, if we add utility method which extracts the system bundle from the platform properties and use this method
2) The system.bundle name isn't substitued upon bundle adding/updating. VersionConstraint takes care of returning correct value, during resolving process.
4) MinimalState now holds the value of the system bundle. It is detected when the bundles from the target platform are added. Profiles are considered changed when bundle with Eclipse-SystemBundle header is added and not when org.eclipse.osgi bundle is added. The system bundle is passed as property to the State and it is serialized with the platform properties. Upon loading, it is restored through the same platform properties into the MinimalState

This summarizes the changes I have done. However, there are things which are not very clear how will be handled:

1) How launching will be handled for multiple system bundles - there is code inside the launcher which assumes that the system bundle is org.eclipse.osgi. I haven't put much thought in the subject.
2) Building features and product configurations - there is a code which references org.eclipse.osgi bundle directly. I didn't have opportunity to dive much in the subject.

What do you think?

I'll attach the patches, so you can review. It would be great if you can give me some directions on how to proceed. Do you intent in including this in 3.4?
Comment 4 Danail Nachev CLA 2007-12-14 07:34:39 EST
Created attachment 85263 [details]
Patch for the equinox resolver
Comment 5 Danail Nachev CLA 2007-12-14 07:35:41 EST
Created attachment 85264 [details]
Patch for PDE core
Comment 6 Brian Bauman CLA 2008-01-04 11:34:17 EST
Danail, thanks for the patches.  I can help review the PDE core one while Tom will have to review the resolver patch.  As long as we can get this working, I don't foresee why we can't get this in for 3.4.  It might be a few days until we get back to you, I am still try to catch up with all the stuff I missed while being out for the holidays :)
Comment 7 Chris Aniszczyk CLA 2008-01-04 12:42:55 EST
Sounds like something fantastic to add in 3.4M5
Comment 8 Brian Bauman CLA 2008-01-09 18:16:56 EST
Tom, could you review the equinox resolver patch when you get a chance?
Comment 9 Thomas Watson CLA 2008-01-28 18:49:11 EST
Created attachment 88074 [details]
equinox resolver patch

I did an initial review of the equinox patch.  The patch is a great step in solving this issue.  I found a few issues:

1) As stated in Danail's comment 3 a new API method was added to state to get the system bundle systembolic name for the state.  I would like to avoid this and require the platform properties be used instead.  This patch does that.

2) We had a temporary constant in the internal Constants.OSGI_SYSTEM_BUNDLE.  This should be removed and we should use the org.osgi.framework.SYSTEM_BUNDLE constant.  Not strictly related to this bug but it was confusing me because some of the code used one constant and some used the other constant.

3) I think we should avoid using "system.bundle" as the platform property for specifying the system bundle symbolic name.  I modified the patch to use "osgi.system.bundle".  We may want to be even more specific and use osgi.system.bundle.symbolicName.  The motivation is to have a specific enough property that is very unlikely that anyone has used the property before.

4) I found a bug in ImportPackageSpecificationImpl which prevented proper aliasing when the attribute bundle-symbolic-name=system.bundle

I added several tests to verify that the osgi.system.bundle aliasing works for Require-Bundle, Import-Package and Fragment-Host.

Danail, can you update the PDE patch to the latest in HEAD and update it to use the "osgi.system.bundle" platform property.
Comment 10 Thomas Watson CLA 2008-01-28 18:54:12 EST
Created attachment 88075 [details]
equinox resolver patch

I added an internal constant for osgi.system.bundle.  This way if we decide to change the constant it only has to be changed in one spot in the framework.
Comment 11 Chris Aniszczyk CLA 2008-01-29 20:01:09 EST
Created attachment 88229 [details]
org.eclipse.pde.core.patch

The patch was updated to use the new system property that Tom mentioned.
Comment 12 Chris Aniszczyk CLA 2008-01-29 20:01:15 EST
Created attachment 88230 [details]
mylyn/context/zip
Comment 13 Chris Aniszczyk CLA 2008-01-29 20:22:01 EST
Created attachment 88231 [details]
org.eclipse.pde.core.patch

This is an updated patch... we missed a corner case where the system.bundle could be null.

It would be nice to get the Prosyst guys to test this with their system bundle now... :)
Comment 14 Chris Aniszczyk CLA 2008-01-29 20:23:05 EST
I also opened bug 217022 to make it easier to see what the current system bundle is if you're adding it to things... 
Comment 15 Chris Aniszczyk CLA 2008-01-30 11:25:40 EST
Danail, want to give it a go?
Comment 16 Danail Nachev CLA 2008-01-31 05:31:30 EST
I'll definitely test it today or tomorrow and will post back. Thanks.
Comment 17 Brian Bauman CLA 2008-02-01 14:29:42 EST
Created attachment 88623 [details]
updated patch for pde.ui and pde.core

Update the org.eclipse.pde.core patch with one that includes changes to org.eclipse.pde.ui.  Also created a function in PluginModelManager to get the system bundle name without having to get the State, as this seems like we are relying on the underlying implementation when going directly through the state.

Tom, are you ready to release the resolver changes?  I think we should be ready on the PDE side.
Comment 18 Thomas Watson CLA 2008-02-01 16:55:16 EST
Created attachment 88635 [details]
equinox framework patch

Updated patch against HEAD.  I am waiting for confirmation back from Danail before releasing.  I am not that comfortable releasing this close to M5.  If we do not hear confirmation back in time to release for a Monday Build then I suggest slipping this to M6.
Comment 19 Danail Nachev CLA 2008-02-02 08:32:10 EST
Sorry for the late answer.
I tested the latest patches and didn't encounter any problems. I hope it isn't too late:)
Comment 20 Chris Aniszczyk CLA 2008-02-05 16:21:15 EST
sorry Danail, this will have to wait for M6. We'll get it in the first week after M5 is out the door :)
Comment 21 Thomas Watson CLA 2008-02-12 09:31:19 EST
I opened a separate bug 218625 for the resolver changes.  I will release the changes to the resolver in that bug today.
Comment 22 Chris Aniszczyk CLA 2008-02-12 10:47:37 EST
Thanks Tom. Thanks Danail for helping out with the testing. If possible, I would love a screenshot of you using a prosyst system bundle and launching with it for possible inclusion in the next N&N.
Comment 23 Chris Aniszczyk CLA 2008-02-12 10:47:42 EST
Created attachment 89505 [details]
mylyn/context/zip
Comment 24 Thomas Watson CLA 2008-06-04 15:28:16 EDT
clearing out old review requests.