Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-03-27 19:35:53 +0000
committerJeff Johnston2018-03-27 19:35:53 +0000
commit980eb1b25c877eb57897270223726714241a2751 (patch)
treeed946d7532949299ae6c809d754a7b7155b8fef8
parent407352736a328a00be88fcac2cb4d12efdcc806c (diff)
downloadorg.eclipse.cdt-980eb1b25c877eb57897270223726714241a2751.tar.gz
org.eclipse.cdt-980eb1b25c877eb57897270223726714241a2751.tar.xz
org.eclipse.cdt-980eb1b25c877eb57897270223726714241a2751.zip
Bug 532967 - Meson config properties not being saved/restored properly
- change splitting logic in MesonPropertyPage to split the arg string using -- which precedes args and to perform trim() operation to remove spaces between - don't process an empty arg after splitting - fix the boolean arg logic to use parseBoolean instead of getBoolean which is only for system properties Change-Id: I390911bbf9d7f63f0cf6a13278f3644fe175847b
-rw-r--r--build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/IMesonPropertyPageControl.java2
-rw-r--r--build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java22
2 files changed, 14 insertions, 10 deletions
diff --git a/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/IMesonPropertyPageControl.java b/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/IMesonPropertyPageControl.java
index 757214687c..1e47ea9714 100644
--- a/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/IMesonPropertyPageControl.java
+++ b/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/IMesonPropertyPageControl.java
@@ -46,7 +46,7 @@ public interface IMesonPropertyPageControl {
/**
* Get the command line parameter if never configured
- * @return String containing command-line parm for configured build dir
+ * @return String containing command-line parm for unconfigured build dir
*/
default String getUnconfiguredString() {
return "--" + getFieldName() + "=" + getFieldValue(); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java b/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java
index 601284734c..7cd4d18105 100644
--- a/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java
+++ b/build/org.eclipse.cdt.meson.ui/src/org/eclipse/cdt/meson/ui/properties/MesonPropertyPage.java
@@ -134,13 +134,15 @@ public class MesonPropertyPage extends PropertyPage {
Map<String, String> argMap = new HashMap<>();
String mesonArgs = buildConfig.getProperty(IMesonConstants.MESON_ARGUMENTS);
if (mesonArgs != null) {
- String[] argStrings = mesonArgs.split("\\s+"); //$NON-NLS-1$
+ String[] argStrings = mesonArgs.split("--"); //$NON-NLS-1$
for (String argString : argStrings) {
- String[] s = argString.split("="); //$NON-NLS-1$
- if (s.length == 2) {
- argMap.put(s[0], s[1]);
- } else {
- argMap.put(argString, "true"); //$NON-NLS-1$
+ if (!argString.isEmpty()) {
+ String[] s = argString.split("="); //$NON-NLS-1$
+ if (s.length == 2) {
+ argMap.put(s[0], s[1].trim());
+ } else {
+ argMap.put(argString.trim(), "true"); //$NON-NLS-1$
+ }
}
}
}
@@ -306,8 +308,10 @@ public class MesonPropertyPage extends PropertyPage {
} else {
StringBuilder mesonargs = new StringBuilder();
for (IMesonPropertyPageControl control : componentList) {
- mesonargs.append(control.getUnconfiguredString());
- mesonargs.append(" "); //$NON-NLS-1$
+ if (!control.getUnconfiguredString().isEmpty()) {
+ mesonargs.append(control.getUnconfiguredString());
+ mesonargs.append(" "); //$NON-NLS-1$
+ }
}
buildConfig.setProperty(IMesonConstants.MESON_ARGUMENTS, mesonargs.toString());
buildConfig.setProperty(IMesonConstants.MESON_ENV, envText.getText().trim());
@@ -366,7 +370,7 @@ public class MesonPropertyPage extends PropertyPage {
} else {
boolean defaultValue = false;
if (argMap.containsKey(optionMatcher.group(2))) {
- defaultValue = Boolean.getBoolean(argMap.get(optionMatcher.group(2)));
+ defaultValue = Boolean.parseBoolean(argMap.get(optionMatcher.group(2)));
}
IMesonPropertyPageControl control = new MesonPropertySpecialCheckbox(group, optionMatcher.group(2), defaultValue, optionMatcher.group(6));
controls.add(control);

Back to the top