summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2021-06-12 09:43:10 +0200
committerIvan Komissarov <ABBAPOH@gmail.com>2021-06-14 17:42:21 +0000
commitfb3b51013323d76c301a36c20fb4b53cc93fb45b (patch)
tree93d86c964b45d28e6970f9e2d4c4a9aa120ab8ac
parenta9b5f3ad3175830925f67f723ff04a8f2a954011 (diff)
downloadqbs-fb3b51013323d76c301a36c20fb4b53cc93fb45b.tar.gz
codesign: Fix checking if product is a framework
It is not correct to check for the frameworkVersion to determine if product is a Framework - e.g. Xcode always sets this variable. Instead, product.type or product.bundle.packageType should be checked instead. This fixes the problem when codesign incorrectly determines bundle as a framework if product.version is set. Fixes: QBS-1649 Change-Id: I067e852df82a43897000d45e27908dd5e22eac70 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/modules/codesign/codesign.js4
-rw-r--r--tests/auto/blackbox/testdata-apple/codesign/codesign.qbs3
-rw-r--r--tests/auto/blackbox/tst_blackboxapple.cpp3
3 files changed, 7 insertions, 3 deletions
diff --git a/share/qbs/modules/codesign/codesign.js b/share/qbs/modules/codesign/codesign.js
index 5aa303c9c..8159a77bc 100644
--- a/share/qbs/modules/codesign/codesign.js
+++ b/share/qbs/modules/codesign/codesign.js
@@ -301,8 +301,8 @@ function prepareSign(project, product, inputs, outputs, input, output) {
// If this is a framework, we need to sign its versioned directory
var subpath = "";
if (isBundle) {
- var frameworkVersion = product.bundle.frameworkVersion;
- if (frameworkVersion) {
+ var isFramework = product.bundle.packageType === "FMWK";
+ if (isFramework) {
subpath = product.bundle.contentsFolderPath;
subpath = subpath.substring(product.bundle.bundleName.length);
}
diff --git a/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs b/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs
index eafb0be84..08c8f730b 100644
--- a/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs
+++ b/tests/auto/blackbox/testdata-apple/codesign/codesign.qbs
@@ -9,6 +9,7 @@ Project {
CppApplication {
name: "A"
+ version: "1.0.0"
bundle.isBundle: project.isBundle
files: "app.cpp"
codesign.enableCodeSigning: project.enableSigning
@@ -23,6 +24,7 @@ Project {
DynamicLibrary {
Depends { name: "cpp" }
name: "B"
+ version: "1.0.0"
bundle.isBundle: project.isBundle
files: "app.cpp"
codesign.enableCodeSigning: project.enableSigning
@@ -36,6 +38,7 @@ Project {
LoadableModule {
Depends { name: "cpp" }
name: "C"
+ version: "1.0.0"
bundle.isBundle: project.isBundle
files: "app.cpp"
codesign.enableCodeSigning: project.enableSigning
diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp
index 8c9792211..f8645bac6 100644
--- a/tests/auto/blackbox/tst_blackboxapple.cpp
+++ b/tests/auto/blackbox/tst_blackboxapple.cpp
@@ -751,7 +751,8 @@ void TestBlackboxApple::codesign()
QCOMPARE(codeSignInfo.second.value(QByteArrayLiteral("Signature")), "adhoc");
}
- const auto libName = isBundle ? QStringLiteral("B.framework") : QStringLiteral("libB.dylib");
+ const auto libName =
+ isBundle ? QStringLiteral("B.framework") : QStringLiteral("libB.1.0.0.dylib");
const auto libPath = defaultInstallRoot + "/" + libName;
QVERIFY(QFileInfo(libPath).exists());
codeSignInfo = getCodeSignInfo(libPath);