aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/modules/bundle/BundleModule.qbs
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@theqtcompany.com>2016-03-31 17:27:20 -0700
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-04-13 08:22:33 +0000
commit4e442c034dcfee45c24a12d289894dbce09fdbc6 (patch)
treef88cf93cc2427c95fd7d91c7d2e09d7996889148 /share/qbs/modules/bundle/BundleModule.qbs
parent09e7966f23b547508eec24afc96a7c6d020ecece (diff)
Add a validate script to the bundle module.
Also, adjust autotests to be more flexible. Some product types (for example, application extensions) may not exist in older versions of Xcode. This fixes the bundleStructure autotest. Change-Id: I2e73cd65f50f44017780001e9e0d5fb184edba31 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'share/qbs/modules/bundle/BundleModule.qbs')
-rw-r--r--share/qbs/modules/bundle/BundleModule.qbs67
1 files changed, 61 insertions, 6 deletions
diff --git a/share/qbs/modules/bundle/BundleModule.qbs b/share/qbs/modules/bundle/BundleModule.qbs
index 08c473356..6f45b07ed 100644
--- a/share/qbs/modules/bundle/BundleModule.qbs
+++ b/share/qbs/modules/bundle/BundleModule.qbs
@@ -70,11 +70,25 @@ Module {
property var xcodeSettings: ({})
configure: {
- if (xcodeDeveloperPath) {
- var reader = new Bundle.XcodeBuildSpecsReader(xcodeDeveloperPath,
- additionalSettings,
- !qbs.targetOS.contains("osx"));
- xcodeSettings = reader.expandedSettings(_productTypeIdentifier) || {};
+ var specsPath = path;
+ var specsSeparator = "-";
+ if (xcodeDeveloperPath && _useXcodeBuildSpecs) {
+ specsPath = xcodeDeveloperPath
+ + "/Platforms/MacOSX.platform/Developer/Library/Xcode/Specifications";
+ specsSeparator = " ";
+ }
+
+ var reader = new Bundle.XcodeBuildSpecsReader(specsPath,
+ specsSeparator,
+ additionalSettings,
+ !qbs.targetOS.contains("osx"));
+ var settings = reader.expandedSettings(_productTypeIdentifier);
+ if (settings) {
+ xcodeSettings = settings;
+ found = true;
+ } else {
+ xcodeSettings = {};
+ found = false;
}
}
}
@@ -163,9 +177,11 @@ Module {
readonly property string unlocalizedResourcesFolderPath: bundleSettingsProbe.xcodeSettings["UNLOCALIZED_RESOURCES_FOLDER_PATH"]
readonly property string versionsFolderPath: bundleSettingsProbe.xcodeSettings["VERSIONS_FOLDER_PATH"]
+ // private properties
property string _productTypeIdentifier: Bundle.productTypeIdentifier(product.type)
- // private properties
+ property bool _useXcodeBuildSpecs: true // false to use ONLY the qbs build specs
+
readonly property var extraEnv: ({
"PRODUCT_BUNDLE_IDENTIFIER": identifier
})
@@ -197,6 +213,45 @@ Module {
};
}
+ validate: {
+ if (!bundleSettingsProbe.found) {
+ var error = "Bundle product type " + _productTypeIdentifier + " is not supported.";
+ if ((_productTypeIdentifier || "").startsWith("com.apple.product-type."))
+ error += " You may need to upgrade Xcode.";
+ throw error;
+ }
+
+ var validator = new ModUtils.PropertyValidator("bundle");
+ validator.setRequiredProperty("bundleName", bundleName);
+ validator.setRequiredProperty("infoPlistPath", infoPlistPath);
+ validator.setRequiredProperty("pbdevelopmentPlistPath", pbdevelopmentPlistPath);
+ validator.setRequiredProperty("pkgInfoPath", pkgInfoPath);
+ validator.setRequiredProperty("versionPlistPath", versionPlistPath);
+ validator.setRequiredProperty("executablePath", executablePath);
+ validator.setRequiredProperty("contentsFolderPath", contentsFolderPath);
+ validator.setRequiredProperty("documentationFolderPath", documentationFolderPath);
+ validator.setRequiredProperty("executableFolderPath", executableFolderPath);
+ validator.setRequiredProperty("executablesFolderPath", executablesFolderPath);
+ validator.setRequiredProperty("frameworksFolderPath", frameworksFolderPath);
+ validator.setRequiredProperty("javaFolderPath", javaFolderPath);
+ validator.setRequiredProperty("localizedResourcesFolderPath", localizedResourcesFolderPath);
+ validator.setRequiredProperty("pluginsFolderPath", pluginsFolderPath);
+ validator.setRequiredProperty("privateHeadersFolderPath", privateHeadersFolderPath);
+ validator.setRequiredProperty("publicHeadersFolderPath", publicHeadersFolderPath);
+ validator.setRequiredProperty("scriptsFolderPath", scriptsFolderPath);
+ validator.setRequiredProperty("sharedFrameworksFolderPath", sharedFrameworksFolderPath);
+ validator.setRequiredProperty("sharedSupportFolderPath", sharedSupportFolderPath);
+ validator.setRequiredProperty("unlocalizedResourcesFolderPath", unlocalizedResourcesFolderPath);
+
+ if (packageType === "FMWK") {
+ validator.setRequiredProperty("frameworkVersion", frameworkVersion);
+ validator.setRequiredProperty("versionsFolderPath", versionsFolderPath);
+ }
+
+ // extension and infoStringsPath might not be set
+ return validator.validate();
+ }
+
FileTagger {
fileTags: ["infoplist"]
patterns: ["Info.plist", "*-Info.plist"]