1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Bug 551089 - Builds with libraries having spaces in the name fail

- add new checkIfQuotedOption() method to GnuMakefileGenerator
- have ensurePathIsGNUMakeTargetRuleCompatibleSyntax() look to
  see if the path is actually an option with path in which case
  if it is quoted, do not try to escape white space

Change-Id: I67a286962ba67acb75d1f8c29cac47069ab07353
This commit is contained in:
Jeff Johnston 2019-10-01 21:47:06 -04:00
parent b52b03a9bc
commit 232e3d7153

View file

@ -38,6 +38,8 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.settings.model.CSourceEntry;
@ -111,6 +113,9 @@ import org.eclipse.core.runtime.SubProgressMonitor;
public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
private static final IPath DOT_SLASH_PATH = new Path("./"); //$NON-NLS-1$
private Pattern doubleQuotedOption = Pattern.compile("--?[a-zA-Z]+.*?\\\".*?\\\".*"); //$NON-NLS-1$
private Pattern singleQuotedOption = Pattern.compile("--?[a-zA-Z]+.*?'.*?'.*"); //$NON-NLS-1$
/**
* This class walks the delta supplied by the build system to determine
* what resources have been changed. The logic is very simple. If a
@ -3482,6 +3487,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
String nextToken = tokenIter.next();
token += WHITESPACE + nextToken;
if (!nextToken.endsWith("\\")) { //$NON-NLS-1$
//$NON-NLS-1$
break;
}
}
@ -4478,7 +4484,23 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator2 {
*/
/* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=129782 */
public String ensurePathIsGNUMakeTargetRuleCompatibleSyntax(String path) {
return escapeWhitespaces(ensureUnquoted(path));
boolean isQuotedOption = false;
if (path.startsWith("-")) { //$NON-NLS-1$
isQuotedOption = checkIfQuotedOption(path);
}
if (!isQuotedOption)
return escapeWhitespaces(ensureUnquoted(path));
return path;
}
private boolean checkIfQuotedOption(String path) {
Matcher m1 = doubleQuotedOption.matcher(path);
if (m1.matches())
return true;
Matcher m2 = singleQuotedOption.matcher(path);
if (m2.matches())
return true;
return false;
}
/**