From d017917f3584c4bdc06f77a58159918124b0a2c2 Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Sun, 10 May 2020 15:11:11 -0400 Subject: Bug 563006 - CDB settings provider/parser doesn't support "arguments" One flaw with this implementation is that the "arguments" coming from the CDB do not have shell quoting and shell escaping of quotes whereas the current implementations of Build Output parsers assume some form of shell quoting. This means that simply joining strings of arguments with spaces will be missing the expected shell quoting and possibly misparsed by the build output parsers. It is not clear to be at this point if this should be fixed or not as it might involve revamping the existing build output parsers to add the concept of shell/environment and this could also affect potential extenders. In this current form, simple cases with no spacing and quote escaping involved work correctly and is still a nice improvement. Change-Id: Ia81796e63c748318b34696998ac4a467712e5f96 Signed-off-by: Marc-Andre Laperle --- .../language/settings/providers/CompilationDatabaseParser.java | 7 ++++++- .../internal/language/settings/providers/CompileCommand.java | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'build/org.eclipse.cdt.managedbuilder.core/src/org') diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java index 3bc795e6399..008b05e9c11 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java @@ -308,7 +308,12 @@ public class CompilationDatabaseParser extends LanguageSettingsSerializableProvi } } - outputParser.processLine(c.getCommand()); + String command = c.getCommand(); + if (command != null) { + outputParser.processLine(command); + } else if (c.getArguments() != null) { + outputParser.processLine(String.join(" ", c.getArguments())); //$NON-NLS-1$ + } parseCmdsMonitor.worked(1); } LanguageSettingsStorage storage = outputParser.copyStorage(); diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompileCommand.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompileCommand.java index 3675d94dc07..fa58863dee4 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompileCommand.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompileCommand.java @@ -18,6 +18,7 @@ public class CompileCommand { public String directory; public String command; public String file; + public String[] arguments; public String getDirectory() { return directory; @@ -31,4 +32,7 @@ public class CompileCommand { return file; } + public String[] getArguments() { + return arguments; + } } -- cgit v1.2.3