Bug 104515 - Tool converter never called
Summary: Tool converter never called
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.0.1   Edit
Assignee: Leo Treggiari CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2005-07-20 11:45 EDT by Leo Treggiari CLA
Modified: 2008-06-19 13:20 EDT (History)
3 users (show)

See Also:


Attachments
Proposed patch (2.34 KB, patch)
2005-07-20 13:40 EDT, Leo Treggiari CLA
bjorn.freeman-benson: iplog+
Details | Diff
Update patch for CDT 2.0 conversion (8.17 KB, patch)
2005-07-21 16:56 EDT, Jeremiah Lott CLA
bjorn.freeman-benson: iplog+
Details | Diff
Test plugin for use in CDT 2.0 (1.58 KB, application/octet-stream)
2005-07-22 15:21 EDT, Jeremiah Lott CLA
no flags Details
Test Plugin for use in CDT 3.0 (2.65 KB, application/octet-stream)
2005-07-22 15:21 EDT, Jeremiah Lott CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Treggiari CLA 2005-07-20 11:45:27 EDT
When adding a converter for a Tool using the new MBS converter extension point, 
the converter is never called.  The problem is in the routine 
ManagedBuildManager.checkForMigrationSupport.  The converter code stores 
information in the project objects while loading the project.  The code in 
checkForMigrationSupport is looking for this information in the wrong place.  
It is looking in the manifest file configurations, rather than the project file 
configurations.  I'd like to fix this for CDT 3.0.  A proposed patch will be 
added soon.  The patch is small and low-risk, and the functionality just 
doesn't work without it.
Comment 1 Chris Recoskie CLA 2005-07-20 11:47:49 EDT
I agree, we should fix this for 3.0.  We really need this.
Comment 2 Leo Treggiari CLA 2005-07-20 13:40:18 EDT
Created attachment 25065 [details]
Proposed patch

Chris & Mikhail,

Please review the patch.

Thanks,
Leo
Comment 3 Jeremiah Lott CLA 2005-07-21 12:13:23 EDT
I tried after applying this patch with a toolchain.  It works better, but I'm 
still having a problem that I think is related to CDT 2.0->3.0 conversion.  
Basically a custom converter isn't set if the project is originally read in 
using the old target/toolref model and then converted to the new model in 
memory.  Therfore the converter is never called.  If I then exit Eclipse and 
start it again, then converter will be called.  I think it would probably work 
OK for 2.1->3.0, but I don't have a CDT 2.1 installation, so I can't confirm.
Comment 4 Mikhail Sennikovsky CLA 2005-07-21 13:36:38 EDT
Leo,

Your patch looks good to me.

 Jeremiah,

 Leo might want to correct me, but it looks that the converte mechanism is not 
                intended to be used for cdt versions<=2.1

Thanks,
Mikhail
Comment 5 Jeremiah Lott CLA 2005-07-21 14:43:55 EDT
I think probably CDT 2.0 is a low priority, although of course not for us ;).  
CDT 2.0 is however, mentioned in the specification at least once, which gives 
the impression that it will work.  Also, it is incredibly close to working so I 
don't see a reason not to support it if someone wants it.  I do understand if 
it is too low priority/risky to make CDT 3.0, though.
Comment 6 Leo Treggiari CLA 2005-07-21 14:52:12 EDT
Hi Jeremiah,

I would certainly like this functionality to also work with CDT 2.0 projects.  
If you have a chance to determine what is wrong, attach a patch to this 
bugzilla and we'll consider it.  I have a couple of people here starting to 
look at it as well.  

Would it help you if this got fixed in a CDT 3.01 release (a couple of months 
out), or is that too late?

Regards,
Leo
Comment 7 Jeremiah Lott CLA 2005-07-21 15:18:42 EDT
I have a number of things, including this, that we would like to possibly put 
in a CDT 3.0.1.  However, from a planning perspective I'm not sure when it 
would be available.  We're looking to put out a CDT 3.0 product soon, and we 
ship "stock" CDT, so we at TimeSys will have to come up with alternate 
solutions unless CDT 3.0.1 falls within our timeframe.  If it's a couple of 
months that may be OK.  If it's mid to late Q4, that may be too late.

Regardless of whether we will be using it, I am willing to help with this.  
I'll see if I can figure out a simple amendment for the patch. 
Comment 8 Jeremiah Lott CLA 2005-07-21 16:56:31 EDT
Created attachment 25157 [details]
Update patch for CDT 2.0 conversion

This patch is a super set of the previous.  I solved this by making
checkForMigrationSupport() public in Tool, ToolChain, and Builder, and
explicitly calling it while running the CDT 2.0 converter.  There might be a
more elegant solution, but this does work.  I sucessfully saw my "dummy"
converter called for each of the three supported element types.
Comment 9 Sunil Davasam CLA 2005-07-22 14:12:29 EDT
Hi Jeremiah,

  you mentioned in the comment that 

"Basically a custom converter isn't set if the project is originally read in 
using the old target/toolref model and then converted to the new model in 
memory.  Therfore the converter is never called".

when will this case arises? I am trying to understand. Is it possible to 
provide a test case for this or can you explain me in more detail ?  I am 
thinking that there may be some problem with test case itself. I would like to 
see the test case.

Thanks & Regards,
Sunil


(In reply to comment #3)
> I tried after applying this patch with a toolchain.  It works better, but 
I'm 
> still having a problem that I think is related to CDT 2.0->3.0 conversion.  
> Basically a custom converter isn't set if the project is originally read in 
> using the old target/toolref model and then converted to the new model in 
> memory.  Therfore the converter is never called.  If I then exit Eclipse and 
> start it again, then converter will be called.  I think it would probably 
work 
> OK for 2.1->3.0, but I don't have a CDT 2.1 installation, so I can't confirm.

Comment 10 Jeremiah Lott CLA 2005-07-22 15:21:25 EDT
Created attachment 25191 [details]
Test plugin for use in CDT 2.0
Comment 11 Jeremiah Lott CLA 2005-07-22 15:21:53 EDT
Created attachment 25192 [details]
Test Plugin for use in CDT 3.0
Comment 12 Jeremiah Lott CLA 2005-07-22 15:31:59 EDT
OK.  I can't send you our actual toolchain, but I attached an example which can 
reproduce the same problem.  Use CDT 2.0, with attached plugin.  Create a 
Managed C Project with the test project type.  Close Eclipse.  Use CDT 3.0 
(with other attached plugin), open the same workspace.  It will prompt you to 
update the project (open C/C++ build properties if it doesn't prompt 
immediately).  Click yes.  Upgrade will be "sucessful" and build info will be 
visible, however the converter class will never be called.  Close Eclipse.  
Open it again (using CDT 3.0).  Converter class will be called after restart 
(again open C/C++ build properties if not called immediately).

I was using both plugins in a self-hosted environment, with the appropriate 
Eclipse.  Eclipse 3.0.1, CDT 2.0.2 for "old".  Eclipse 3.1, CDT head + leo's 
patch for "new".  
Comment 13 Leo Treggiari CLA 2005-07-22 18:58:36 EDT
I have applied my initial proposed patch.  Other fixes will likely have to wait 
until post-3.0.
Comment 14 Sunil Davasam CLA 2005-07-25 15:16:01 EDT
Hi Jeremiah,
   Thanks for attaching the test case. I am able to reproduce the problem and 
also I identified another issue. There are two problems.

   i) If the converters are written based on CDT 2.0 model, they are never 
called due to the condition added on 06/28/05 in the loadBuildInfo() function  
code to fix some other problem. This takes a more time to fix the problem.

  ii) A custom converter isn't set if the project is originally read in 
using the old target/toolref model and then converted to the new model in 
memory and the converter is never called.

 For 2nd problem, I have got a solution and works with the test case. I need 
to review the patch again before sending it to Leo or other committers.

Thanks & Regards,
Sunil



(In reply to comment #12)
> OK.  I can't send you our actual toolchain, but I attached an example which 
can 
> reproduce the same problem.  Use CDT 2.0, with attached plugin.  Create a 
> Managed C Project with the test project type.  Close Eclipse.  Use CDT 3.0 
> (with other attached plugin), open the same workspace.  It will prompt you 
to 
> update the project (open C/C++ build properties if it doesn't prompt 
> immediately).  Click yes.  Upgrade will be "sucessful" and build info will 
be 
> visible, however the converter class will never be called.  Close Eclipse.  
> Open it again (using CDT 3.0).  Converter class will be called after restart 
> (again open C/C++ build properties if not called immediately).
> I was using both plugins in a self-hosted environment, with the appropriate 
> Eclipse.  Eclipse 3.0.1, CDT 2.0.2 for "old".  Eclipse 3.1, CDT head + leo's 
> patch for "new".  

Comment 15 Leo Treggiari CLA 2005-09-16 10:31:19 EDT
Hi Jeremiah,

Your proposed patch has been applied to the 3.0 branch and mainstream.

Thanks,
Leo