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

Bug 39713

Summary: Ant build not triggered on second save
Product: [Eclipse Project] Platform Reporter: Darin Swanson <Darin_Swanson>
Component: AntAssignee: Jared Burns <jared_burns>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: john.arthorne
Version: 3.0   
Target Milestone: 3.0 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Patch file on ExternalToolBuilder.java none

Description Darin Swanson CLA 2003-07-07 17:40:57 EDT
In the org.eclipse.ant.ui project, in the buildfiles folder, there is 
buildExtraJAR.xml.
This file is included in the working set for the external tool builder for the 
org.eclipse.ant.ui project.
In the build target, Ctrl-X line 7 (<antcall target="refresh"...)
Ctrl-S
External build is triggered.
Ctrl-Z
Ctrl-S
No build is triggered
Comment 1 Darin Swanson CLA 2003-07-07 17:47:57 EDT
Don't even have to use Ctrl-Z.
On line 7, remove the ">"
Ctrl-S (build is triggered)
On line 7, add the ">" (build is not triggered).

Turns out the currentTree of BuildManager is null so we cannot retrieve an 
IResourceDelta using BuildManager.getDelta(IProject)
Comment 2 Darin Swanson CLA 2003-07-07 17:49:29 EDT
John can you provide some insight here?
Comment 3 John Arthorne CLA 2003-07-08 11:03:18 EDT
I've just now read through the history of this through bug 25337 and bug 31510.
I don't understand how the fix for those bugs ever worked.

The last thing the external tool builder does is:

forgetLastBuiltState();

This tells the build manager to throw away the old tree for this builder.  For
this reason, it will never be able to compute a delta during an incremental build.

The reason this was added to the external tool builder is that the build
infrastructure has never supported two instances of the same builder on a given
project.  If two external tool builders are installed, the second one will never
be run because the delta will appear to be empty.  The full story is in bug
21029. This bug has been around for ever, and turned out to be scary to
implement because it requires changes to the format of our single most critical
state file on disk, the .tree file (essentially that's where the builder deltas
are stored).

In thinking about this again this morning, I've thought of another possible
solution to this that won't require scary changes.  You could take out the
"forgetLastBuiltState();" line, thus re-enabling deltas for external tool
builders.  Then, just build all external tools within one builder.  I will
attach a patch on ExternalToolBuilder.java 1.20 to show what I mean.

Comment 4 John Arthorne CLA 2003-07-08 11:03:45 EDT
Created attachment 5394 [details]
Patch file on ExternalToolBuilder.java
Comment 5 John Arthorne CLA 2003-07-08 11:07:49 EDT
Disclaimer: I haven't tried running the patch, it's just an illustration. In
fact, I just realized that you would only want to do that special handling on
incremental builds (because it's only on incremental builds that subsequent
builders will be skipped).  On full builds, all builders will be run anyway.
Comment 6 Darin Swanson CLA 2003-07-08 13:29:35 EDT
Thanks John for the insights and starting point.
Comment 7 Darin Swanson CLA 2003-07-08 15:02:07 EDT
Reworked ExternalToolBuilder using John's patch as a starting point.
Comment 8 Darin Swanson CLA 2003-07-08 15:02:24 EDT
Please verify the changes Jared.
Comment 9 Jared Burns CLA 2003-07-08 17:21:10 EDT
Verified.