Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 235336

Summary: [p2] cannot compile against plugins referenced via .link files
Product: [Eclipse Project] PDE Reporter: Carsten Pfeiffer <carsten.pfeiffer>
Component: UIAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: caniszczyk, darin.eclipse, dj.houghton, eclipse.sprigogin, ekke, john.arthorne, ob1.eclipse, sflaniga, simon_kaegi
Version: 3.4   
Target Milestone: 3.4.1   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
screen shot of target platform pref page
none
Fix
none
mylyn/context/zip
none
Updated Fix none

Description Carsten Pfeiffer CLA 2008-06-03 09:54:21 EDT
Build ID: I20080530-1730

Steps To Reproduce:
1. Use a .link file to integrate another plugin into the platform
2. Run Eclipse and verify with Help -> About Eclipse SDK -> Plugin Details that the plugin is indeed available
3. Create a new Plugin in the workbench
4. In the MANIFEST.MF editor, try to set a dependency to the plugin that was integrated with the .link file

4) will not work, the dialog will not even display the plugin. If you add the dependency textually, it will still not work, as the classpath will not be resolved.


If this is not supposed to work, then I suggest updating

http://wiki.eclipse.org/Equinox_p2_Getting_Started#Links_Folder
which says "For backwards compatibility the links folder is supported by p2 with the same behavior.".
Comment 1 Carsten Pfeiffer CLA 2008-06-03 09:57:55 EDT
Sorry, this was supposed to go to PDE (I hope that's where it belongs to...)
Comment 2 Carsten Pfeiffer CLA 2008-06-03 10:11:21 EDT
FWIW, it doesn't seem to work with the dropins/ folder either. I.e. I removed the entire links/ folder and copied the plugins and features (e.g. GEF) into dropins/.

The plugin is indeed available:
osgi> diag org.eclipse.gef
reference:file:dropins/gef/plugins/org.eclipse.gef_3.4.0.v20080508.jar [150]
  No unresolved constraints.

Still, the manifest.mf editor complains that "Bundle 'org.eclipse.gef' cannot be resolved".
Comment 3 Sergey Prigogin CLA 2008-06-13 12:44:49 EDT
This bugs breaks many existing Eclipse installations and should be considered critical. Eclipse 3.4 (or at least p2) should not go out until it's fixed.
Comment 4 Chris Aniszczyk CLA 2008-06-13 12:50:54 EDT
Are you aware of the new target platform preference?

http://mea-bloga.blogspot.com/2008/04/new-target-platform-preference.html

The docs should be updated with this information too.
Comment 5 Darin Wright CLA 2008-06-13 13:54:05 EDT
Created attachment 104899 [details]
screen shot of target platform pref page

This works for me. I downloaded ECF from the Ganymede update site, and placed the plugins in "c:\temp\LinkLocation\eclipse\plugins". Then I added a "links\ecf.link" file with the contents "path=c:/temp/LinkLocation".

On restart, I went to the target platform page, and saw all the new ECF plug-ins available in the target platform, grouped by location. I have the preference to "build target platform based on the target's installed plug-ins" checked.
Comment 6 Darin Wright CLA 2008-06-13 14:03:56 EDT
Then, when I check an ECF plug-in out of CVS that requires some other ECF plug-ins the build path (Plug-in Depedencies) are computed properly, and compiles without error.

As well I can create a new plug-in with a dependency on any ECF plug-in. They appear in the dialog when adding required plug-ins.
Comment 7 Darin Wright CLA 2008-06-13 14:08:47 EDT
What I did notice is that when I delete the .link file/folder from my root install, p2 still thinks the linked plug-ins are part of my host IDE (and the bundles still appear in bundles.info). However, this feels like a separate p2 issue.
Comment 8 Carsten Pfeiffer CLA 2008-06-17 04:41:41 EDT
Thanks for the tip with the target platform configuration. The problem is certainly related to that and the -configuration switch.

When you start eclipse with the -configuration switch, neither the dropins, nor the links folder are automatically added to the target platform.
Comment 9 Darin Wright CLA 2008-06-19 10:47:47 EDT
Moving to runtime for comment - this is not a PDE issue if the -configuration switch is changing behvaior.
Comment 10 Oleg Besedin CLA 2008-06-19 11:57:57 EDT
Both "links" folder and "dropins" work for me with or without "-configuration" argument (Eclipse 3.4RC4).

Possible points:
- Where you pointing "-configuration" to? Is it a valid path? What happens if you point it to a new directory?
- Can you try with Eclipse 3.4 RC4 - or better yet with one of the last I-builds as few problems have been fixed for RC4
Comment 11 Carsten Pfeiffer CLA 2008-06-19 12:16:39 EDT
I'm also using RC4 by now (problem remains). And I copy the pristine configuration directory from eclipse to a new location and point to it with -configuration. Here's how to reproduce this (on Linux):

The emf_uml2 folder contains emf and uml2 features+plugins.

~$ mkdir /tmp/et
~$ cd /tmp/et
/tmp/et$ tar xfz ~/eclipse/eclipse-SDK-3.4RC4-linux-gtk.tar.gz
tmp/et$ cd eclipse/
/tmp/et/eclipse$ cp -r ~/eclipse/emf_uml2/ dropins/
/tmp/et/eclipse$ cp -r configuration/ /tmp/
/tmp/et/eclipse$ ./eclipse -data /tmp/wstemp -configuration /tmp/configuration

Now open the Target Platform preference page, check "Group plug-ins by location" and you will notice that the emf_uml2 folder is not shown, nor are the emf2/uml2 plugins.
Comment 12 DJ Houghton CLA 2008-06-19 13:32:31 EDT
Here is my setup: (done on Linux)

- take latest build and extract it to /home/dj/eclipse
- mv /home/dj/eclipse/configuration to /home/dj/configuration
- cp releng.tools bundle to /home/dj/eclipse/dropins
- start eclipse with -console and -configuration /home/dj/configuration

Here are my findings:
- the Releng Tools bundle is installed in the system. (do an "ss" in the OSGi console)
- the Releng Tools bundle appears in Help -> About -> Plug-in Details
- the Releng Tools bundle DOES NOT appear in the Target Platform preference page (whether or not it is grouped by location)
- the Releng Tools bundle IS NOT available if I create a new bundle and try to add a dependency on it in the manifest.

When I set the same thing up but use the default configuration location, the Releng Tools bundle is available in all cases.

Darin, how does PDE populate the Target Platform preference page?
Comment 13 Darin Wright CLA 2008-06-19 14:16:46 EDT
(In reply to comment #12)
> Darin, how does PDE populate the Target Platform preference page?

If the "Build target platform based on the target's installed plug-ins" box is checked, we parse bundles.info. Else we scan the plug-ins directory for bundles.

*My tests were done on XP, without changing the configuration location*

Comment 14 Darin Wright CLA 2008-06-19 14:31:24 EDT
Back to PDE. We looks for the configuration area in the eclipse home folder, which does not work in this case.
Comment 15 Darin Wright CLA 2008-06-19 14:37:10 EDT
Problem is in P2Utils.getConfigurationArea(...). Should fix for 3.4.1.
Comment 16 Darin Wright CLA 2008-06-19 16:15:25 EDT
DJ, how does one programmtically obtain the "configuration location" specified by "-configuration"?
Comment 17 DJ Houghton CLA 2008-06-19 16:25:58 EDT
By acquiring an OSGi service, of course! :-)

The service is called Location and you use a config location filter. We have some examples in our code. Check out the org.eclipse.equinox.p2.reconciler.dropins bundle. In the Activator, for instance, we grab the config location. 

Also note that config locations can have parents/be cascaded. (for instance in the case of shared install)
Comment 18 John Arthorne CLA 2008-06-19 16:42:31 EDT
Or use Platform.getConfigurationLocation()
Comment 19 Darin Wright CLA 2008-07-03 10:43:56 EDT
*** Bug 238950 has been marked as a duplicate of this bug. ***
Comment 20 Curtis Windatt CLA 2008-07-09 17:04:19 EDT
Created attachment 107012 [details]
Fix

Changes P2Utils to use Platform.getConfigurationLocation().

DJ, you mentioned that the location could be cascaded/have parents.  Could you explain how this might affect the code?  In this patch, we are getting the location, getting a URL, and then appending the path to the specific file (bundles.info/srcbundles.info).

This needs some more testing to make sure we aren't causing any regression, including the area of target weaving (there were issues about getting the configuration area different when in dev mode).
Comment 21 Curtis Windatt CLA 2008-07-09 17:04:27 EDT
Created attachment 107013 [details]
mylyn/context/zip
Comment 22 DJ Houghton CLA 2008-07-10 10:29:43 EDT
For instance when you install Eclipse to a read-only location, the configuration is cascaded... you will have a local configuration area in your user dir and then it will have a parent location in the read-only area. See Location#getParentLocation.

Adding Simon to the CC list as he knows more about the shared configuration scenario. What did we decide about the bundles.info file in the cascaded case? Are they merged or does the user copy contain everything? 
Comment 23 Chris Aniszczyk CLA 2008-07-10 10:39:34 EDT
As far as I know, PDE has never supported the cascaded case properly so that would be more of an enhancement.

I'm testing out the patch in various scenarios.
Comment 24 Curtis Windatt CLA 2008-07-10 10:45:15 EDT
Created attachment 107084 [details]
Updated Fix

This patch catches an additional case, when you have a target platform pointed at a non-default location and have you are trying to build the target platform from only installed bundles (check box is checked).  In this case we just try platformHome/configuration and see if it works.
Comment 25 Curtis Windatt CLA 2008-07-29 16:04:33 EDT
Fixed in HEAD and 3.4.1
Comment 26 ekkehard gentz CLA 2008-08-12 03:35:07 EDT
just wanted to confirm, that fixing this bug also fixes my bug 238950
(resolved as duplicate of this bug)

thanks 
ekke