summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/qbs/imports/qbs/DarwinTools/darwin-tools.js15
-rw-r--r--share/qbs/modules/cpp/DarwinGCC.qbs5
2 files changed, 20 insertions, 0 deletions
diff --git a/share/qbs/imports/qbs/DarwinTools/darwin-tools.js b/share/qbs/imports/qbs/DarwinTools/darwin-tools.js
index 56a727399..59ea8f87f 100644
--- a/share/qbs/imports/qbs/DarwinTools/darwin-tools.js
+++ b/share/qbs/imports/qbs/DarwinTools/darwin-tools.js
@@ -133,3 +133,18 @@ function expandPlistEnvironmentVariables(obj, env, warn) {
expandRecursive(obj, env, []);
return obj;
}
+
+/**
+ * Recursively removes any undefined, null, or empty string values from the property list.
+ */
+function cleanPropertyList(plist) {
+ if (typeof(plist) !== "object")
+ return;
+
+ for (var key in plist) {
+ if (plist[key] === undefined || plist[key] === null || plist[key] === "")
+ delete plist[key];
+ else
+ cleanPropertyList(plist[key]);
+ }
+}
diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs
index c8bbe1094..3005a45b0 100644
--- a/share/qbs/modules/cpp/DarwinGCC.qbs
+++ b/share/qbs/modules/cpp/DarwinGCC.qbs
@@ -308,6 +308,11 @@ UnixGCC {
}
}
+ // Anything with an undefined or otherwise empty value should be removed
+ // Only JSON-formatted plists can have null values, other formats error out
+ // This also follows Xcode behavior
+ DarwinTools.cleanPropertyList(aggregatePlist);
+
if (infoPlistFormat === "same-as-input" && infoPlistFile)
infoPlistFormat = BundleTools.infoPlistFormat(infoPlistFile);