diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-09-19 00:41:19 -0700 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-09-20 00:39:43 +0000 |
commit | 923854e45bb29f3adb045c73ed0841730d838867 (patch) | |
tree | 152bbcf73eefd008f9329019b3fba2e5b205ed1e /share/qbs/modules/bundle | |
parent | 848ce26d155ac4fe79399c93bf455cae816bdc47 (diff) |
Add a PropertyListVariableExpander class
This allows us to control exactly what warning message is displayed when
the expandPlistEnvironmentVariables function encounters an unknown
variable replacement, as opposed to whether or not a hardcoded message
is shown. We use this new functionality in the Info.plist processor in
order to give a much clearer message what went wrong and where the user
might look to correct it.
Change-Id: I967ea87c837f9aa2b67bad292e392b356fee8bed
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'share/qbs/modules/bundle')
-rw-r--r-- | share/qbs/modules/bundle/BundleModule.qbs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/share/qbs/modules/bundle/BundleModule.qbs b/share/qbs/modules/bundle/BundleModule.qbs index e9f9128e2..b7f38559c 100644 --- a/share/qbs/modules/bundle/BundleModule.qbs +++ b/share/qbs/modules/bundle/BundleModule.qbs @@ -395,7 +395,22 @@ Module { for (key in qmakeEnv) env[key] = qmakeEnv[key]; - DarwinTools.expandPlistEnvironmentVariables(aggregatePlist, env, true); + var expander = new DarwinTools.PropertyListVariableExpander(); + expander.undefinedVariableFunction = function (key, varName) { + var msg = "Info.plist variable expansion encountered undefined variable '" + + varName + "' when expanding value for key '" + key + + "', defined in one of the following files:\n\t"; + var allFilePaths = []; + for (i in infoPlistFiles) + allFilePaths.push(infoPlistFiles[i].filePath); + if (platformInfoPlist) + allFilePaths.push(platformInfoPlist); + msg += allFilePaths.join("\n\t") + "\n"; + msg += "or in the bundle.infoPlist property of product '" + + product.name + "'"; + console.warn(msg); + }; + aggregatePlist = expander.expand(aggregatePlist, env); // Add keys from partial Info.plists from asset catalogs, XIBs, and storyboards for (i in partialInfoPlistFiles) { |