aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/qbs/modules/bundle/BundleModule.qbs11
-rw-r--r--share/qbs/modules/bundle/bundle.js40
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs8
3 files changed, 50 insertions, 9 deletions
diff --git a/share/qbs/modules/bundle/BundleModule.qbs b/share/qbs/modules/bundle/BundleModule.qbs
index 0bf25033d..a7e6ec186 100644
--- a/share/qbs/modules/bundle/BundleModule.qbs
+++ b/share/qbs/modules/bundle/BundleModule.qbs
@@ -69,6 +69,7 @@ Module {
// Outputs
property var xcodeSettings: ({})
+ property var productTypeIdentifierChain: []
configure: {
var specsPath = path;
@@ -84,11 +85,14 @@ Module {
additionalSettings,
!qbs.targetOS.contains("macos"));
var settings = reader.expandedSettings(_productTypeIdentifier);
- if (settings) {
+ var chain = reader.productTypeIdentifierChain(_productTypeIdentifier);
+ if (settings && chain) {
xcodeSettings = settings;
+ productTypeIdentifierChain = chain;
found = true;
} else {
xcodeSettings = {};
+ productTypeIdentifierChain = [];
found = false;
}
}
@@ -180,6 +184,7 @@ Module {
// private properties
property string _productTypeIdentifier: Bundle.productTypeIdentifier(product.type)
+ property stringList _productTypeIdentifierChain: bundleSettingsProbe.productTypeIdentifierChain
property bool _useXcodeBuildSpecs: true // false to use ONLY the qbs build specs
@@ -496,6 +501,10 @@ Module {
"compiled_ibdoc", "compiled_assetcatalog",
"xcode.provisioningprofile.main"]
+ // Make sure the inputs of this rule are only those rules which produce outputs compatible
+ // with the type of the bundle being produced.
+ excludedAuxiliaryInputs: Bundle.excludedAuxiliaryInputs(project, product)
+
outputFileTags: [
"bundle.content",
"bundle.symlink.headers", "bundle.symlink.private-headers",
diff --git a/share/qbs/modules/bundle/bundle.js b/share/qbs/modules/bundle/bundle.js
index c802e3e28..c68128b8c 100644
--- a/share/qbs/modules/bundle/bundle.js
+++ b/share/qbs/modules/bundle/bundle.js
@@ -29,6 +29,7 @@
****************************************************************************/
var DarwinTools = require("qbs.DarwinTools");
+var ModUtils = require("qbs.ModUtils");
var Process = require("qbs.Process");
// HACK: Workaround until the PropertyList extension is supported cross-platform
@@ -85,6 +86,37 @@ function productTypeIdentifier(productType) {
return "com.apple.package-type.wrapper";
}
+function excludedAuxiliaryInputs(project, product) {
+ var chain = product.moduleProperty("bundle", "_productTypeIdentifierChain");
+ var bestPossibleType;
+ for (var i = chain.length - 1; i >= 0; --i) {
+ switch (chain[i]) {
+ case "com.apple.product-type.bundle":
+ bestPossibleType = "loadablemodule";
+ break;
+ case "com.apple.product-type.framework":
+ bestPossibleType = "dynamiclibrary";
+ break;
+ case "com.apple.product-type.framework.static":
+ bestPossibleType = "staticlibrary";
+ break;
+ case "com.apple.product-type.application":
+ case "com.apple.product-type.xpc-service":
+ bestPossibleType = "application";
+ break;
+ }
+ }
+
+ var excluded = [];
+ var possibleTypes = ["application", "dynamiclibrary", "staticlibrary", "loadablemodule"];
+ for (i = 0; i < possibleTypes.length; ++i) {
+ if (possibleTypes[i] !== bestPossibleType)
+ excluded.push(possibleTypes[i]);
+ }
+
+ return excluded;
+}
+
var XcodeBuildSpecsReader = (function () {
function XcodeBuildSpecsReader(specsPath, separator, additionalSettings, useShallowBundles) {
this._additionalSettings = additionalSettings;
@@ -107,6 +139,14 @@ var XcodeBuildSpecsReader = (function () {
plist2.clear();
}
}
+ XcodeBuildSpecsReader.prototype.productTypeIdentifierChain = function (typeIdentifier) {
+ var ids = [typeIdentifier];
+ var obj = this._types[typeIdentifier];
+ var parentId = obj && obj["BasedOn"];
+ if (parentId)
+ return ids.concat(this.productTypeIdentifierChain(parentId));
+ return ids;
+ };
XcodeBuildSpecsReader.prototype.settings = function (typeIdentifier, recursive, skipPackageTypes) {
// Silently use shallow bundles when preferred since it seems to be some sort of automatic
// shadowing mechanism. For example, this matches Xcode behavior where static frameworks
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs
index 5e88e59c7..975d1edeb 100644
--- a/share/qbs/modules/cpp/GenericGCC.qbs
+++ b/share/qbs/modules/cpp/GenericGCC.qbs
@@ -289,8 +289,6 @@ CppModule {
"dynamiclibrary", "dynamiclibrary_symlink", "dynamiclibrary_copy", "debuginfo_dll"
]
outputArtifacts: {
- if (product.type.contains("bundle") && !product.type.contains("dynamiclibrary"))
- return [];
var lib = {
filePath: product.destinationDirectory + "/"
+ PathTools.dynamicLibraryFilePath(product),
@@ -338,8 +336,6 @@ CppModule {
outputFileTags: ["bundle.input", "staticlibrary", "c_staticlibrary", "cpp_staticlibrary"]
outputArtifacts: {
- if (product.type.contains("bundle") && !product.type.contains("staticlibrary"))
- return [];
var tags = ["bundle.input", "staticlibrary"];
for (var i = 0; i < inputs["obj"].length; ++i) {
var ft = inputs["obj"][i].fileTags;
@@ -408,8 +404,6 @@ CppModule {
outputFileTags: ["bundle.input", "loadablemodule", "debuginfo_loadablemodule"]
outputArtifacts: {
- if (product.type.contains("bundle") && !product.type.contains("loadablemodule"))
- return [];
var app = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.loadableModuleFilePath(product)),
@@ -442,8 +436,6 @@ CppModule {
outputFileTags: ["bundle.input", "application", "debuginfo_app"]
outputArtifacts: {
- if (product.type.contains("bundle") && !product.type.contains("application"))
- return [];
var app = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.applicationFilePath(product)),