Bug 223044 - Build All Configurations does not run other project builders.
Summary: Build All Configurations does not run other project builders.
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 4.0.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 5.0   Edit
Assignee: Oleg Krasilnikov CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-03-18 02:03 EDT by Mark Espiritu CLA
Modified: 2008-07-14 16:22 EDT (History)
3 users (show)

See Also:


Attachments
Additional Builders. (31.13 KB, image/jpeg)
2008-03-19 18:37 EDT, Mark Espiritu CLA
no flags Details
First proposed patch. (1.10 KB, patch)
2008-03-19 19:06 EDT, Mark Espiritu CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Espiritu CLA 2008-03-18 02:03:46 EDT
Build ID: I20070625-1500

Steps To Reproduce:
1. Create a C++ Hello World project.
2. Add a builder: /bin/sh.exe -c "touch C:/hello.txt".
3. Build configurations->Build->All
   - The additional builder did not run.

Optional steps:
4. Clean, then Project Build.
   - The additional build did run.
5. Clean, then switch to another configuration, Build project.
   - The additional build did run.
6. Clean, then Build configurations->Build->All
   - The additional builder did not run.


More information:
I looked at the following bugs but they seem a little different or marked as fixed.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=194003
https://bugs.eclipse.org/bugs/show_bug.cgi?id=193808
https://bugs.eclipse.org/bugs/show_bug.cgi?id=194026
Comment 1 Oleg Krasilnikov CLA 2008-03-19 05:39:46 EDT
I'll see.
Comment 2 Oleg Krasilnikov CLA 2008-03-19 07:58:49 EDT
Mark,

I cannot reproduce your problem neither with 
the latest HEAD CDT code nor with cdt4_0 branch.

Do you really use summer's CDT 4.0 release ? 
Is it possible for you to try CDT 4.0.3 ?

Another question, to avoid my misunderstanding.
How do you reproduce the problem, exactly ?
My actions are:
1. Create C++ Hello World project with Cygwin TC
2. Open its properties
3. C/C++ Build -> Builder Settings tab
4. Uncheck "use default build command" checkbox
5. Set build command text to: sh -c "touch C:/hello.txt"
6. Switch Configuration from Debug to Release
7. Repeat steps 4, 5 for Release configuration
8. Press OK.
9. Context menu -> Build configurations -> Build -> All.
Do you perform the same actions ?

Result in my case:

[first screen]
**** Clean-only build of configuration Debug for project touch ****

sh -c touch C:/hello.txt clean 

**** Build of configuration Debug for project touch ****

sh -c touch C:/hello.txt all 

[second screen]
**** Clean-only build of configuration Release for project touch ****

sh -c touch C:/hello.txt clean 

**** Build of configuration Release for project touch ****

sh -c touch C:/hello.txt all 
 
Comment 3 Mark Espiritu CLA 2008-03-19 18:34:38 EDT
Hi Oleg,

Thanks for looking at this issue. 

I'm not sure we did the same thing. Here are the differences:
1) Additional builder I added is a new external program. It's meant to run before the CDT Builder.
   1.1) Right-click on HelloWorldC++ProjectCygwinGCCToolchain project->Properties->Builders
   1.2) Click New->Program. 
        Location: C:\cygwin\bin\sh.exe
        Working Directory: {workspace_loc:/HelloWorldC++ProjectCygwinGCCToolchain}
        Arguments: -c "touch  C:/hello.txt"
2) I did not uncheck the "use default build command". This is only for what make is used in the CDT builder right? I don't think it matters in this case.

I've attached a screen shot to try to make it clear.

Additional info:
I tried looking at the CDT_4_0 code. My guess is that it is in ManagedBuildManager.java line 4625. However, I can't seem to build CDT at the moment to test it out.

--Snip--
private static void buildConfigurations(final IProject project, IConfiguration[] configs, IBuilder builder, final IProgressMonitor monitor) throws CoreException{
//		final IProject project = configs[0].getOwner().getProject();
		final boolean runAllBuidlers = false; // MARK: Maybe This should be true?
...
--Snip--


I hope this helps.

Thanks!

Regards,
Mark
Comment 4 Mark Espiritu CLA 2008-03-19 18:37:52 EDT
Created attachment 92972 [details]
Additional Builders.

Screenshot about additional builders mentioned in this bug.
Comment 5 Mark Espiritu CLA 2008-03-19 19:06:16 EDT
Created attachment 92973 [details]
First proposed patch.

Patch to run other builders when doing Build Configurations->Build->All.
Comment 6 Mark Espiritu CLA 2008-03-19 19:14:11 EDT
Hi Oleg,

I managed to get my CDT running off CVS (cdt_4_0 branch) now.

By the way, to get the Builders preference page, I enabled the org.eclipse.ui.externaltools. 

I submitted a patch for a partial solution. This will run the other builders. However, this will only run it once. I believe we should run the builders once for each configuration. Just like they would if you built each configuration one by one. Perhaps you can help in changing the code?

Thanks!

Regards,
Mark
Comment 7 Oleg Krasilnikov CLA 2008-03-20 07:09:44 EDT
Hi Mark.
Your patch is applied.

Really, the affected code was inherited from old one in cdt.make,
and now nobody (AFAIK) know the reason why additional builders
were disabled here. Anyway, your change made "Build All" feature
consistent with usual build workflow. Thanks !
Comment 8 Julia Perdigueiro CLA 2008-05-29 10:56:34 EDT
Hi Oleg,

I am running CDT 5.0 downloaded from the wiki page today (May 29th) and I have verified that my builder, which runs after CDT builders, is in fact called, but I wish to know which configurations were built (my builder uses this information). This information is already available on builder invocation on the "map" variable, but this is passed only to the CDT builder org.eclipse.cdt.managedbuilder.core.genmakebuilder.

Is there a problem on passing on this argument as well on other builder invocations? Is there some other way I can retrieve this information?
I'm guessing the answers would be "no" and "no" :)

Is it in time to include this on CDT 5.0? Otherwise I will have to keep working around this situation (I'm using IResourceChangeListener on my workaround, not very pleasant :) ).


Thanks in advance,

Julia
Comment 9 Nickolay CLA 2008-07-14 16:20:35 EDT
This bug isnt actually resolved, at last in 5.0.0.200806171202..
I having problems with external builders - they simply don't work..
Comment 10 Nickolay CLA 2008-07-14 16:22:58 EDT
Actually it seems to start working, when my external builder became the only active builder for project, otherwise it is ignored..