mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
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
This commit is contained in:
parent
407352736a
commit
980eb1b25c
2 changed files with 14 additions and 10 deletions
|
@ -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$
|
||||
|
|
|
@ -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) {
|
||||
if (!argString.isEmpty()) {
|
||||
String[] s = argString.split("="); //$NON-NLS-1$
|
||||
if (s.length == 2) {
|
||||
argMap.put(s[0], s[1]);
|
||||
argMap.put(s[0], s[1].trim());
|
||||
} else {
|
||||
argMap.put(argString, "true"); //$NON-NLS-1$
|
||||
argMap.put(argString.trim(), "true"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -306,9 +308,11 @@ public class MesonPropertyPage extends PropertyPage {
|
|||
} else {
|
||||
StringBuilder mesonargs = new StringBuilder();
|
||||
for (IMesonPropertyPageControl control : componentList) {
|
||||
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());
|
||||
buildConfig.setProperty(IMesonConstants.MESON_PROJECT_OPTIONS, projText.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);
|
||||
|
|
Loading…
Add table
Reference in a new issue