1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Patch for Sean Evoy:

This is a fix for the bug 41275. The problem was pretty simple; the delta 
passed to a project when one of the projects it depends on changes, is 
empty. I tried to optimize the managed builder to run only when a change 
was passed to it, but this is a valid case. Now, if there is a 0-length 
delta passed to a project, it simply calls make without regenerating any 
makefiles.
This commit is contained in:
Doug Schaefer 2003-09-29 18:49:06 +00:00
parent aa1f86e596
commit 103296262c
3 changed files with 34 additions and 8 deletions

View file

@ -1,3 +1,19 @@
2003-09-26 Sean Evoy
I added a fix to the builder and makefile generator to properly handle the following case.
Project A depends on Project B. Something changes in project B and the user requests
that A be built. Inthis case, the incremental builder is invoked, but it is passed a
0-length delta on the top resource. Now, the logic of the builder is to treat that case as a
build event that triggers no makefile regeneration, just an invocation of make.
Now handles the case where there is no flag applied to the make command and just
passes the targets as arguments.
* src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
The makefile generator now considers the case where the delta is for a project resource
and has no children. If so, it flags that a build is needed but no makefile generation
occurs. It also throws a new exception if the top makefile is not saved.
* src/org/eclipse/cdt/managedbuilder/internal/core/MakefileGenerator.java
2003-09-25 Sean Evoy 2003-09-25 Sean Evoy
A patch to resolve the problem with refreshing the project after a build, or A patch to resolve the problem with refreshing the project after a build, or
bug 42522 if you care about those sorts of things. The managed make builder was bug 42522 if you care about those sorts of things. The managed make builder was

View file

@ -171,6 +171,9 @@ public class GeneratedMakefileBuilder extends ACBuilder {
if (e.getStatus().getCode() == GeneratedMakefileBuilder.EMPTY_PROJECT_BUILD_ERROR) { if (e.getStatus().getCode() == GeneratedMakefileBuilder.EMPTY_PROJECT_BUILD_ERROR) {
// Just keep looking for other projects // Just keep looking for other projects
continue; continue;
} else {
// Throw the exception back to the builder
throw e;
} }
} }
} }
@ -312,7 +315,10 @@ public class GeneratedMakefileBuilder extends ACBuilder {
// Get the arguments to be passed to make from build model // Get the arguments to be passed to make from build model
ArrayList makeArgs = new ArrayList(); ArrayList makeArgs = new ArrayList();
makeArgs.add(info.getMakeArguments()); String args = info.getMakeArguments();
if (args.length() > 0) {
makeArgs.add(args);
}
makeArgs.addAll(Arrays.asList(getMakeTargets(fullBuild))); makeArgs.addAll(Arrays.asList(getMakeTargets(fullBuild)));
String[] makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]); String[] makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]);

View file

@ -205,12 +205,21 @@ public class MakefileGenerator {
keepLooking = true; keepLooking = true;
break; break;
} }
} if (resource.getType() == IResource.PROJECT) {
// If there is a zero-length delta, something the project depends on has changed so just call make
IResourceDelta[] children = delta.getAffectedChildren();
if (children != null && children.length == 0) {
generator.shouldRunBuild(true);
} else {
keepLooking = true;
}
} else { } else {
// If the resource is part of the generated directory structure don't recurse // If the resource is part of the generated directory structure don't recurse
if (!generator.isGeneratedResource(resource)) { if (!generator.isGeneratedResource(resource)) {
keepLooking = true; keepLooking = true;
} }
} }
return keepLooking; return keepLooking;
} }
} }
@ -816,7 +825,7 @@ public class MakefileGenerator {
* @param fileHandle The file to place the contents in. * @param fileHandle The file to place the contents in.
* @param rebuild FLag signalling that the user is doing a full rebuild * @param rebuild FLag signalling that the user is doing a full rebuild
*/ */
protected void populateTopMakefile(IFile fileHandle, boolean rebuild) { protected void populateTopMakefile(IFile fileHandle, boolean rebuild) throws CoreException {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
// Add the macro definitions // Add the macro definitions
@ -829,12 +838,7 @@ public class MakefileGenerator {
buffer.append(addTargets(rebuild)); buffer.append(addTargets(rebuild));
// Save the file // Save the file
try { Util.save(buffer, fileHandle);
Util.save(buffer, fileHandle);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} }
/* (non-javadoc) /* (non-javadoc)