Bug 109440 - Improvements to "Convert to plugin project..."
Summary: Improvements to "Convert to plugin project..."
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.4 M5   Edit
Assignee: bartosz michalik CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
Depends on:
Blocks:
 
Reported: 2005-09-13 17:03 EDT by Igor Fedorenko CLA
Modified: 2008-01-02 18:13 EST (History)
6 users (show)

See Also:


Attachments
proposed enhancements (30.70 KB, patch)
2005-09-13 17:05 EDT, Igor Fedorenko CLA
no flags Details | Diff
Igor's patch converted to 3.4 (42.90 KB, patch)
2007-09-10 12:21 EDT, bartosz michalik CLA
no flags Details | Diff
mylyn/context/zip (10.92 KB, application/octet-stream)
2007-09-10 12:21 EDT, bartosz michalik CLA
no flags Details
this is a gui illustration (42.38 KB, patch)
2007-09-18 18:56 EDT, bartosz michalik CLA
no flags Details | Diff
this is latest patch proposal (51.04 KB, patch)
2007-10-01 11:25 EDT, bartosz michalik CLA
no flags Details | Diff
mylyn/context/zip (311.12 KB, application/octet-stream)
2007-10-01 11:26 EDT, bartosz michalik CLA
no flags Details
latest version (allows also for external jars) (49.17 KB, patch)
2007-10-02 09:59 EDT, bartosz michalik CLA
no flags Details | Diff
job code part (16.23 KB, patch)
2007-12-03 11:07 EST, bartosz michalik CLA
no flags Details | Diff
second part (9.85 KB, text/plain)
2007-12-03 11:10 EST, bartosz michalik CLA
no flags Details
name convention fix (10.70 KB, patch)
2007-12-03 12:08 EST, bartosz michalik CLA
no flags Details | Diff
last part of the patch (18.18 KB, patch)
2007-12-05 04:26 EST, bartosz michalik CLA
no flags Details | Diff
mylyn/context/zip (308.28 KB, application/octet-stream)
2007-12-05 04:26 EST, bartosz michalik CLA
no flags Details
mylyn/context/zip (10.54 KB, application/octet-stream)
2008-01-02 18:13 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 Igor Fedorenko CLA 2005-09-13 17:03:47 EDT
I just finished converting relatively large codebase to plugin projects and
decided to share my experience and extensions to PDE I've made to make this job
easier

Our code used quite a few thirdparty labraries like log4j or jdom. New plugin
from existing JAR is a nice wizard, but I found it annoying to look for JAR
files on filesystem when I can see the JARs right in the Package Explorer view.
I've added to action to invoke the wizard by right-clicking on one or several
jar files from Package Explorer, Navigator or any other view.

Another annoyance with New plugin from existing JAR wizard is that after
importing say log4j.jar I had to manually update all projects that reference the
jar and replace JAR-file reference with project reference. Really tedious. I've
extented New plugin from existing JAR wizard with an option to do that
automatically.

After importing all my jars and converting all my projects to plugins, I've
found that I had to manually add plugin dependencies even though this
information was already available in .classpath files. Really, really tedious.
To address this, I've introduced new "Update plugin dependencies..." action.

After implementing these little enhancements, overall conversion was rather
simple and quick job -- 1) created new plugins from jars which also established
dependencies on the new plugins 2) converted projects to plugins 3) updated
plugin dependencies 4) updated project classpath
Comment 1 Igor Fedorenko CLA 2005-09-13 17:05:54 EDT
Created attachment 27080 [details]
proposed enhancements

Hope you find it useful ;-)
Comment 2 Wassim Melhem CLA 2005-09-13 18:16:02 EDT
thanks Igor.  I have always wanted this functionality but never had the time.
Comment 3 Igor Fedorenko CLA 2005-09-13 22:38:38 EDT
Forgot to mention. I could not find API to manipulate list of dependent plugins
and UpdatePluginDependenciesJob manipulates META-INF/MANIFEST.MF using
java.util.jar.Manifest. Likewise, I could not find API to distinguish plugins
from fragments and hacked something in isPluginProjectEntry method. I will
update the patch if you show me appropriate API calls.
Comment 4 Wassim Melhem CLA 2005-09-13 23:19:56 EDT
that is fine.  I'll clean it up.  It should make it into M2.
Comment 5 Chris Aniszczyk CLA 2007-08-14 18:54:19 EDT
I really like this idea, lets see what we can do for 3.4.
Comment 6 Chris Aniszczyk CLA 2007-08-27 12:02:30 EDT
Adam, if you get bored at quickfixes, you can take a look at this one. There's a starting patch to help get you started.

