mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
fixed auto builds so project that are not involved dont build
This commit is contained in:
parent
9fba9c63e0
commit
c35aafd192
3 changed files with 88 additions and 51 deletions
|
@ -1,3 +1,8 @@
|
|||
2002-11-20 David Inglis
|
||||
* src/.../internal/core/CBuilder.java
|
||||
fix AUTO_BUILDs so that the builder only builds when the resources change
|
||||
in the project.
|
||||
|
||||
2002-11-20 David Inglis
|
||||
* plugin.xml
|
||||
fixed bug #26640
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ConsoleOutputStream extends OutputStream {
|
|||
}
|
||||
|
||||
|
||||
public String readBuffer() {
|
||||
public synchronized String readBuffer() {
|
||||
String buf = fBuffer.toString();
|
||||
fBuffer.setLength(0);
|
||||
return buf;
|
||||
|
|
|
@ -23,6 +23,8 @@ import org.eclipse.cdt.core.resources.MakeUtil;
|
|||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceDelta;
|
||||
import org.eclipse.core.resources.IResourceDeltaVisitor;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -33,8 +35,6 @@ import org.eclipse.core.runtime.OperationCanceledException;
|
|||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
|
||||
|
||||
|
||||
public class CBuilder extends ACBuilder {
|
||||
|
||||
private static final String BUILD_ERROR = "CBuilder.build_error";
|
||||
|
@ -50,19 +50,45 @@ public class CBuilder extends ACBuilder {
|
|||
return workingDirectory;
|
||||
}
|
||||
|
||||
public class MyResourceDeltaVisitor implements IResourceDeltaVisitor {
|
||||
boolean bContinue;
|
||||
|
||||
public boolean visit(IResourceDelta delta) throws CoreException {
|
||||
IResource resource = delta.getResource();
|
||||
if (resource != null && resource.getProject() == getProject()) {
|
||||
bContinue = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public boolean shouldBuild() {
|
||||
return bContinue;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @see IncrementalProjectBuilder#build
|
||||
*/
|
||||
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
|
||||
boolean bPerformBuild = true;
|
||||
if (kind == IncrementalProjectBuilder.AUTO_BUILD) {
|
||||
MyResourceDeltaVisitor vis = new MyResourceDeltaVisitor();
|
||||
IResourceDelta delta = getDelta(getProject());
|
||||
if (delta != null ) {
|
||||
delta.accept(vis);
|
||||
bPerformBuild = vis.shouldBuild();
|
||||
} else
|
||||
bPerformBuild = false;
|
||||
}
|
||||
if ( bPerformBuild ) {
|
||||
boolean isClean = invokeMake((kind == IncrementalProjectBuilder.FULL_BUILD), monitor);
|
||||
if (isClean) {
|
||||
forgetLastBuiltState();
|
||||
}
|
||||
}
|
||||
checkCancel(monitor);
|
||||
return getProject().getReferencedProjects();
|
||||
}
|
||||
|
||||
|
||||
private boolean invokeMake(boolean fullBuild, IProgressMonitor monitor) {
|
||||
boolean isClean = false;
|
||||
boolean fatalBuild = false;
|
||||
|
@ -128,7 +154,8 @@ public class CBuilder extends ACBuilder {
|
|||
|
||||
try {
|
||||
currProject.refreshLocal(IResource.DEPTH_INFINITE, subMonitor);
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
catch (CoreException e) {
|
||||
}
|
||||
|
||||
subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
|
||||
|
@ -149,7 +176,8 @@ public class CBuilder extends ACBuilder {
|
|||
subMonitor.done();
|
||||
monitor.setCanceled(isCanceled);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
monitor.done();
|
||||
|
@ -173,11 +201,13 @@ public class CBuilder extends ACBuilder {
|
|||
if (!nature.isStopOnError()) {
|
||||
list.add("-k");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
String[] ovrd_args = makeArray(nature.getFullBuildArguments());
|
||||
list.addAll(Arrays.asList(ovrd_args));
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
catch (CoreException e) {
|
||||
}
|
||||
|
||||
String sessionTarget = MakeUtil.getSessionTarget((IResource) currProject);
|
||||
|
@ -207,14 +237,16 @@ public class CBuilder extends ACBuilder {
|
|||
if (array[i] == '"' || array[i] == '\'') {
|
||||
if (i > 0 && array[i - 1] == '\\') {
|
||||
inComment = false;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
inComment = !inComment;
|
||||
}
|
||||
}
|
||||
if (c == ' ' && !inComment) {
|
||||
aList.add(buffer.toString());
|
||||
buffer = new StringBuffer();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
buffer.append(c);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue