Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorChris Recoskie2006-05-24 19:51:30 +0000
committerChris Recoskie2006-05-24 19:51:30 +0000
commitd849fab5d144f12235863e8454f68ad4e51ecbaa (patch)
treed1b0af059ba47c3e116c8d479e795c5e725aa571 /build
parent9174d8ce5802e70349434eaccc63eb61f36e21a6 (diff)
downloadorg.eclipse.cdt-d849fab5d144f12235863e8454f68ad4e51ecbaa.tar.gz
org.eclipse.cdt-d849fab5d144f12235863e8454f68ad4e51ecbaa.tar.xz
org.eclipse.cdt-d849fab5d144f12235863e8454f68ad4e51ecbaa.zip
fix for 137674
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java48
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyGenerator2.java27
-rwxr-xr-xbuild/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java8
-rwxr-xr-xbuild/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java57
-rwxr-xr-xbuild/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java11
-rwxr-xr-xbuild/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3Commands.java55
-rwxr-xr-xbuild/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuild.java9
-rwxr-xr-xbuild/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuildCommands.java53
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java21
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/ManagedBuildGnuToolInfo.java2
10 files changed, 262 insertions, 29 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java
index 3d320173be8..c3f974c49c8 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildDescription.java
@@ -1218,30 +1218,46 @@ public class BuildDescription implements IBuildDescription {
if(ext == null)
ext = buildRc.getLocation().getFileExtension();
- if(ext != null){
- IManagedDependencyGeneratorType depGenType = tool.getDependencyGeneratorForExtension(ext);
- if(depGenType != null){
+ if (ext != null) {
+ IManagedDependencyGeneratorType depGenType = tool
+ .getDependencyGeneratorForExtension(ext);
+ if (depGenType != null) {
IPath depFiles[] = null;
- if(depGenType instanceof IManagedDependencyGenerator2){
+ if (depGenType instanceof IManagedDependencyGenerator2) {
IBuildObject context = tool.getParent();
- if(context instanceof IToolChain){
- context = ((IToolChain)context).getParent();
+ if (context instanceof IToolChain) {
+ context = ((IToolChain) context).getParent();
}
- IPath path = buildRc.isProjectResource() ?
- buildRc.getFullPath().removeFirstSegments(1) :
- buildRc.getLocation();
- IManagedDependencyInfo info = ((IManagedDependencyGenerator2)depGenType).getDependencySourceInfo(path, context, tool, getDefaultBuildDirLocation());
- if(info instanceof IManagedDependencyCommands){
- depFiles = ((IManagedDependencyCommands)info).getDependencyFiles();
+ IPath path = buildRc.isProjectResource() ? buildRc
+ .getFullPath().removeFirstSegments(1)
+ : buildRc.getLocation();
+
+ IResource resource = buildRc.isProjectResource() ? fProject
+ .findMember(buildRc.getLocation())
+ : null;
+
+ IManagedDependencyInfo info = ((IManagedDependencyGenerator2) depGenType)
+ .getDependencySourceInfo(path, resource,
+ context, tool,
+ getDefaultBuildDirLocation());
+ if (info instanceof IManagedDependencyCommands) {
+ depFiles = ((IManagedDependencyCommands) info)
+ .getDependencyFiles();
}
} else if (depGenType.getCalculatorType() == IManagedDependencyGeneratorType.TYPE_COMMAND
&& depGenType instanceof IManagedDependencyGenerator) {
depFiles = new IPath[1];
- depFiles[0] = new Path(buildRc.getLocation().segment(buildRc.getLocation().segmentCount() -1 )).removeFileExtension().addFileExtension("d"); //$NON-NLS-1$
+ depFiles[0] = new Path(buildRc.getLocation()
+ .segment(
+ buildRc.getLocation()
+ .segmentCount() - 1))
+ .removeFileExtension()
+ .addFileExtension("d"); //$NON-NLS-1$
}
-
- if(depFiles != null){
- BuildIOType depType = action.createIOType(false, false, null);
+
+ if (depFiles != null) {
+ BuildIOType depType = action.createIOType(false,
+ false, null);
addOutputs(depFiles, depType, outDirPath);
}
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyGenerator2.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyGenerator2.java
index 1e28c6046cf..efba2ebd782 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyGenerator2.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedDependencyGenerator2.java
@@ -13,6 +13,7 @@ package org.eclipse.cdt.managedbuilder.makegen;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.cdt.managedbuilder.core.ITool;
@@ -58,6 +59,32 @@ public interface IManagedDependencyGenerator2 extends IManagedDependencyGenerato
*
* @param source The source file for which dependencies should be calculated
* The IPath can be either relative to the project directory, or absolute in the file system.
+ * @param resource The IResource corresponding to the source file, or null if the file
+ * is not a workspace resource.
+ * @param buildContext The IConfiguration or IResourceConfiguration that
+ * contains the context in which the source file will be built
+ * @param tool The tool associated with the source file
+ * @param topBuildDirectory The top build directory of the configuration. This is
+ * the working directory for the tool. This IPath is relative to the project directory.
+ * @return IManagedDependencyInfo
+ */
+ public IManagedDependencyInfo getDependencySourceInfo(
+ IPath source,
+ IResource resource,
+ IBuildObject buildContext,
+ ITool tool,
+ IPath topBuildDirectory);
+
+ /**
+ * Returns an instance of IManagedDependencyInfo for this source file.
+ * IManagedDependencyCalculator, IManagedDependencyCommands
+ * and IManagedDependencyPreBuild are all derived from
+ * IManagedDependencyInfo, and any one of the three can be returned.
+ * This is called when getCalculatorType returns TYPE_BUILD_COMMANDS,
+ * TYPE_CUSTOM or TYPE_PREBUILD_COMMANDS.
+ *
+ * @param source The source file for which dependencies should be calculated
+ * The IPath can be either relative to the project directory, or absolute in the file system.
* @param buildContext The IConfiguration or IResourceConfiguration that
* contains the context in which the source file will be built
* @param tool The tool associated with the source file
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java
index 5fd84519ae3..7133c9fe519 100755
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2.java
@@ -16,6 +16,7 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
/**
@@ -54,6 +55,13 @@ public class DefaultGCCDependencyCalculator2 implements
* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
*/
+ public IManagedDependencyInfo getDependencySourceInfo(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ return new DefaultGCCDependencyCalculator2Commands(source, resource, buildContext, tool, topBuildDirectory);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
+ */
public IManagedDependencyInfo getDependencySourceInfo(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
return new DefaultGCCDependencyCalculator2Commands(source, buildContext, tool, topBuildDirectory);
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java
index c570177e9ea..529ebee833c 100755
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator2Commands.java
@@ -20,7 +20,8 @@ import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.resources.IProject;;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
/**
* This dependency calculator uses the GCC -MMD -MF -MP -MT options in order to
@@ -39,6 +40,7 @@ public class DefaultGCCDependencyCalculator2Commands implements
// Member variables set by the constructor
IPath source;
+ IResource resource;
IBuildObject buildContext;
ITool tool;
IPath topBuildDirectory;
@@ -55,14 +57,16 @@ public class DefaultGCCDependencyCalculator2Commands implements
*
* @param source The source file for which dependencies should be calculated
* The IPath can be either relative to the project directory, or absolute in the file system.
+ * @param resource The IResource corresponding to the source file.
* @param buildContext The IConfiguration or IResourceConfiguration that
* contains the context in which the source file will be built
* @param tool The tool associated with the source file
* @param topBuildDirectory The top build directory of the configuration. This is
* the working directory for the tool. This IPath is relative to the project directory.
*/
- public DefaultGCCDependencyCalculator2Commands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ public DefaultGCCDependencyCalculator2Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
this.source = source;
+ this.resource = resource;
this.buildContext = buildContext;
this.tool = tool;
this.topBuildDirectory = topBuildDirectory;
@@ -81,7 +85,24 @@ public class DefaultGCCDependencyCalculator2Commands implements
// A separate rule is needed for the resource in the case where explicit file-specific macros
// are referenced, or if the resource contains special characters in its path (e.g., whitespace)
- needExplicitRuleForFile = GnuMakefileGenerator.containsSpecialCharacters(sourceLocation.toString()) ||
+
+ /* fix for 137674
+ *
+ * We only need an explicit rule if one of the following is true:
+ * - The resource is linked, and its full path to its real location contains special characters
+ * - The resource is not linked, but its project relative path contains special characters
+ */
+ boolean resourceNameRequiresExplicitRule = true;
+
+ if(resource != null)
+ {
+ resourceNameRequiresExplicitRule = (resource.isLinked() && GnuMakefileGenerator
+ .containsSpecialCharacters(sourceLocation.toString()))
+ || (!resource.isLinked() && GnuMakefileGenerator
+ .containsSpecialCharacters(resource.getProjectRelativePath().toString()));
+ }
+
+ needExplicitRuleForFile = resourceNameRequiresExplicitRule ||
MacroResolver.getReferencedExplitFileMacros(tool).length > 0
|| MacroResolver.getReferencedExplitFileMacros(
tool.getToolCommand(),
@@ -91,6 +112,36 @@ public class DefaultGCCDependencyCalculator2Commands implements
if (needExplicitRuleForFile) genericCommands = new Boolean(false);
}
+
+ /**
+ * Constructor. This constructor calls
+ * DefaultGCCDependencyCalculator2Commands(IPath source, IResource resource,
+ * IBuildObject buildContext, ITool tool, IPath topBuildDirectory) with a
+ * null resource. The net result of this is that dependency rules will
+ * always be explicit and will never use pattern rules, as it is impossible
+ * for the calculator to know whether the resource is linked or not.
+ *
+ * @param source
+ * The source file for which dependencies should be calculated
+ * The IPath can be either relative to the project directory, or
+ * absolute in the file system.
+ * @param buildContext
+ * The IConfiguration or IResourceConfiguration that contains the
+ * context in which the source file will be built
+ * @param tool
+ * The tool associated with the source file
+ * @param topBuildDirectory
+ * The top build directory of the configuration. This is the
+ * working directory for the tool. This IPath is relative to the
+ * project directory.
+ *
+ * @see DefaultGCCDependencyCalculator2Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
+ */
+ public DefaultGCCDependencyCalculator2Commands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
+ {
+ this(source, (IResource) null, buildContext, tool, topBuildDirectory);
+ }
+
/*
* (non-Javadoc)
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
index 65eddf9d909..0c657798800 100755
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3.java
@@ -21,6 +21,7 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -61,8 +62,14 @@ public class DefaultGCCDependencyCalculator3 implements
return IManagedBuilderMakefileGenerator.DEP_EXT;
}
- /*
- * (non-Javadoc)
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.core.resources.IResource, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
+ */
+ public IManagedDependencyInfo getDependencySourceInfo(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ return new DefaultGCCDependencyCalculator3Commands(source, resource, buildContext, tool, topBuildDirectory);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
*/
public IManagedDependencyInfo getDependencySourceInfo(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3Commands.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3Commands.java
index b79d9e3b321..28d7bcca1cf 100755
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3Commands.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculator3Commands.java
@@ -25,7 +25,8 @@ import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.resources.IProject;;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
/**
* This dependency calculator uses the same dependency management technique as the
@@ -50,6 +51,7 @@ public class DefaultGCCDependencyCalculator3Commands implements
// Member variables set by the constructor
IPath source;
+ IResource resource;
IBuildObject buildContext;
ITool tool;
IPath topBuildDirectory;
@@ -74,8 +76,9 @@ public class DefaultGCCDependencyCalculator3Commands implements
* @param topBuildDirectory The top build directory of the configuration. This is
* the working directory for the tool. This IPath is relative to the project directory.
*/
- public DefaultGCCDependencyCalculator3Commands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ public DefaultGCCDependencyCalculator3Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
this.source = source;
+ this.resource = resource;
this.buildContext = buildContext;
this.tool = tool;
this.topBuildDirectory = topBuildDirectory;
@@ -96,7 +99,24 @@ public class DefaultGCCDependencyCalculator3Commands implements
// A separate rule is needed for the resource in the case where explicit file-specific macros
// are referenced, or if the resource contains special characters in its path (e.g., whitespace)
- needExplicitRuleForFile = GnuMakefileGenerator.containsSpecialCharacters(sourceLocation.toString()) ||
+
+ /* fix for 137674
+ *
+ * We only need an explicit rule if one of the following is true:
+ * - The resource is linked, and its full path to its real location contains special characters
+ * - The resource is not linked, but its project relative path contains special characters
+ */
+ boolean resourceNameRequiresExplicitRule = true;
+
+ if(resource != null)
+ {
+ resourceNameRequiresExplicitRule = (resource.isLinked() && GnuMakefileGenerator
+ .containsSpecialCharacters(sourceLocation.toString()))
+ || (!resource.isLinked() && GnuMakefileGenerator
+ .containsSpecialCharacters(resource.getProjectRelativePath().toString()));
+ }
+
+ needExplicitRuleForFile = resourceNameRequiresExplicitRule ||
MacroResolver.getReferencedExplitFileMacros(tool).length > 0
|| MacroResolver.getReferencedExplitFileMacros(
tool.getToolCommand(),
@@ -108,6 +128,35 @@ public class DefaultGCCDependencyCalculator3Commands implements
genericCommands = false;
}
+ /**
+ * Constructor. This constructor calls
+ * DefaultGCCDependencyCalculator3Commands(IPath source, IResource resource,
+ * IBuildObject buildContext, ITool tool, IPath topBuildDirectory) with a
+ * null resource. The net result of this is that dependency rules will
+ * always be explicit and will never use pattern rules, as it is impossible
+ * for the calculator to know whether the resource is linked or not.
+ *
+ * @param source
+ * The source file for which dependencies should be calculated
+ * The IPath can be either relative to the project directory, or
+ * absolute in the file system.
+ * @param buildContext
+ * The IConfiguration or IResourceConfiguration that contains the
+ * context in which the source file will be built
+ * @param tool
+ * The tool associated with the source file
+ * @param topBuildDirectory
+ * The top build directory of the configuration. This is the
+ * working directory for the tool. This IPath is relative to the
+ * project directory.
+ *
+ * @see DefaultGCCDependencyCalculator3Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
+ */
+ public DefaultGCCDependencyCalculator3Commands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
+ {
+ this(source, (IResource) null, buildContext, tool, topBuildDirectory);
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#areCommandsGeneric()
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuild.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuild.java
index b78d15357e2..41f676d9e9b 100755
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuild.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuild.java
@@ -16,6 +16,7 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
@@ -52,6 +53,14 @@ public class DefaultGCCDependencyCalculatorPreBuild implements
* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
*/
+ public IManagedDependencyInfo getDependencySourceInfo(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ return new DefaultGCCDependencyCalculatorPreBuildCommands(source, resource, buildContext, tool, topBuildDirectory);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath)
+ */
public IManagedDependencyInfo getDependencySourceInfo(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
return new DefaultGCCDependencyCalculatorPreBuildCommands(source, buildContext, tool, topBuildDirectory);
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuildCommands.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuildCommands.java
index 97bc24bfd17..c912d175266 100755
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuildCommands.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuildCommands.java
@@ -26,6 +26,7 @@ import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyPreBuild;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import java.util.Vector;
/**
@@ -46,6 +47,7 @@ public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedD
// Member variables set by the constructor
IPath source;
+ IResource resource;
IBuildObject buildContext;
ITool tool;
IPath topBuildDirectory;
@@ -68,8 +70,9 @@ public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedD
* @param topBuildDirectory The top build directory of the configuration. This is
* the working directory for the tool. This IPath is relative to the project directory.
*/
- public DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
+ public DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) {
this.source = source;
+ this.resource = resource;
this.buildContext = buildContext;
this.tool = tool;
this.topBuildDirectory = topBuildDirectory;
@@ -88,7 +91,24 @@ public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedD
// A separate rule is needed for the resource in the case where explicit file-specific macros
// are referenced, or if the resource contains special characters in its path (e.g., whitespace)
- needExplicitRuleForFile = GnuMakefileGenerator.containsSpecialCharacters(sourceLocation.toString()) ||
+
+ /* fix for 137674
+ *
+ * We only need an explicit rule if one of the following is true:
+ * - The resource is linked, and its full path to its real location contains special characters
+ * - The resource is not linked, but its project relative path contains special characters
+ */
+ boolean resourceNameRequiresExplicitRule = true;
+
+ if(resource != null)
+ {
+ resourceNameRequiresExplicitRule = (resource.isLinked() && GnuMakefileGenerator
+ .containsSpecialCharacters(sourceLocation.toString()))
+ || (!resource.isLinked() && GnuMakefileGenerator
+ .containsSpecialCharacters(resource.getProjectRelativePath().toString()));
+ }
+
+ needExplicitRuleForFile = resourceNameRequiresExplicitRule ||
MacroResolver.getReferencedExplitFileMacros(tool).length > 0
|| MacroResolver.getReferencedExplitFileMacros(
tool.getToolCommand(),
@@ -99,6 +119,35 @@ public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedD
if (needExplicitRuleForFile) genericCommands = new Boolean(false);
}
+ /**
+ * Constructor. This constructor calls
+ * DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IResource resource,
+ * IBuildObject buildContext, ITool tool, IPath topBuildDirectory) with a
+ * null resource. The net result of this is that dependency rules will
+ * always be explicit and will never use pattern rules, as it is impossible
+ * for the calculator to know whether the resource is linked or not.
+ *
+ * @param source
+ * The source file for which dependencies should be calculated
+ * The IPath can be either relative to the project directory, or
+ * absolute in the file system.
+ * @param buildContext
+ * The IConfiguration or IResourceConfiguration that contains the
+ * context in which the source file will be built
+ * @param tool
+ * The tool associated with the source file
+ * @param topBuildDirectory
+ * The top build directory of the configuration. This is the
+ * working directory for the tool. This IPath is relative to the
+ * project directory.
+ *
+ * @see DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
+ */
+ public DefaultGCCDependencyCalculatorPreBuildCommands(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory)
+ {
+ this(source, (IResource) null, buildContext, tool, topBuildDirectory);
+ }
+
public boolean areCommandsGeneric() {
if (genericCommands != null) return genericCommands.booleanValue();
// If the context is a Configuration, yes
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
index 6e3a32330b6..7db3e94a50b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
@@ -2100,7 +2100,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
depGen = (IManagedDependencyGenerator2)t;
doDepGen = (calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS);
IBuildObject buildContext = (resConfig != null) ? (IBuildObject)resConfig : (IBuildObject)config;
- depInfo = depGen.getDependencySourceInfo(resource.getProjectRelativePath(), buildContext, tool, getBuildWorkingDir());
+
+ depInfo = depGen.getDependencySourceInfo(resource.getProjectRelativePath(), resource, buildContext, tool, getBuildWorkingDir());
+
if (calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS) {
depCommands = (IManagedDependencyCommands)depInfo;
depFiles = depCommands.getDependencyFiles();
@@ -2158,7 +2160,20 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// A separate rule is needed for the resource in the case where explicit file-specific macros
// are referenced, or if the resource contains special characters in its path (e.g., whitespace)
- boolean needExplicitRuleForFile = containsSpecialCharacters(sourceLocation.toString()) ||
+
+ /* fix for 137674
+ *
+ * We only need an explicit rule if one of the following is true:
+ * - The resource is linked, and its full path to its real location contains special characters
+ * - The resource is not linked, but its project relative path contains special characters
+ */
+
+ boolean resourceNameRequiresExplicitRule = (resource.isLinked() && containsSpecialCharacters(sourceLocation
+ .toString()))
+ || (!resource.isLinked() && containsSpecialCharacters(resource
+ .getProjectRelativePath().toString()));
+
+ boolean needExplicitRuleForFile = resourceNameRequiresExplicitRule ||
MacroResolver.getReferencedExplitFileMacros(tool).length > 0
|| MacroResolver.getReferencedExplitFileMacros(tool
.getToolCommand(), IBuildMacroProvider.CONTEXT_FILE,
@@ -4143,7 +4158,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
calcType == IManagedDependencyGeneratorType.TYPE_PREBUILD_COMMANDS) {
IManagedDependencyGenerator2 depGen = (IManagedDependencyGenerator2)depType;
IManagedDependencyInfo depInfo = depGen.getDependencySourceInfo(
- deletedFile.getProjectRelativePath(), config, tool, getBuildWorkingDir());
+ deletedFile.getProjectRelativePath(), deletedFile, config, tool, getBuildWorkingDir());
if (depInfo != null) {
if (calcType == IManagedDependencyGeneratorType.TYPE_BUILD_COMMANDS) {
IManagedDependencyCommands depCommands = (IManagedDependencyCommands)depInfo;
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/ManagedBuildGnuToolInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/ManagedBuildGnuToolInfo.java
index c12413dbe59..281af05d3e0 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/ManagedBuildGnuToolInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/ManagedBuildGnuToolInfo.java
@@ -819,8 +819,10 @@ public class ManagedBuildGnuToolInfo implements IManagedBuildGnuToolInfo {
IManagedDependencyGenerator2 depGen2 = (IManagedDependencyGenerator2)depGen;
IManagedDependencyInfo depInfo = null;
for (int i=0; i<inputs.size(); i++) {
+
depInfo = depGen2.getDependencySourceInfo(
Path.fromOSString((String)inputs.get(i)), config, tool, makeGen.getBuildWorkingDir());
+
if (depInfo instanceof IManagedDependencyCalculator) {
IManagedDependencyCalculator depCalc = (IManagedDependencyCalculator)depInfo;
IPath[] depPaths = depCalc.getDependencies();

Back to the top