summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2013-07-10 10:56:02 -0400
committerJoerg Bornemann <joerg.bornemann@digia.com>2013-07-12 12:01:29 +0200
commitcd52d86e7a871fa98ac5a4d0a3193611a0f3a51e (patch)
tree192e2a3c8128cb1d6ac01db0de8aa19a7fbbf515
parentac0b70050f4d9e8013ce52cfb91841100604350e (diff)
downloadqbs-cd52d86e7a871fa98ac5a4d0a3193611a0f3a51e.tar.gz
Make Info.plist composition more robust.
Building will no longer fail if the platform, SDK, or toolchains' respective plist files do not exist, or if an SDK path is not specified. Task-number: QBS-348 Change-Id: Ie66194c09700a38b1c0ce39c4641af27580aefd6 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--share/qbs/modules/cpp/DarwinGCC.qbs76
1 files changed, 48 insertions, 28 deletions
diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs
index 9ef0cbb76..26bfa2fb8 100644
--- a/share/qbs/modules/cpp/DarwinGCC.qbs
+++ b/share/qbs/modules/cpp/DarwinGCC.qbs
@@ -1,4 +1,5 @@
import qbs 1.0
+import qbs.File
import qbs.Process
import qbs.TextFile
import qbs.FileInfo
@@ -92,6 +93,10 @@ UnixGCC {
return dict;
}
+ readonly property string platformInfoPlist: platformPath ? [platformPath, "Info.plist"].join("/") : undefined
+ readonly property string sdkSettingsPlist: sysroot ? [sysroot, "SDKSettings.plist"].join("/") : undefined
+ readonly property string toolchainInfoPlist: toolchainInstallPath ? [toolchainInstallPath, "../../ToolchainInfo.plist"].join("/") : undefined
+
Rule {
multiplex: true
inputs: ["infoplist"]
@@ -146,6 +151,11 @@ UnixGCC {
cmd.toolchainInstallPath = product.moduleProperty("cpp", "toolchainInstallPath");
cmd.sysroot = product.moduleProperty("qbs", "sysroot");
cmd.buildEnv = product.moduleProperty("cpp", "buildEnv");
+
+ cmd.platformInfoPlist = product.moduleProperty("cpp", "platformInfoPlist");
+ cmd.sdkSettingsPlist = product.moduleProperty("cpp", "sdkSettingsPlist");
+ cmd.toolchainInfoPlist = product.moduleProperty("cpp", "toolchainInfoPlist");
+
cmd.sourceCode = function() {
var process, key;
@@ -172,44 +182,54 @@ UnixGCC {
// Add keys from platform's Info.plist if not already present
if (platformPath) {
- process = new Process();
- process.exec("plutil", ["-convert", "json", "-o", "-",
- [platformPath, "Info.plist"].join('/')], true);
- platformInfo = JSON.parse(process.readStdOut());
-
- var additionalProps = platformInfo["AdditionalInfo"];
- for (key in additionalProps) {
- if (additionalProps.hasOwnProperty(key) && !(key in aggregatePlist)) // override infoPlist?
- aggregatePlist[key] = defaultValues[key];
- }
- props = platformInfo['OverrideProperties'];
- for (key in props) {
- aggregatePlist[key] = props[key];
- }
-
- if (product.moduleProperty("qbs", "targetOS").contains("ios")) {
- key = "UIDeviceFamily";
- if (key in platformInfo && !(key in aggregatePlist))
- aggregatePlist[key] = platformInfo[key];
+ if (File.exists(platformInfoPlist)) {
+ process = new Process();
+ process.exec("plutil", ["-convert", "json", "-o", "-",
+ platformInfoPlist], true);
+ platformInfo = JSON.parse(process.readStdOut());
+
+ var additionalProps = platformInfo["AdditionalInfo"];
+ for (key in additionalProps) {
+ if (additionalProps.hasOwnProperty(key) && !(key in aggregatePlist)) // override infoPlist?
+ aggregatePlist[key] = defaultValues[key];
+ }
+ props = platformInfo['OverrideProperties'];
+ for (key in props) {
+ aggregatePlist[key] = props[key];
+ }
+
+ if (product.moduleProperty("qbs", "targetOS").contains("ios")) {
+ key = "UIDeviceFamily";
+ if (key in platformInfo && !(key in aggregatePlist))
+ aggregatePlist[key] = platformInfo[key];
+ }
+ } else {
+ print("warning: platform path given but no platform Info.plist found");
}
} else {
- print("Missing platformPath property");
+ print("no platform path specified");
}
+
if (sysroot) {
- process = new Process();
- process.exec("plutil", ["-convert", "json", "-o", "-",
- sysroot + "/SDKSettings.plist"], true);
- sdkSettings = JSON.parse(process.readStdOut());
+ if (File.exists(sdkSettingsPlist)) {
+ process = new Process();
+ process.exec("plutil", ["-convert", "json", "-o", "-",
+ sdkSettingsPlist], true);
+ sdkSettings = JSON.parse(process.readStdOut());
+ } else {
+ print("warning: sysroot (SDK path) given but no SDKSettings.plist found");
+ }
} else {
- print("Missing sysroot (SDK path)");
+ print("no sysroot (SDK path) specified");
}
- if (toolchainInstallPath) {
+
+ if (toolchainInstallPath && File.exists(toolchainInfoPlist)) {
process = new Process();
process.exec("plutil", ["-convert", "json", "-o", "-",
- toolchainInstallPath + "/../../ToolchainInfo.plist"], true);
+ toolchainInfoPlist], true);
toolchainInfo = JSON.parse(process.readStdOut());
} else {
- print("Cannot get the ToolchainInfo.plist from the toolchainInstallPath");
+ print("could not find a ToolchainInfo.plist near the toolchain install path");
}
process = new Process();