I would consider this item a possible noteworthy as this is useful.
Comment 7 Chris Aniszczyk CLA 2007-09-04 12:07:52 EDT
Bartosz... you think you can take on this one?
Comment 8 bartosz michalik CLA 2007-09-05 11:51:44 EDT
yes, sure :) I've browsed through the code.but I'll have time to go deep into it during the weekend. if it's ok for you assign it to me 
Comment 9 Chris Aniszczyk CLA 2007-09-05 16:28:29 EDT
ok Bartosz, you win ;)
Comment 10 Chris Aniszczyk CLA 2007-09-05 17:40:01 EDT
Bartosz, I'm going to give this one back to Adam since he has "all the time in the world" now :)

If you have a problem with this, let me know.
Comment 11 Chris Aniszczyk CLA 2007-09-06 11:58:02 EDT
Actually Bartosz, this is yours again :D

Adam is tasked with some other work.

Sorry for the confusion.
Comment 12 bartosz michalik CLA 2007-09-10 12:21:19 EDT
Created attachment 77995 [details]
Igor's patch converted to 3.4

I've converted Igor's patch to 3.4 
small changes added to code, but it still needs some improvements. 
eg. some checks if there is already reference to project (for now it is possible to run "crate plugin..." action from jar that is not in the classpath)

do you think that allowing exporting multiple jars to one plugin is reasonable. for now create plugin is enabled for single jar selection
Comment 13 bartosz michalik CLA 2007-09-10 12:21:22 EDT
Created attachment 77996 [details]
mylyn/context/zip
Comment 14 Chris Aniszczyk CLA 2007-09-10 12:50:41 EDT
I'll look at this one... I'm very excited to see this go in as this has great benefit for the community.
Comment 15 Chris Aniszczyk CLA 2007-09-10 18:32:23 EDT
I'm fine with a single jar selection for now.

I think we can make this patch a bit simpler as right now, it's hard to go through. I have found some problems also.

How about this...

1) Let's remove the Update Plug-in Dependencies action contribution (along with wizard) to simplify things. This action should happen part of the "Update references to the JAR files" action within the wizard. 

2) When updating references to the jar file, this should happen.
   * We update the classpath so the jar file is removed
   * We add a Require-Bundle on the project (we can invoke UpdatePluginDependenciesJob from here I believe)

I didn't see this happening in my simple test case. But by doing this, we effectively wouldn't see the Update Plug-in Dependencies action contribution as it clutters the already confusing PDE tools menu.

Does this make some sense?
Comment 16 Igor Fedorenko CLA 2007-09-11 09:53:24 EDT
(In reply to comment #15)
> 1) Let's remove the Update Plug-in Dependencies action contribution (along with
> wizard) to simplify things. This action should happen part of the "Update
> references to the JAR files" action within the wizard. 

"Update Plug-in Dependencies" has to do with java project dependencies, if I remember correctly. For example, you have two java projects, testA and testB, and testB depends on testA, this dependency is NOT converted into bundle dependency by existing "Convert Projects to Plug-in Projects..." (just checked with 3.4M1). 
Comment 17 Chris Aniszczyk CLA 2007-09-11 10:29:52 EDT
Isn't that a crazy name for something for updates java classpaths only ;P?

If you have a request for something like that, I would put it in the other bug, I don't see it fit within this use case.

My scenario outline in 1) should cover the bases. 

Thanks for the patch, it helped us quite a bit to get started with this problem.
Comment 18 Igor Fedorenko CLA 2007-09-11 10:47:49 EDT
My use case was "Convert 200+ java projects into OSGi bundles" and I needed to deal with both referenced JAR files and inter-project dependencies. I agree these are two separate enhancements, but I believe both of them are equally important.
Comment 19 Chris Aniszczyk CLA 2007-09-11 10:51:55 EDT
One step at a time :)

Wow, 200+ jars, that's a daunting task ;d I'd be looking for the nearest COOP / intern :)

It is my opinion that whatever the operation is, it should occur as part of the wizard's finish operation. I'm not a big fan of separating out different menu pieces within PDE Tools. Let's see if we can get everything done with one clean succint operation.
Comment 20 Igor Fedorenko CLA 2007-09-11 11:14:44 EDT
Correction, 200+ java projects and 50+ jars. I did have a coop to do the job but I did not want her to hate her job for the rest of her career. ;-) Besides, there would be too many mistakes if we did this manually.

