Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuildCommands.java')
-rwxr-xr-xbuild/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/DefaultGCCDependencyCalculatorPreBuildCommands.java53
1 files changed, 51 insertions, 2 deletions
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

Back to the top