1
0
Fork 0
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:
Mikhail Sennikovsky 2006-08-28 15:08:15 +00:00
parent a6a899abc5
commit a7e7af7c47

View file

@ -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
//
//if (resourceName.equals(buildGoalName) ||
// (buildInfo.buildsFileType(ext) || buildInfo.isHeaderFile(ext))) {
// We need to do an incremental build, at least // We need to do an incremental build, at least
incrBuildNeeded = true; incrBuildNeeded = true;
if (kids[index].getKind() == IResourceDelta.REMOVED) { if (delta.getKind() == IResourceDelta.REMOVED) {
// If a meaningful resource was removed, then force a full build // If a meaningful resource was removed, then force a full build
// This is required because an incremental build will trigger make to // This is required because an incremental build will trigger make to
// do nothing for a missing source, since the state after the file // do nothing for a missing source, since the state after the file
// removal is uptodate, as far as make is concerned // removal is uptodate, as far as make is concerned
// A full build will clean, and ultimately trigger a relink without // A full build will clean, and ultimately trigger a relink without
// the object generated from the deleted source, which is what we want // the object generated from the deleted source, which is what we want
fullBuildNeeded = true; fullBuildNeeded = true;
// There is no point in checking anything else since we have // There is no point in checking anything else since we have
// decided to do a full build anyway // decided to do a full build anyway
break; break;
} }
//} //}
}
} }
return false;
} }
return false;
} }
return true; return true;
} }