mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
fix for 129782 by Andrew Ferguson
This commit is contained in:
parent
5e01468c76
commit
9a285184f9
4 changed files with 124 additions and 6 deletions
|
@ -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>
|
||||
|
|
Binary file not shown.
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue