Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorJames Blackburn2010-04-30 12:05:52 -0400
committerJames Blackburn2010-04-30 12:05:52 -0400
commit1e87c2c634bf733a6fcb7146a57eda0dfce8c459 (patch)
tree82de08bfc9abafa57d855803d64a562ace003e01 /build
parente7a52e7c7c4a2069f78892826aae93c9653fbe30 (diff)
downloadorg.eclipse.cdt-1e87c2c634bf733a6fcb7146a57eda0dfce8c459.tar.gz
org.eclipse.cdt-1e87c2c634bf733a6fcb7146a57eda0dfce8c459.tar.xz
org.eclipse.cdt-1e87c2c634bf733a6fcb7146a57eda0dfce8c459.zip
Bug 289986 - Allowing saving resources while running an external Makefile build
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java2
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java3
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java30
3 files changed, 31 insertions, 4 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
index 1616ebf75c..d1c4db44c2 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeTarget.java
@@ -333,7 +333,7 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
}
};
try {
- ResourcesPlugin.getWorkspace().run(op, monitor);
+ ResourcesPlugin.getWorkspace().run(op, null, IResource.NONE, monitor);
} finally {
monitor.done();
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java
index 0a804d4a07..e53aa256d6 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/TargetBuild.java
@@ -18,6 +18,7 @@ import org.eclipse.cdt.make.core.IMakeTarget;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.internal.ui.preferences.MakePreferencePage;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@@ -100,7 +101,7 @@ public class TargetBuild {
target.build(new SubProgressMonitor(monitor, 1));
}
};
- MakeUIPlugin.getWorkspace().run(runnable, monitor);
+ MakeUIPlugin.getWorkspace().run(runnable, null, IResource.NONE, monitor);
}
} catch (CoreException e) {
return e.getStatus();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java
index 5fc270eabc..2e7f41806d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java
@@ -22,8 +22,8 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
@@ -2078,4 +2078,30 @@ public class CommonBuilder extends ACBuilder {
if (markers != null) {
workspace.deleteMarkers(markers);
}
- }}
+ }
+
+ /**
+ * Only lock the workspace is this is a ManagedBuild, or this project references others.
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public ISchedulingRule getRule(int trigger, Map args) {
+ IResource WR_rule = ResourcesPlugin.getWorkspace().getRoot();
+ if (needAllConfigBuild() || !isCdtProjectCreated(getProject()))
+ return WR_rule;
+
+ // Get the builders to run
+ IBuilder builders[] = ManagedBuilderCorePlugin.createBuilders(getProject(), args);
+ // Be pessimistic if we referenced other configs
+ if (getReferencedConfigs(builders).length > 0)
+ return WR_rule;
+ // If any builder isManaged => pessimistic
+ for (IBuilder builder : builders) {
+ if (builder.isManagedBuildOn())
+ return WR_rule;
+ }
+
+ // Success!
+ return null;
+ }
+}

Back to the top