Bug 198641 - Eclipse does not pass the PDE target platform settings to a launched instance
Summary: Eclipse does not pass the PDE target platform settings to a launched instance
Status: RESOLVED DUPLICATE of bug 109137
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: dakshinamurthy.karra CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday
Depends on:
Blocks:
 
Reported: 2007-08-02 06:03 EDT by dakshinamurthy.karra CLA
Modified: 2008-04-22 00:56 EDT (History)
2 users (show)

See Also:


Attachments
Patch against CVS Head (12.54 KB, patch)
2007-09-03 02:36 EDT, dakshinamurthy.karra CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dakshinamurthy.karra CLA 2007-08-02 06:03:55 EDT
Build ID: I20070625-1500

Steps To Reproduce:
1. Use a separate update site to keep some plugins
2. Launch an eclipse application
3. Check Preferences -> Plug-in development -> Target platform

You can observe that the update site does not appear in the list.


More information:
This is causing a problem with JET2 when creating custom tag libraries. I installed the additional plugins in a separate directory. After creating a custom tag library it can be used only from a launched instance. Since PDE does not add the additional directory to the Target platform, the tag library and jet plugins can't be seen.

Workaround: In the launched instance adding the additional directory and the workspace will solve the problem.
Comment 1 Brian Bauman CLA 2007-08-02 09:31:26 EDT
Just to make sure I understand this correctly, you are saying the the target platform from your host (the Eclipse instance you start from the command line), has additional information in its target platform.  And when your runtime workbench is launched, its target platform does not contain this additional information, right?
Comment 2 dakshinamurthy.karra CLA 2007-08-02 10:52:12 EDT
(In reply to comment #1)
Yes. This information is populated by eclipse itself because while installing additional packages I selected a different directory.

Comment 3 Brian Bauman CLA 2007-08-02 17:46:40 EDT
Are you self-hosting (ie. set your target platform to the same instance of Eclipse you are running with)?

If so, what we should probably be doing is copying and modifying the platform.xml from the target platform instead of creating a new one from scratch.  This should pass the additional updates sites to the new launched instance of Eclipse.
Comment 4 dakshinamurthy.karra CLA 2007-08-02 23:58:58 EDT
(In reply to comment #3)
> Are you self-hosting (ie. set your target platform to the same instance of
> Eclipse you are running with)?
> 
Yes.

> If so, what we should probably be doing is copying and modifying the
> platform.xml from the target platform instead of creating a new one from
> scratch.  This should pass the additional updates sites to the new launched
> instance of Eclipse.
> 

I think this is the solution.


Comment 5 dakshinamurthy.karra CLA 2007-08-28 13:02:43 EDT
Care to tag it for bug-day. Would like to sign-up.

Comment 6 Chris Aniszczyk CLA 2007-08-28 13:05:12 EDT
picking a tough one ;)?
Comment 7 dakshinamurthy.karra CLA 2007-08-28 13:09:09 EDT
(In reply to comment #6)
> picking a tough one ;)?
Hmm... then I will come around asking for help. Be around on IRC ;-).

Comment 8 dakshinamurthy.karra CLA 2007-08-30 13:09:48 EDT
The solution seems to be removing the isDevMode() check from PluginPathFinder#getPluginPaths() function. When this check is removed, the plugin view and target platform shows all the plugins including the workspace plugins. It looks right.

There is a problem in the following scenario:

Eclipse (0) -> Launched an eclipse instance (1) -> Launched eclipse instance (2)

In instance (2), the workspace plugins from (0) are not visible because the classpath from (1) derived from dev.properties is not passed across. The solution is to merge the dev.properties. My guess is that the fix should go into ClassPathHelper.

How does this sound? Any suggestions?

I still did not go through it thoroughly. Since there is a TZ difference, I though I will do some analysis and get feedback.

-- KD



Comment 9 Brian Bauman CLA 2007-08-30 15:18:05 EDT
I have to say it is funny how you learn about something that has been around for year, then amazingly you need that information multiple times in the next few weeks :)

To make a long story short, we can't remove it :)  If you want to know why, continue reading...

The function isDevMode() is actually very important.  The reason is some shortcuts PDE uses.  The runtime allows you to run a project as a bundle, without exporting it.  This is done by passing some extra information about where to load classes from (since class, by default, are in /bin instead of the root of the project).

By doing this, the runtime is able to run these workspace projects correctly.  But, if you try to launch a runtime workbench from your 1st runtime workbench, the second workbench is not passed the same information.  Therefore, the second runtime workbench treats it as a regular bundle and when trying to load classes, you will get a bunch of NoClassFound problems.

So to prevent this, we have the check for isDevMode().  This prevents your runtime workbench from including workspace plug-ins in its target platform and in any runtime workbenches.

Comment 10 dakshinamurthy.karra CLA 2007-08-30 23:05:01 EDT
Is this the only reason for this check?

In that case, by merging the dev.properties from a workbench while launching another we can successfully pass the classpath. Anyhow, I will try to do this. (This is what I tried to communicate, rather unsuccessfully it seems :). I am also trying to use fullpath names in dev.properties so that the merge will be trivial.

Meanwhile, if there are any other reasons for that check, please post them.

Thanks.

Comment 11 dakshinamurthy.karra CLA 2007-08-31 10:05:05 EDT
This is what I tried till now:

1. Created a helper class to convert the dev.properties (if given) to full path names.
2. Merging these when a new dev.properties is created in ClassPathHelper. I checked the created dev.properties and they seem to be fine.
3. Removed the isDevMode() check.

This ensures that the paths for the workspace plugins are propogated to the launched instances. Theoritically, that is ;-).

I still get the CNF errors in the first instance of eclipse itself. I am lost at this time. Will try some more a little later.

Why do we get CNF errors in the first instance itself. Does the entries in dev.properties used for resolving bundles in a plugin project?

Any suggestions?

-- KD

Comment 12 dakshinamurthy.karra CLA 2007-08-31 16:10:03 EDT
Atlast it works. But the approach is ugly. Need suggestions on how to implement this. Not uploading the patch because it is not good enough :(

This is what I tried till now:

1. Created a helper class to convert the dev.properties (if given) to full path
names.
2. Merging these when a new dev.properties is created in ClassPathHelper. I
checked the created dev.properties and they seem to be fine.
3. Removed the isDevMode() check.
4. Checking for plugins passed through dev.properties in PDEClassPathContainer#addExternalPlugin. If it is passed from a host-eclipse instance the paths from dev.properties are added to the class path entries.

What is bad:

JDT does not allow external folders to be added to the class path. The workaround is to create a link IFolder#createLink. But IFolder#createLink can't be called outside a IProject. So we can't use preferences area to create these links. Two options are open:

1. Create a hidden folder in each of the projects and create the links there for the dependent plugins there.
2. Create a top level project for just keeping the link folders.

I used (2) for trying this out. And it seems to be working.

Any suggestions on how we can approach this?

-- KD

PS: Sorry that I could not finish it for the bugday. I will try to clean it up over the weekend.

Comment 13 dakshinamurthy.karra CLA 2007-09-03 02:36:58 EDT
Created attachment 77557 [details]
Patch against CVS Head

Hi,

This patch contains fixes for this bug. I tried it against my original usecase of JET2. The following modifications have been done:

1. Guest eclipse instances have access to all the plugins defined in the host plugin. This includes the plugins in the host eclipse in source form.
2. If a host eclipse instance itself is a guest instance, the dev.properties are propagated across to its guests.
3. If a guest eclipse instance creates a plugin project that depends on a plugin from the host workspace, a linked folder is created in '__host__plugins' project. The __host__plugins and the links are created lazily when they are needed. This is needed as a workaround because JDT does not support adding external folders to classpath of a java project. This is a generic fix that works for any folders passed through -dev argument.

Hope this is acceptable.

-- KD
Comment 14 dakshinamurthy.karra CLA 2007-09-06 14:14:03 EDT
Did any of you look at this?

Comment 15 Chris Aniszczyk CLA 2008-04-22 00:56:26 EDT
This problem should finally be fixed with bug 109137.

*** This bug has been marked as a duplicate of bug 109137 ***