Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivian Kong2010-10-27 14:39:35 -0400
committerVivian Kong2010-10-27 14:39:35 -0400
commitfede2eb62d3791ddcffaa2cf00530ac7eedefcee (patch)
tree45f16e2df1bf1f22b1d3df2f4ee6a6ad37cf3791
parent00e5f762280a23cf12a02f8358449dcbbc81347f (diff)
downloadorg.eclipse.cdt-fede2eb62d3791ddcffaa2cf00530ac7eedefcee.tar.gz
org.eclipse.cdt-fede2eb62d3791ddcffaa2cf00530ac7eedefcee.tar.xz
org.eclipse.cdt-fede2eb62d3791ddcffaa2cf00530ac7eedefcee.zip
Bug 328250 CommonBuilder should use EFSExtensionManager to determine build working directoryv201010271448
-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/internal/core/MakeMessages.properties3
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/DefaultRunSIProvider.java36
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java10
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java14
5 files changed, 64 insertions, 8 deletions
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/internal/core/MakeMessages.properties b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/MakeMessages.properties
index bcb08ceac7..7d3b4e32c9 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
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2003, 2009 QNX Software Systems and others.
+# Copyright (c) 2003, 2010 QNX Software Systems and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -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..8fb3deb922 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;
@@ -23,6 +24,7 @@ import org.eclipse.cdt.core.ICommandLauncher;
import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
+import org.eclipse.cdt.make.core.IMakeBuilderInfo;
import org.eclipse.cdt.make.core.MakeBuilder;
import org.eclipse.cdt.make.core.MakeBuilderUtil;
import org.eclipse.cdt.make.core.MakeCorePlugin;
@@ -35,8 +37,11 @@ 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.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -167,6 +172,25 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
buildInfo.isUseDefaultProviderCommand(providerId));
}
+
+ private 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();
+ }
+
/**
* Initialization of protected fields.
* Subclasses are most likely to override default implementation.
@@ -175,7 +199,17 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
IProject currProject = resource.getProject();
//fWorkingDirectory = resource.getProject().getLocation();
- fWorkingDirectory = MakeBuilderUtil.getBuildDirectory(currProject, MakeBuilder.BUILDER_ID);
+ URI workingDirURI = 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);
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 860ffcd4c4..fa6894b289 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
@@ -80,6 +80,7 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2;
import org.eclipse.cdt.newmake.core.IMakeBuilderInfo;
import org.eclipse.cdt.newmake.internal.core.StreamMonitor;
import org.eclipse.cdt.utils.CommandLineUtil;
+import org.eclipse.cdt.utils.EFSExtensionManager;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
@@ -1871,9 +1872,14 @@ public class CommonBuilder extends ACBuilder {
// remove all markers for this project
removeAllMarkers(currProject);
- IPath workingDirectory = ManagedBuildManager.getBuildLocation(cfg, builder);
URI workingDirectoryURI = ManagedBuildManager.getBuildLocationURI(cfg, builder);
-
+ final String pathFromURI = EFSExtensionManager.getDefault().getPathFromURI(workingDirectoryURI);
+ if(pathFromURI == null) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, ManagedMakeMessages.getString("ManagedMakeBuilder.message.error"), null)); //$NON-NLS-1$
+ }
+
+ IPath workingDirectory = new Path(pathFromURI);
+
String[] targets = getTargets(kind, builder);
if (targets.length != 0 && targets[targets.length - 1].equals(builder.getCleanBuildTarget()))
isClean = true;
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
index 7011bbb536..5fc35506a4 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
@@ -39,6 +39,7 @@ import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.DescriptionBuilder;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.IBuildModelBuilder;
@@ -47,6 +48,7 @@ import org.eclipse.cdt.managedbuilder.internal.buildmodel.StepBuilder;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
+import org.eclipse.cdt.utils.EFSExtensionManager;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
@@ -65,6 +67,7 @@ import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.URIUtil;
@@ -877,9 +880,14 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
try {
- // Figure out the working directory for the build and make sure there is a makefile there
- IPath workingDirectory = getWorkingDirectory().append(buildDir);
- final URI workingDirectoryURI = URIUtil.append(getProject().getLocationURI(), buildDir.toOSString());
+ // Figure out the working directory for the build and make sure there is a makefile there
+ final URI workingDirectoryURI = getProject().getFolder(buildDir).getLocationURI();
+ final String pathFromURI = EFSExtensionManager.getDefault().getPathFromURI(workingDirectoryURI);
+ if(pathFromURI == null) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, ManagedMakeMessages.getString("ManagedMakeBuilder.message.error"), null)); //$NON-NLS-1$
+ }
+
+ IPath workingDirectory = new Path(pathFromURI);
IWorkspace workspace = currentProject.getWorkspace();
if (workspace == null) {

Back to the top