Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorChris Recoskie2006-09-11 20:06:09 +0000
committerChris Recoskie2006-09-11 20:06:09 +0000
commit5c4b9de3b941d79badd06de7523590c513f9f947 (patch)
tree6bf42865eb110cf702f39922b0a6a5062728a6e9 /build
parent99cce233c966f6e9cfceb538b220646bcdb11edf (diff)
downloadorg.eclipse.cdt-5c4b9de3b941d79badd06de7523590c513f9f947.tar.gz
org.eclipse.cdt-5c4b9de3b941d79badd06de7523590c513f9f947.tar.xz
org.eclipse.cdt-5c4b9de3b941d79badd06de7523590c513f9f947.zip
fix for 129782 by Andrew Ferguson
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml67
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/inputTypeOption/inputTypeOption.zipbin0 -> 5273 bytes
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java17
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java46
4 files changed, 124 insertions, 6 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
index 34d2b2accb0..eee8f087cbb 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
@@ -6240,5 +6240,72 @@
</projectType>
+ <projectType
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest"
+ isAbstract="false"
+ isTest="false"
+ name="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest"
+ superClass="cdt.managedbuild.target.gnu30.exe">
+ <configuration
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest"
+ name="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest"
+ parent="cdt.managedbuild.config.testgnu30.exe.release">
+ <toolChain
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.toolChain"
+ isAbstract="false"
+ name="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.toolChain"
+ superClass="cdt.managedbuild.toolchain.testgnu30.exe.release"
+ unusedChildren="cdt.managedbuild.tool.testgnu30.c.compiler.exe.release;cdt.managedbuild.tool.testgnu30.cpp.compiler.exe.release;cdt.managedbuild.tool.testgnu30.c.linker.exe.release;cdt.managedbuild.tool.testgnu30.cpp.linker.exe.release">
+ <tool
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.compiler"
+ isAbstract="false"
+ name="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.compiler"
+ superClass="cdt.managedbuild.tool.testgnu30.c.compiler.exe.release">
+ <optionCategory
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.optionCategory1"
+ name="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.optionCategory1"
+ owner="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.compiler"/>
+ <option
+ browseType="file"
+ category="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.optionCategory1"
+ command="--compilerInputTypeOption="
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.compiler.inputTypeOption"
+ isAbstract="false"
+ name="inputTypeOption1"
+ resourceFilter="all"
+ valueType="stringList"/>
+ <inputType
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.compiler.inputType2"
+ name="inputTypeOption1"
+ option="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.compiler.inputTypeOption"/>
+ </tool>
+ <tool
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.linker"
+ isAbstract="false"
+ name="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.linker"
+ superClass="cdt.managedbuild.tool.testgnu30.c.linker.exe.release">
+ <optionCategory
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.optionCategory2"
+ name="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.optionCategory2"
+ owner="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.linker"/>
+ <option
+ browseType="file"
+ category="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.optionCategory2"
+ command="--linkerInputTypeOption="
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.linker.inputTypeOption"
+ isAbstract="false"
+ name="inputTypeOption2"
+ resourceFilter="all"
+ valueType="stringList"/>
+ <inputType
+ id="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.linker.inputType2"
+ name="inputTypeOption2"
+ option="org.eclipse.cdt.managedbuilder.core.tests.inputTypeOptionMakefileRenderingTest.c.linker.inputTypeOption"/>
+ </tool>
+ </toolChain>
+ </configuration>
+ </projectType>
+
+
</extension>
</plugin>
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/inputTypeOption/inputTypeOption.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/inputTypeOption/inputTypeOption.zip
new file mode 100644
index 00000000000..0c446e90ecb
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/test30Projects/inputTypeOption/inputTypeOption.zip
Binary files differ
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java
index 53c8eedfe96..d25256423e2 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedProject30MakefileTests.java
@@ -81,6 +81,7 @@ public class ManagedProject30MakefileTests extends TestCase {
suite.addTest(new ManagedProject30MakefileTests("TestATO"));
suite.addTest(new ManagedProject30MakefileTests("testMacroSupportInBuildDefinitions"));
suite.addTest(new ManagedProject30MakefileTests("testSpaces"));
+ suite.addTest(new ManagedProject30MakefileTests("testInputTypeOption"));
return suite;
}
@@ -621,4 +622,20 @@ public class ManagedProject30MakefileTests extends TestCase {
IProject[] projects = createProjects("test with spaces", null, null, true);
buildProjects(projects, makefiles);
}
+
+ /**
+ * (non-Javadoc)
+ * tests managed build system with a project which has resources with spaces in their paths
+ */
+ public void testInputTypeOption()
+ {
+ IPath[] makefiles = {
+ Path.fromOSString("makefile"),
+ Path.fromOSString("objects.mk"),
+ Path.fromOSString("sources.mk"),
+ Path.fromOSString("subdir.mk"),
+ };
+ IProject[] projects = createProjects("inputTypeOption", null, null, true);
+ buildProjects(projects, makefiles);
+ }
}
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 c12aa12eb72..f5b257fab7c 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
@@ -917,7 +917,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
valueList = (List)entry.getValue();
Iterator valueIter = valueList.iterator();
while (valueIter.hasNext()) {
- macroBuffer.append(WHITESPACE + (String)valueIter.next());
+ macroBuffer.append(WHITESPACE + ensurePathIsGNUMakeTargetRuleCompatibleSyntax((String)valueIter.next()));
}
if (iterator.hasNext()) macroBuffer.append(NEWLINE + NEWLINE);
}
@@ -1658,7 +1658,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
Vector enumeratedPrimaryOutputs, Vector enumeratedSecondaryOutputs,
Vector outputVariables, Vector additionalTargets,
boolean bTargetTool, Vector managedProjectOutputs) {
-
+
// Get the information regarding the tool's inputs and outputs from the objects
// created by calculateToolInputsOutputs
IManagedBuildGnuToolInfo toolInfo = null;
@@ -1676,7 +1676,11 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
enumeratedPrimaryOutputs.addAll(toolInfo.getEnumeratedPrimaryOutputs());
enumeratedSecondaryOutputs.addAll(toolInfo.getEnumeratedSecondaryOutputs());
outputVariables.addAll(toolInfo.getOutputVariables());
- dependencies.addAll(toolInfo.getCommandDependencies());
+ Vector unprocessedDependencies = toolInfo.getCommandDependencies();
+ for(Iterator i = unprocessedDependencies.iterator(); i.hasNext(); ) {
+ String path = (String) i.next();
+ dependencies.add(ensurePathIsGNUMakeTargetRuleCompatibleSyntax(path));
+ }
additionalTargets.addAll(toolInfo.getAdditionalTargets());
if (bTargetTool && managedProjectOutputs != null) {
@@ -2305,14 +2309,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
IPath addlPath = addlDepPaths[i];
if (!(addlPath.toString().startsWith("$("))) { //$NON-NLS-1$
if (!addlPath.isAbsolute()) {
- IPath tempPath = project.getLocation().append(addlPath);
+ IPath tempPath = project.getLocation().append(new Path(ensureUnquoted(addlPath.toString())));
if (tempPath != null) {
addlPath = ManagedBuildManager.calculateRelativePath(getTopBuildDir(), tempPath);
}
}
}
- buildRuleDependencies += WHITESPACE + escapeWhitespaces(addlPath.toString());
- patternBuildRuleDependencies += WHITESPACE + escapeWhitespaces(addlPath.toString());
+ String suitablePath = ensurePathIsGNUMakeTargetRuleCompatibleSyntax(addlPath.toString());
+ buildRuleDependencies += WHITESPACE + suitablePath;
+ patternBuildRuleDependencies += WHITESPACE + suitablePath;
}
buildRule += COLON + WHITESPACE + (patternRule ? patternBuildRuleDependencies : buildRuleDependencies);
@@ -4321,4 +4326,33 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
return project.getLocation().append(getBuildWorkingDir());
}
+ /**
+ * Process a String denoting a filepath in a way compatible for GNU Make rules, handling
+ * windows drive letters and whitespace appropriately.
+ * <p><p>
+ * The context these paths appear in is on the right hand side of a rule header. i.e.
+ * <p><p>
+ * target : dep1 dep2 dep3
+ * <p>
+ * @param path the String denoting the path to process
+ * @throws NullPointerException is path is null
+ * @return a suitable Make rule compatible path
+ */
+ /* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=129782 */
+ public String ensurePathIsGNUMakeTargetRuleCompatibleSyntax(String path) {
+ return escapeWhitespaces(ensureUnquoted(path));
+ }
+
+ /**
+ * Strips outermost quotes of Strings of the form "a" and 'a' or returns the original
+ * string if the input is not of this form.
+ * @param path
+ * @throws NullPointerException if path is null
+ * @return a String without the outermost quotes (if the input has them)
+ */
+ public static String ensureUnquoted(String path) {
+ boolean doubleQuoted = path.startsWith("\"") && path.endsWith("\"");
+ boolean singleQuoted = path.startsWith("'") && path.endsWith("'");
+ return doubleQuoted || singleQuoted ? path.substring(1,path.length()-1) : path;
+ }
}

Back to the top