mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-07 17:15: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:
parent
ff25e469db
commit
e37153ae8c
1 changed files with 35 additions and 4 deletions
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - Initial API and implementation
|
* Intel Corporation - Initial API and implementation
|
||||||
* IBM Corporation
|
* IBM Corporation
|
||||||
|
* John Dallaway - Handle reduced build step input resource count (bug 366039)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
|
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
|
||||||
|
|
||||||
|
@ -329,22 +330,32 @@ public class BuildDescription implements IBuildDescription {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!removed && !rebuild){
|
if(!removed){
|
||||||
for (BuildResource rc : rcs) {
|
for (BuildResource rc : rcs) {
|
||||||
if(rc.needsRebuild()){
|
if(rc.needsRebuild()){
|
||||||
if(DbgUtil.DEBUG)
|
if(DbgUtil.DEBUG)
|
||||||
DbgUtil.trace("resource " + locationToRel(rc.getLocation()).toString() + " needs rebuild"); //$NON-NLS-1$ //$NON-NLS-2$
|
DbgUtil.trace("resource " + locationToRel(rc.getLocation()).toString() + " needs rebuild"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
rebuild = true;
|
rebuild = true;
|
||||||
break;
|
}
|
||||||
} else if(rc.isRemoved()){
|
if(rc.isRemoved()){
|
||||||
if(DbgUtil.DEBUG)
|
if(DbgUtil.DEBUG)
|
||||||
DbgUtil.trace("resource " + locationToRel(rc.getLocation()).toString() + " is removed"); //$NON-NLS-1$ //$NON-NLS-2$
|
DbgUtil.trace("resource " + locationToRel(rc.getLocation()).toString() + " is removed"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
rebuild = true;
|
|
||||||
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rebuild = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(removed){
|
if(removed){
|
||||||
if(DbgUtil.DEBUG)
|
if(DbgUtil.DEBUG)
|
||||||
DbgUtil.trace("action to be removed"); //$NON-NLS-1$
|
DbgUtil.trace("action to be removed"); //$NON-NLS-1$
|
||||||
|
@ -356,6 +367,9 @@ public class BuildDescription implements IBuildDescription {
|
||||||
DbgUtil.trace("setting remove state for resource " + locationToRel(outRc.getLocation()).toString()); //$NON-NLS-1$
|
DbgUtil.trace("setting remove state for resource " + locationToRel(outRc.getLocation()).toString()); //$NON-NLS-1$
|
||||||
|
|
||||||
((BuildResource)outRc).setRemoved(true);
|
((BuildResource)outRc).setRemoved(true);
|
||||||
|
|
||||||
|
// Delete the obsolete output file (Bug #366039)
|
||||||
|
deleteResource(outRc);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(rebuild){
|
} 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 class ToolOrderEstimation {
|
||||||
private ITool fTool;
|
private ITool fTool;
|
||||||
private ITool fDeps[];
|
private ITool fDeps[];
|
||||||
|
|
Loading…
Add table
Reference in a new issue