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

Bug 186204

Summary: Build.xml created in the wrong plug-in in a Bauman-Brian face-off
Product: [Eclipse Project] PDE Reporter: Wassim Melhem <wassim.melhem>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: baumanbr
Version: 3.3Flags: aniefer: review+
Target Milestone: 3.3 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch introducing the ability to specify the version of the plugin
none
new pde build patch allowing the model to be passed in
none
The patch export had not completed...
none
patch for pde ui
none
new new patch none

Description Wassim Melhem CLA 2007-05-09 13:02:52 EDT
1. Create a new plug-in project where both the project name and bundle ID is 'org.eclipse.brian'.

2. Create a new plug-in project where the project name is 'org.eclipse.bauman', but the bundle ID is 'org.eclipse.brian'.

3. Right-click on the manifest for org.eclipse.bauman and select PDE Tools > Create Ant Build file

Nothing seems to happen.  However, something did happen.  The file was created erroneously in the other project but no refresh took place.
Comment 1 Brian Bauman CLA 2007-05-09 14:51:19 EDT
Seems to be a Build problem.  The problem is coming in when the build tries to create the build file.

The BuildScriptGenerator creates a new ModelBuildScriptGenerator for each plug-in needs a new build file.  When initializing the ModelBuildScriptGenerator information (BuildScriptGenerator:134), the id of the bundle which needs the build file is passed into the ModelBuildScriptGenerator.  

The ModelBuildScriptGernerator tries to find the resovled bundle for that id (ModelBuildScriptGenerator.getModel(String id):1297).  The BundleDescription which is returned is the wrong bundle.

In the ModelBuildScriptGenerator.generate() call, the location of the build.xml file is determined on ModelBuildScriptGenerator line 148, by a call to 'getLocation(BundleDescription)'.  Since the BundleDescription is not the correct one for the project, the build.xml is created in the wrong project.

Looks like we might need to figure out a way to pass more information during the build process.
Comment 2 Wassim Melhem CLA 2007-05-09 15:02:52 EDT
Brian, I think pde/build already supports passing version numbers.  They support that for features, so they must also support it for plug-ins.

See BuildFeatureAction for format.  If that works, then move back to our bucket.
Comment 3 Brian Bauman CLA 2007-05-10 11:16:32 EDT
It would not surprise me if the Build allows passing versions.  The problem is with the scenario in the bug report, both plug-ins have the same version.  Is this something we support?
Comment 4 Wassim Melhem CLA 2007-05-10 11:24:35 EDT
no, we could live without it.  Just make sure the 'different version' scenario works.
Comment 5 Brian Bauman CLA 2007-05-10 15:49:01 EDT
I am going to keep it in the PDE Build box until someone can tell me how to set
plug-in versions.  The value we set in the script builder to gernerate the files for a plug-in is "plugin@<id>".

After tracing through PDE Build code to figure out if there are any other
parameters/attributes we could add to the value, it appears the code chops off
the "plugin@" from the String and then assumes the remaining part of the String
is a plug-in id.

PDE Build might have a different way to set the version, but I can't figure out
how to do it after tracing through code.  Any help from experienced PDE Build
developers is appreciated :)
Comment 6 Wassim Melhem CLA 2007-05-10 16:19:04 EDT
Brian, I told you to take a look at BuildFeatureAction in comment 2.  We pass feature versions there.
Comment 7 Brian Bauman CLA 2007-05-10 17:12:30 EDT
PDE Build allows you to specify a version of a feature you wish to crate build files for (format is <id>:<version>), but does not allow the same for plugins.  We could make this work if we create a dummy feature every time we want to create build scripts for any of our plug-ins.  The problem is it takes us time to create the xml file, it will take the PDE Build time to generate the build.xml for the feature, and then we have to delete the contents when it is all done.

But I think it would be easiest if we asked PDE Build to allow us to pass in a version for a plug-in, the same way they do for a feature.
Comment 8 Wassim Melhem CLA 2007-05-10 19:55:52 EDT
Yes, thanks Brian.  I just wanted you to verify if passing in the version already works or not.

Andrew/DJ, at minimum pde/build should support plug-in version.  Ideally, we should be able to pass you a plug-in location, so that even if there are multiple plug-ins by the same version, you will be able to pick up the right version.
Comment 9 Pascal Rapicault CLA 2007-05-10 23:00:22 EDT
Created attachment 66803 [details]
Patch introducing the ability to specify the version of the plugin

Using the same syntax used by feature, the patch allows a version to be specified for plug-ins and the right version is being picked (in short use :<version> after the plug-in id when setting the elements).
This will work for most cases but... it does not work in case where I have in my workspace two plug-ins with the same version number:
  A v1.0.0
  A v1.0.0

Question to Wassim and Brian, is this really supported? If so I will attach another patch where you can directly pass in the BundleDescription.
Comment 10 Wassim Melhem CLA 2007-05-10 23:05:58 EDT
Pascal, PDE/UI supports anything and everything now.  

So to be on the safe side, let's support two plug-ins with the same ID and version also.

We can pass you the bundle description or the bundle ID (ie. the one of type 'long') if you want.
Comment 11 Pascal Rapicault CLA 2007-05-11 10:41:24 EDT
Created attachment 66859 [details]
new pde build patch allowing the model to be passed in
Comment 12 Pascal Rapicault CLA 2007-05-11 10:42:33 EDT
Created attachment 66860 [details]
The patch export had not completed...
Comment 13 Pascal Rapicault CLA 2007-05-11 10:43:42 EDT
Created attachment 66861 [details]
patch for pde ui
Comment 14 Pascal Rapicault CLA 2007-05-11 10:44:07 EDT
Andrew please review.
Comment 15 Andrew Niefer CLA 2007-05-11 15:05:18 EDT
Pascal, the patch here is still incomplete.  It is missing changes to ModelBuildScriptGenerator
Comment 16 Pascal Rapicault CLA 2007-05-11 15:39:26 EDT
Created attachment 66930 [details]
new new patch
Comment 17 Andrew Niefer CLA 2007-05-11 16:35:50 EDT
+1 and released

Sending over to UI in case they want pascal's patch for their side.
Comment 18 Wassim Melhem CLA 2007-05-11 16:44:09 EDT
Released pde/ui patch.  Thanks.