Seriously speaking, conversion of java project dependencies is kinda tricky because you do not know order/grouping in which projects are going to be converted. I agree it'd be nice not to introduce new actions (especially with such confusing names) but I could not find a nice&easy way to incorporate this conversion into any existing flow.
Comment 21 bartosz michalik CLA 2007-09-17 03:48:35 EDT
I'm thinking about one more wizard page. "update references in other projects".
if we bulild project from plugin's lib only references within this project are updated. this option can be helpful if we have other plugins that have the same lib on the classpath and we want to update references in one shot manner.

If we are talking about 200+ scenario. well still there is one question. can it be done in one wizard ? by now there new plugin wizard is used to build and *name* new plugin. should be this wizard fired 200 times during multiple selection (which is not allowed by now) ?
there are two scenarios, when we take multiple selection into account. first is to build many one-jar plugins, second is to build one plugin containing many jars.
Comment 22 bartosz michalik CLA 2007-09-18 18:56:27 EDT
Created attachment 78695 [details]
this is a gui illustration

this is rather gui demonstartion than patch. most of function doesn't work jet. if you have gui comments, i'll glad to hear
Comment 23 bartosz michalik CLA 2007-10-01 11:25:54 EDT
Created attachment 79487 [details]
this is latest patch proposal

features:
- multiselect on jars from many project (but only jars that are on classpaths in plugin projects)
- project to update selection page
- comparison on jar files level (content for jars is compared rather than its location)

concerns:
- problem when "externalising" jars that are exported in given plugin
- warnings and error check is needed
- better user iteraction (e.g. by monitor support)
- clumsy code style (but this is only function illustration :D )
Comment 24 bartosz michalik CLA 2007-10-01 11:26:02 EDT
Created attachment 79488 [details]
mylyn/context/zip
Comment 25 bartosz michalik CLA 2007-10-02 09:59:31 EDT
Created attachment 79545 [details]
latest version (allows also for external jars)

sorry for last tripe code. there was couple of issue to fix, 
this proposal has the same features and concerns that the last one ;)
Comment 26 Philippe Ombredanne CLA 2007-10-02 12:26:40 EDT
well done!
Comment 27 bartosz michalik CLA 2007-12-03 11:07:21 EST
Created attachment 84326 [details]
job code part 

this is the first part of previous patch. content: creation operation code update
Comment 28 bartosz michalik CLA 2007-12-03 11:10:27 EST
Created attachment 84328 [details]
second part

content: 
- PDEUIMessages + properties file for NewLibraryPluginCreationalPage
- plugin.xml with the new action
- ConvertJarsAction (part that starts wizard commented)
Comment 29 Chris Aniszczyk CLA 2007-12-03 11:52:46 EST
I committed the first wave of patches (patch #1).

I will look at committing the second half of the patch later today. I noticed there were some gnarly ids like "com.ibm.tpm" in there Bartosz, you may want to fix those IDs to be more PDE compliant.

Thanks Bartosz!
Comment 30 bartosz michalik CLA 2007-12-03 12:08:02 EST
Created attachment 84335 [details]
name convention fix

sorry I don't know how that happend. i've never worked on tivoli :)
Comment 31 Chris Aniszczyk CLA 2007-12-03 15:24:43 EST
I committed more code to HEAD Bartosz, the contribution is currently disabled as we don't want to expose anything until it's completely ready. Feel free to continue work and post patches as you progress. It should be much easier to manage.

Also, I will post another bug for you to handle regarding the creation of plug-in projects from JARS. I believe to make things easier, we should create a source folder and put the classes in that source folder, and export all the packages to really make it a true bundle. Currently, we don't do this.
Comment 32 bartosz michalik CLA 2007-12-05 04:26:15 EST
Created attachment 84502 [details]
last part of the patch

wizard + wizard pages
update to CovertJarsAction
(feel free to remove commented part of the plugin.xml)
Comment 33 bartosz michalik CLA 2007-12-05 04:26:21 EST
Created attachment 84503 [details]
mylyn/context/zip
Comment 34 Chris Aniszczyk CLA 2008-01-02 18:13:28 EST
Thanks Bartosz for your hard work on this one. It's a great enhancement!
Comment 35 Chris Aniszczyk CLA 2008-01-02 18:13:32 EST
Created attachment 86041 [details]
mylyn/context/zip