diff options
| author | Jake Petroules <jake.petroules@petroules.com> | 2013-10-10 20:39:11 -0400 |
|---|---|---|
| committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2013-10-15 15:53:54 +0200 |
| commit | 1fb9158156609b7de4ca5f675e8dd509dddea1e6 (patch) | |
| tree | 0ea2fabab9ba1f5db064e02f9c106557fe652071 /share | |
| parent | 2c1a305295f05f35527b0cceb500d013e12752e0 (diff) | |
| download | qbs-1fb9158156609b7de4ca5f675e8dd509dddea1e6.tar.gz | |
Improve validation of Qt module.
Now displays all the missing properties, instead of just the first
undefined property in the order we happened to validate them. Also
checks that pluginPath is set for non-static builds (Qt Creator used to
omit this) and various other properties are set and in a valid format.
Change-Id: I96c8a8059b1522c7498b37cba1c40cd4938b10ee
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'share')
| -rw-r--r-- | share/qbs/modules/Qt/core/core.qbs | 64 |
1 files changed, 51 insertions, 13 deletions
diff --git a/share/qbs/modules/Qt/core/core.qbs b/share/qbs/modules/Qt/core/core.qbs index 8b1d5bbc1..0c2ba0088 100644 --- a/share/qbs/modules/Qt/core/core.qbs +++ b/share/qbs/modules/Qt/core/core.qbs @@ -12,8 +12,8 @@ Module { property string namespace property string libInfix: "" property string repository: versionMajor === 5 ? "qtbase" : undefined - property stringList config: [] - property stringList qtConfig: [] + property stringList config + property stringList qtConfig property path binPath property path incPath property path libPath @@ -27,7 +27,7 @@ Module { property path docPath property stringList helpGeneratorArgs: versionMajor >= 5 ? ["-platform", "minimal"] : [] property string version - property var versionParts: version.split('.').map(function(item) { return parseInt(item, 10); }) + property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : [] property int versionMajor: versionParts[0] property int versionMinor: versionParts[1] property int versionPatch: versionParts[2] @@ -117,16 +117,54 @@ Module { additionalProductFileTags: ["qm"] validate: { - if (!binPath) - throw "Qt.core.binPath not set. Set Qt.core.binPath in your profile."; - if (!incPath) - throw "Qt.core.incPath not set. Set Qt.core.incPath in your profile."; - if (!libPath) - throw "Qt.core.libPath not set. Set Qt.core.libPath in your profile."; - if (!mkspecPath) - throw "Qt.core.mkspecPath not set. Set Qt.core.mkspecPath in your profile."; - if (!version) - throw "Qt.core.version not set. Set Qt.core.version in your profile."; + var requiredProperties = { + "binPath": binPath, + "incPath": incPath, + "libPath": libPath, + "mkspecPath": mkspecPath, + "version": version, + "config": config, + "qtConfig": qtConfig, + // Validate these in case 'version' is in some non-standard format + "versionMajor": versionMajor, + "versionMinor": versionMinor, + "versionPatch": versionPatch + }; + + if (!staticBuild) { + requiredProperties["pluginPath"] = pluginPath; + } + + var missingProperties = []; + for (var i in requiredProperties) { + if (requiredProperties[i] === undefined) { + missingProperties.push("Qt.core." + i); + } + } + + var invalidProperties = {}; + if (versionMajor <= 0) + invalidProperties["versionMajor"] = "must be > 0"; + if (versionMinor < 0) + invalidProperties["versionMinor"] = "must be >= 0"; + if (versionPatch < 0) + invalidProperties["versionPatch"] = "must be >= 0"; + + var errorMessage = ""; + if (missingProperties.length > 0) { + errorMessage += "The following Qt module properties are not set. " + + "Set them in your profile:\n" + + missingProperties.sort().join("\n"); + } + + if (Object.keys(invalidProperties).length > 0) { + errorMessage += "The following Qt module properties have invalid values:\n" + + Object.map(invalidProperties, + function(msg, prop) { return prop + ": " + msg; }).join("\n"); + } + + if (errorMessage.length > 0) + throw errorMessage; } setupRunEnvironment: { |
