Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 109383 - Dependency weirdness with I20050906-0800/N20050912-0010
Summary: Dependency weirdness with I20050906-0800/N20050912-0010
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.2 M3   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 109335
Blocks:
  Show dependency tree
 
Reported: 2005-09-13 08:16 EDT by Kim Horne CLA
Modified: 2005-10-08 01:31 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Horne CLA 2005-09-13 08:16:27 EDT
Last nights nightly build failed because platform-ui checked code into workbench that required classes 
from org.eclipse.core.resources.  We shouldn't have done this - resource code belongs in IDE.  The 
problem is, workbench doesn't depend on resources and yet the code compiled fine so we weren't tipped 
off to our error.  Looking at the Plug-in Dependencies tree under my workbench project I see resources is 
there but I don't see any reason for it to be.  However, if I "Show plug-in dependency graph" from the 
Dependencies page of the plugin editor it is not listed.  

It's not listed in our manifest or our plugin.xml and it doesn't appear to be a re-exported requirement of a 
plug-in we depend on.
Comment 1 Wassim Melhem CLA 2005-09-13 10:22:03 EDT
well, org.eclipse.ui.workbench.compatibility requires core.resources, so the 
host plugin (org.eclipse.ui.workbench) does have core.resources on its 
classpath at runtime.

PDE is using the runtime state to determine what goes on the classpath, so 
either:
1. This is a PDE/Build bug, since PDE/Build should get the same result as 
PDE/UI if it were using the state.
2. The runtime shouldn't tell PDE to put core.resources on the classpath at 
development time, if the dependency is coming from the fragment.

Adding Pascal/Tom for comment/action.
Comment 2 Thomas Watson CLA 2005-09-13 17:03:04 EDT
There is a possible explanation for PDE/Build and PDE/UI to get different 
results in this type of scenario.  It depends on what methods each is calling 
to get depenency constraints from a BundleDescription object.  The methods 
BundleDescription#getResolvedImports and BundleDescription#getResolvedRequires 
will return all dependancies which got resolved from a bundle host AND any 
attached fragments.  The methods BundleDescription#getImportPackages and 
BundleDescription#getRequiredBundles only get the constraints for a particular 
bundle and do not include attached fragment constraits.  I suspect PDE/UI is 
using ghet getResolvedImports and getResovlvedRequires methods and PDE/Build 
is using the getImportPackages and getRequiredBundles methods.

I have not looked at the code for PDE/Build or PDE/UI to confirm this.
Comment 3 Wassim Melhem CLA 2005-09-16 00:49:39 EDT
Tom, I did an investigation.

The reason why core.resources is getting added on the classpath is because 
StateHelper#getVisiblePackages(BundleDescription) is returning packages from 
core.resources.  This is technically correct at runtime, but should not be 
happening at development time.

The org.eclipse.ui.workbench plug-in should not have on its classpath the 
dependencies (org.eclipse.core.resources) that are only required by its 
fragment (org.eclipse.ui.workbench.compatibility).

I will move to you.
Comment 4 Thomas Watson CLA 2005-09-16 15:46:51 EDT
Changing the behavior of StateHelper#getVisiblePackages(BundleDescription) 
would cause other problems for PDE.  Currently PDE uses this list of packages 
to buildup the classpath of the host.  It then adds the host and all of its 
dependencies to the classpath of the fragment as well.  If we stopped 
returning fragment constraints for the host then PDE would start failing to 
build fragments which require additional constraints.  I really think we want 
to keep the State consistent between tools vs. runtime.

I discussed this with Wassim.  There may be some extra work that PDE UI could 
do to correctly compute the classpath for the host and fragment bundles.  
Right now PDE UI is making the assumption that all packages returned by 
getVisiblePackages are from constraints of the host.  It could do some extra 
work here to make sure these packages are not from extra constraints of 
attached fragments.
Comment 5 Wassim Melhem CLA 2005-10-08 01:31:33 EDT
Fixed.

We no longer assume that packages returned by the state helper which do not 
correspond to Require-Bundle are coming via import-package.

We now also go through the Import-Package statement manually and make sure no 
extra packages are making it to the classpath.

This will exclude all packages that make it on the classpath from a fragment 
dependency.