mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Fix for the 125571: wiredness in delta handling in GeneratedMakefileBuilder
This commit is contained in:
parent
a6a899abc5
commit
a7e7af7c47
1 changed files with 46 additions and 52 deletions
|
@ -30,7 +30,6 @@ import org.eclipse.cdt.core.model.ICModelMarker;
|
||||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||||
import org.eclipse.cdt.core.resources.IConsole;
|
import org.eclipse.cdt.core.resources.IConsole;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
|
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildIOType;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildResource;
|
||||||
|
@ -47,7 +46,6 @@ import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IFolder;
|
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -158,58 +156,54 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
IResource resource = delta.getResource();
|
IResource resource = delta.getResource();
|
||||||
// If the project has changed, then a build is needed and we can stop
|
// If the project has changed, then a build is needed and we can stop
|
||||||
if (resource != null && resource.getProject() == getProject()) {
|
if (resource != null && resource.getProject() == getProject()) {
|
||||||
IResourceDelta[] kids = delta.getAffectedChildren();
|
switch(resource.getType()){
|
||||||
for (int index = kids.length - 1; index >= 0; --index) {
|
case IResource.FILE:
|
||||||
IResource changedResource = kids[index].getResource();
|
String name = resource.getName();
|
||||||
if (changedResource instanceof IFolder) {
|
if ((!name.equals(buildGoalName) &&
|
||||||
return true;
|
// TODO: Also need to check for secondary outputs
|
||||||
} else {
|
(resource.isDerived() ||
|
||||||
String name = changedResource.getName();
|
(isProjectFile(resource)) ||
|
||||||
if ((!name.equals(buildGoalName) &&
|
(isGeneratedResource(resource))))) {
|
||||||
// TODO: Also need to check for secondary outputs
|
// The resource that changed has attributes which make it uninteresting,
|
||||||
(changedResource.isDerived() ||
|
// so don't do anything
|
||||||
(isProjectFile(changedResource)) ||
|
;
|
||||||
(isGeneratedResource(changedResource))))) {
|
}
|
||||||
// The resource that changed has attributes which make it uninteresting,
|
else {
|
||||||
// so don't do anything
|
// TODO: Should we do extra checks here to determine if a build is really needed,
|
||||||
;
|
// or do you just do exclusion checks like above?
|
||||||
}
|
// We could check for:
|
||||||
else {
|
// o The build goal name
|
||||||
// TODO: Should we do extra checks here to determine if a build is really needed,
|
// o A secondary output
|
||||||
// or do you just do exclusion checks like above?
|
// o An input file to a tool:
|
||||||
// We could check for:
|
// o Has an extension of a source file used by a tool
|
||||||
// o The build goal name
|
// o Has an extension of a header file used by a tool
|
||||||
// o A secondary output
|
// o Has the name of an input file specified in an InputType via:
|
||||||
// o An input file to a tool:
|
// o An Option
|
||||||
// o Has an extension of a source file used by a tool
|
// o An AdditionalInput
|
||||||
// o Has an extension of a header file used by a tool
|
//
|
||||||
// o Has the name of an input file specified in an InputType via:
|
//if (resourceName.equals(buildGoalName) ||
|
||||||
// o An Option
|
// (buildInfo.buildsFileType(ext) || buildInfo.isHeaderFile(ext))) {
|
||||||
// o An AdditionalInput
|
|
||||||
//
|
// We need to do an incremental build, at least
|
||||||
//if (resourceName.equals(buildGoalName) ||
|
incrBuildNeeded = true;
|
||||||
// (buildInfo.buildsFileType(ext) || buildInfo.isHeaderFile(ext))) {
|
if (delta.getKind() == IResourceDelta.REMOVED) {
|
||||||
|
// If a meaningful resource was removed, then force a full build
|
||||||
|
// This is required because an incremental build will trigger make to
|
||||||
|
// do nothing for a missing source, since the state after the file
|
||||||
|
// removal is uptodate, as far as make is concerned
|
||||||
|
// A full build will clean, and ultimately trigger a relink without
|
||||||
|
// the object generated from the deleted source, which is what we want
|
||||||
|
fullBuildNeeded = true;
|
||||||
|
// There is no point in checking anything else since we have
|
||||||
|
// decided to do a full build anyway
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// We need to do an incremental build, at least
|
//}
|
||||||
incrBuildNeeded = true;
|
}
|
||||||
if (kids[index].getKind() == IResourceDelta.REMOVED) {
|
|
||||||
// If a meaningful resource was removed, then force a full build
|
return false;
|
||||||
// This is required because an incremental build will trigger make to
|
|
||||||
// do nothing for a missing source, since the state after the file
|
|
||||||
// removal is uptodate, as far as make is concerned
|
|
||||||
// A full build will clean, and ultimately trigger a relink without
|
|
||||||
// the object generated from the deleted source, which is what we want
|
|
||||||
fullBuildNeeded = true;
|
|
||||||
// There is no point in checking anything else since we have
|
|
||||||
// decided to do a full build anyway
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue