Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Recoskie2010-10-26 15:27:06 -0400
committerChris Recoskie2010-10-26 15:27:06 -0400
commita2ee72d9c551db43b7e0527363ada6ef9516babf (patch)
treeab335cb0f068cef1f37fa1fc677cf7f0726d3b22 /build/org.eclipse.cdt.make.core
parent5c4d39a370327b96b28663433275a73d54bd3a3f (diff)
downloadorg.eclipse.cdt-a2ee72d9c551db43b7e0527363ada6ef9516babf.tar.gz
org.eclipse.cdt-a2ee72d9c551db43b7e0527363ada6ef9516babf.tar.xz
org.eclipse.cdt-a2ee72d9c551db43b7e0527363ada6ef9516babf.zip
Bug 328250 - CommonBuilder should use EFSExtensionManager to determine build working directory
Diffstat (limited to 'build/org.eclipse.cdt.make.core')
-rw-r--r--build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java9
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java25
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.properties1
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java14
5 files changed, 48 insertions, 3 deletions
diff --git a/build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF
index f522aa4f34..6e2661348b 100644
--- a/build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.make.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.make.core; singleton:=true
-Bundle-Version: 7.0.0.qualifier
+Bundle-Version: 7.1.0.qualifier
Bundle-Activator: org.eclipse.cdt.make.core.MakeCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java
index 4479b7cea5..70b144c51a 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilder.java
@@ -36,6 +36,7 @@ import org.eclipse.cdt.make.internal.core.MakeMessages;
import org.eclipse.cdt.make.internal.core.StreamMonitor;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerInfoConsoleParserFactory;
import org.eclipse.cdt.utils.CommandLineUtil;
+import org.eclipse.cdt.utils.EFSExtensionManager;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -51,6 +52,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
@@ -162,8 +164,13 @@ public class MakeBuilder extends ACBuilder {
// remove all markers for this project
removeAllMarkers(currProject);
- IPath workingDirectory = MakeBuilderUtil.getBuildDirectory(currProject, info);
URI workingDirectoryURI = MakeBuilderUtil.getBuildDirectoryURI(currProject, info);
+ final String pathFromURI = EFSExtensionManager.getDefault().getPathFromURI(workingDirectoryURI);
+ if(pathFromURI == null) {
+ throw new CoreException(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, MakeMessages.getString("MakeBuilder.ErrorWorkingDirectory"), null)); //$NON-NLS-1$
+ }
+
+ IPath workingDirectory = new Path(pathFromURI);
String[] targets = getTargets(kind, info);
if (targets.length != 0 && targets[targets.length - 1].equals(info.getCleanBuildTarget()))
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java
index 1d36551997..4f946deeef 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/MakeBuilderUtil.java
@@ -67,4 +67,29 @@ public class MakeBuilderUtil {
}
return project.getLocationURI();
}
+
+ /**
+ * @param builderID
+ * @return URI of the build directory, or the Project's URI if one couldn't be found
+ * @since 7.1
+ */
+ public static URI getBuildDirectoryURI(IProject project, String builderID) {
+ IMakeBuilderInfo info;
+ try {
+ info = MakeCorePlugin.createBuildInfo(project, builderID);
+ } catch (CoreException e) {
+ return project.getLocationURI();
+ }
+
+ IPath buildDirectory = info.getBuildLocation();
+ if (!buildDirectory.isEmpty()) {
+ IResource res = project.getParent().findMember(buildDirectory);
+ if (res instanceof IContainer && res.exists()) {
+ return res.getLocationURI();
+ }
+ }
+ return project.getLocationURI();
+ }
+
+
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.properties b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.properties
index bcb08ceac7..78f4ad185c 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.properties
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.properties
@@ -18,6 +18,7 @@ MakeBuilder.Invoking_Make_Builder=Invoking Make Builder...
MakeBuilder.Invoking_Command=Invoking Command:
MakeBuilder.Updating_project=Updating project...
MakeBuilder.Creating_Markers=Generating markers...
+MakeBuilder.ErrorWorkingDirectory=Error determining working directory.
BuildInfoFactory.Missing_Builder=Missing Builder:
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java
index 0e38b5ff75..64b7eba1bc 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java
@@ -13,6 +13,7 @@ package org.eclipse.cdt.make.internal.core.scannerconfig2;
import java.io.IOException;
import java.io.OutputStream;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Properties;
@@ -35,6 +36,7 @@ import org.eclipse.cdt.make.internal.core.StreamMonitor;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerInfoConsoleParserFactory;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
+import org.eclipse.cdt.utils.EFSExtensionManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
@@ -175,7 +177,17 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
IProject currProject = resource.getProject();
//fWorkingDirectory = resource.getProject().getLocation();
- fWorkingDirectory = MakeBuilderUtil.getBuildDirectory(currProject, MakeBuilder.BUILDER_ID);
+ URI workingDirURI = MakeBuilderUtil.getBuildDirectoryURI(currProject, MakeBuilder.BUILDER_ID);
+ String pathString = EFSExtensionManager.getDefault().getPathFromURI(workingDirURI);
+ if(pathString != null) {
+ fWorkingDirectory = new Path(pathString);
+ }
+
+ else {
+ // blow up
+ throw new IllegalStateException();
+ }
+
fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId));
fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(buildInfo.getProviderRunArguments(providerId), "\"");//$NON-NLS-1$
return (fCompileCommand != null);

Back to the top