Bug 206540 - external builder doesn't run "after a clean"
Summary: external builder doesn't run "after a clean"
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 normal with 2 votes (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Szymon Brandys CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-10-16 17:30 EDT by David Mansfield CLA
Modified: 2018-08-01 08:49 EDT (History)
7 users (show)

See Also:
john.arthorne: review+


Attachments
BuildManager patch (1.14 KB, patch)
2007-12-06 19:56 EST, Isaac Pacht CLA
no flags Details | Diff
Fix 01 (7.83 KB, patch)
2008-01-17 08:38 EST, Szymon Brandys CLA
no flags Details | Diff
Proposal 02 (8.30 KB, patch)
2008-01-21 11:54 EST, Szymon Brandys CLA
no flags Details | Diff
Proposal 02 (8.23 KB, patch)
2008-01-21 13:06 EST, Szymon Brandys CLA
no flags Details | Diff
Proposal 02 (8.21 KB, patch)
2008-01-21 13:44 EST, Szymon Brandys CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Mansfield CLA 2007-10-16 17:30:50 EDT
Build ID: M20070921-1145

Steps To Reproduce:
1. new java project "test1"
2. new class "test1" (some crap 'public static int foo=1;')
3. project->properties->builders->new->program->ok
4. on 'main' tab, use '/bin/ls' or other output generating program for 'location'
5. on 'build options' tab, select only 'after a clean'
6. click ok 
7. the builder runs immediately
8. project->clean->ok
9. the builder doesn't run
10. change the class
11. the builder doesn't run
12. project->clean->ok
13. the builder doesn't run

eg. the builder doesn't run after a clean like it's supposed to



More information:
Comment 1 Jerome Lanneluc CLA 2007-10-17 04:59:05 EDT
Shouldn't this be moved to Platform/Resources since the Java builder is not involved here ?
Comment 2 Philipe Mulet CLA 2007-10-17 06:14:19 EDT
This is not JDT.
Comment 3 Szymon Brandys CLA 2007-10-24 07:48:41 EDT
I can see the same behavior in 3.4M2 too.
Comment 4 Isaac Pacht CLA 2007-11-21 20:11:19 EST
I have the same problem in 3.3 (and 3.3.1 and 3.3.2), but not 3.2.x, although my case is with Ant builders.  Could this be considered for fixing in the 3.3.x line?  (I assume the "version 3.4" status of the bug means it is not at this point.)

I tried to debug this.  I found that the build that is triggered after a clean is an incremental build (which seems to be transformed into auto, if that option is on).  In version 3.2, this code in BuildManager converts it to a full build, and so the "after clean" build is triggered:

			if (!clean && lastBuiltTree == null)
				trigger = IncrementalProjectBuilder.FULL_BUILD;

In 3.3, there is similar code:

			if (!clean && currentLastBuiltTree == null)
				trigger = IncrementalProjectBuilder.FULL_BUILD;

but, the currentLastBuiltTree is non-null, and so the build remains incremental (or auto) and does not trigger the "after clean" builder.

Is the tree supposed to be null?  Does it make sense that the build is initially triggered as incremental instead of full?  Is there some other way of manually initiating a full build of a project(s), which could be used as a work-around?
Comment 5 Isaac Pacht CLA 2007-11-29 16:00:35 EST
I tried experimenting with changing the build performed after a clean to full and it fixed the problem - at least when auto build is off.  When auto build is on, however, it doesn't help.  It seems I was mistaken when I said previously that an incremental build is transformed into an auto build when that option is on.  Instead, it seems that no build at all is triggered after a clean when auto build is on, and it is just the standard auto build kicking in.

Of course, I am sure that changing this to full build is not the right approach, and would probably cause serious  problems elsewhere, since it always worked with incremental and auto builds in the past, and that the real issue is why the delta tree is now non-null.

If this is not a priority for fixing soon, I would appreciate even just some suggestions for further analysis, as this bug is causing me a lot of pain.
Comment 6 Isaac Pacht CLA 2007-12-06 19:54:19 EST
This seems to be the same as bug 182781, but that bug is marked as having been fixed.

I have a patch that solved the problem for me, which I will try to attach.
Comment 7 Isaac Pacht CLA 2007-12-06 19:56:55 EST
Created attachment 84692 [details]
BuildManager patch

This patch clears the builder's delta state when a clean is performed.  As a result, the incremental/auto build that follows the clean will become a full build and the "build after clean" builder will be triggered.
Comment 8 John Arthorne CLA 2007-12-07 09:00:39 EST
Yes, this is a regression caused by the fix for bug 182781. A simpler fix may be to move the if (!builder.getCommand().isBuilding(trigger)) statement into the try/finally, since the finally block ensures the build state is discarded on clean.
Comment 9 Isaac Pacht CLA 2007-12-08 19:24:12 EST
If the "if isbuilding" statement were moved inside the try/finally, wouldn't the delta state be updated for all build types, instead of just for clean, and result in a regression of bug 173931, as described in bug 182781?  Unless, an explicit check were added to the finally block to not touch the delta state if "not doing a clean and the builder is not being invoked", in which case, it would be simpler to leave the "if isbuilding" outside the try/finally and do the check there, as in my patch.
Comment 10 Szymon Brandys CLA 2008-01-17 08:38:32 EST
Created attachment 87153 [details]
Fix 01
Comment 11 Szymon Brandys CLA 2008-01-21 11:54:48 EST
Created attachment 87417 [details]
Proposal 02

It is just a proposal.

FULL_BUILD will be triggered during a manual/auto build only if the builder doesn't respond to INCREMENTAL_BUILD/AUTO_BUILD trigger.
Comment 12 Szymon Brandys CLA 2008-01-21 13:06:14 EST
Created attachment 87424 [details]
Proposal 02
Comment 13 Szymon Brandys CLA 2008-01-21 13:44:33 EST
Created attachment 87431 [details]
Proposal 02
Comment 14 John Arthorne CLA 2008-01-23 20:28:47 EST
Fix released. I ended up going with Isaac's patch to BuildManager, and the JUnit tests from Szymon's proposal 02. Thanks all.
Comment 15 Szymon Brandys CLA 2008-02-06 07:22:10 EST
Verified in I20080205-0010.
Comment 16 M Stevens CLA 2014-05-07 20:15:51 EDT
This seems broken again in Kepler (SR2). Can somebody look into it?