1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-06 16:45:25 +02:00

Bug 366039: Internal Builder reduced build step input resource count

Change-Id: I7c7c8ba5d1bf7b96bbef66449ea6470f3c266f98
Signed-off-by: John Dallaway <john@dallaway.org.uk>
(cherry picked from commit e62e2772fe)
This commit is contained in:
John Dallaway 2015-10-26 11:00:04 +00:00 committed by Gerrit Code Review @ Eclipse.org
parent ff25e469db
commit e37153ae8c

View file

@ -8,6 +8,7 @@
* Contributors:
* Intel Corporation - Initial API and implementation
* IBM Corporation
* John Dallaway - Handle reduced build step input resource count (bug 366039)
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
@ -329,18 +330,28 @@ public class BuildDescription implements IBuildDescription {
}
if(!removed && !rebuild){
if(!removed){
for (BuildResource rc : rcs) {
if(rc.needsRebuild()){
if(DbgUtil.DEBUG)
DbgUtil.trace("resource " + locationToRel(rc.getLocation()).toString() + " needs rebuild"); //$NON-NLS-1$ //$NON-NLS-2$
rebuild = true;
break;
} else if(rc.isRemoved()){
}
if(rc.isRemoved()){
if(DbgUtil.DEBUG)
DbgUtil.trace("resource " + locationToRel(rc.getLocation()).toString() + " is removed"); //$NON-NLS-1$ //$NON-NLS-2$
// Remove the obsolete input resource from the action (Bug #366039)
for (BuildIOType type : action.getPrimaryTypes(true)) {
for (BuildResource res : (BuildResource[]) type.getResources()) {
if (res.equals(rc)) {
action.removeResource(type, rc, true);
break;
}
}
}
rebuild = true;
break;
}
}
}
@ -356,6 +367,9 @@ public class BuildDescription implements IBuildDescription {
DbgUtil.trace("setting remove state for resource " + locationToRel(outRc.getLocation()).toString()); //$NON-NLS-1$
((BuildResource)outRc).setRemoved(true);
// Delete the obsolete output file (Bug #366039)
deleteResource(outRc);
}
} else if(rebuild){
@ -379,6 +393,23 @@ public class BuildDescription implements IBuildDescription {
}
}
private void deleteResource(IBuildResource rc) {
if (rc.isProjectResource()) {
final IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(rc.getFullPath());
if ((resource != null) && resource.isDerived(IResource.CHECK_ANCESTORS)) {
if (DbgUtil.DEBUG) {
DbgUtil.trace("deleting resource " + locationToRel(rc.getLocation()).toString()); //$NON-NLS-1$
}
try {
resource.delete(false, null);
} catch (CoreException e) {
ManagedBuilderCorePlugin.log(new Status(IStatus.WARNING,
ManagedBuilderCorePlugin.PLUGIN_ID, IStatus.OK, e.getMessage(), e));
}
}
}
}
private class ToolOrderEstimation {
private ITool fTool;
private ITool fDeps[];