diff options
10 files changed, 89 insertions, 36 deletions
diff --git a/share/qbs/imports/qbs/DarwinTools/darwin-tools.js b/share/qbs/imports/qbs/DarwinTools/darwin-tools.js index 0a944802d..f88f6ff52 100644 --- a/share/qbs/imports/qbs/DarwinTools/darwin-tools.js +++ b/share/qbs/imports/qbs/DarwinTools/darwin-tools.js @@ -212,10 +212,15 @@ var PropertyListVariableExpander = (function () { varValue = ""; } varValue = String(varValue); - if (varFormatter !== undefined) - varFormatter = varFormatter.toLowerCase(); - if (varFormatter === "rfc1034identifier") - varValue = Utilities.rfc1034Identifier(varValue); + if (varFormatter !== undefined) { + // TODO: XCode supports multiple formatters separated by a comma + var varFormatterLower = varFormatter.toLowerCase(); + if (varFormatterLower === "rfc1034identifier") + varValue = Utilities.rfc1034Identifier(varValue); + if (varValue === "" && varFormatterLower.startsWith("default=")) + varValue = varFormatter.split("=")[1]; + } + value = value.slice(0, i) + varValue + value.slice(j + repl.syntax.close.length); changes = true; repl = indexOfReplacementStart(syntaxes, value); diff --git a/share/qbs/modules/bundle/BundleModule.qbs b/share/qbs/modules/bundle/BundleModule.qbs index 63f12db07..2568f3435 100644 --- a/share/qbs/modules/bundle/BundleModule.qbs +++ b/share/qbs/modules/bundle/BundleModule.qbs @@ -71,6 +71,9 @@ Module { "PRODUCT_NAME": product.targetName, "LOCAL_APPS_DIR": Environment.getEnv("HOME") + "/Applications", "LOCAL_LIBRARY_DIR": Environment.getEnv("HOME") + "/Library", + // actually, this is cpp.targetAbi, but XCode does not set it for non-simulator builds + // while Qbs set it to "macho". + "LLVM_TARGET_TRIPLE_SUFFIX": qbs.targetOS.contains("simulator") ? "-simulator" : "", "SWIFT_PLATFORM_TARGET_PREFIX": isMacOs ? "macos" : qbs.targetOS.contains("ios") ? "ios" : "", "TARGET_BUILD_DIR": product.buildDirectory, @@ -83,14 +86,14 @@ Module { property var productTypeIdentifierChain: [] configure: { - var specsPath = path; + var specsPaths = [path]; var specsSeparator = "-"; if (xcodeDeveloperPath && useXcodeBuildSpecs) { - specsPath = Bundle.macOSSpecsPath(xcodeVersion, xcodeDeveloperPath); + specsPaths = Bundle.macOSSpecsPaths(xcodeVersion, xcodeDeveloperPath); specsSeparator = " "; } - var reader = new Bundle.XcodeBuildSpecsReader(specsPath, + var reader = new Bundle.XcodeBuildSpecsReader(specsPaths, specsSeparator, additionalSettings, !isMacOs); diff --git a/share/qbs/modules/bundle/bundle.js b/share/qbs/modules/bundle/bundle.js index 6bb43ecdc..293f53225 100644 --- a/share/qbs/modules/bundle/bundle.js +++ b/share/qbs/modules/bundle/bundle.js @@ -28,6 +28,7 @@ ** ****************************************************************************/ +var File = require("qbs.File"); var FileInfo = require("qbs.FileInfo"); var DarwinTools = require("qbs.DarwinTools"); var ModUtils = require("qbs.ModUtils"); @@ -149,38 +150,69 @@ function _assign(target, source) { } } -function macOSSpecsPath(version, developerPath) { +function macOSSpecsPaths(version, developerPath) { + var result = []; + if (Utilities.versionCompare(version, "12.5") >= 0) { + result.push(FileInfo.joinPaths( + developerPath, "..", "PlugIns", "XCBSpecifications.ideplugin", + "Contents", "Resources")); + } + if (Utilities.versionCompare(version, "12") >= 0) { - return FileInfo.joinPaths( + result.push(FileInfo.joinPaths( developerPath, "Platforms", "MacOSX.platform", "Developer", "Library", "Xcode", - "PrivatePlugIns", "IDEOSXSupportCore.ideplugin", "Contents", "Resources"); + "PrivatePlugIns", "IDEOSXSupportCore.ideplugin", "Contents", "Resources")); + } else { + result.push(FileInfo.joinPaths( + developerPath, "Platforms", "MacOSX.platform", "Developer", "Library", "Xcode", + "Specifications")); } - return FileInfo.joinPaths( - developerPath, "Platforms", "MacOSX.platform", "Developer", "Library", "Xcode", - "Specifications"); + return result; } var XcodeBuildSpecsReader = (function () { - function XcodeBuildSpecsReader(specsPath, separator, additionalSettings, useShallowBundles) { + function XcodeBuildSpecsReader(specsPaths, separator, additionalSettings, useShallowBundles) { this._additionalSettings = additionalSettings; this._useShallowBundles = useShallowBundles; - var i; - var plist = new PropertyList2(); - var plist2 = new PropertyList2(); - try { - plist.readFromFile(specsPath + ["/MacOSX", "Package", "Types.xcspec"].join(separator)); - plist2.readFromFile(specsPath + ["/MacOSX", "Product", "Types.xcspec"].join(separator)); - this._packageTypes = plist.toObject(); - this._productTypes = plist2.toObject(); - this._types = {}; - for (i = 0; i < this._packageTypes.length; ++i) - this._types[this._packageTypes[i]["Identifier"]] = this._packageTypes[i]; - for (i = 0; i < this._productTypes.length; ++i) - this._types[this._productTypes[i]["Identifier"]] = this._productTypes[i]; - } finally { - plist.clear(); - plist2.clear(); + + this._packageTypes = []; + this._productTypes = []; + + var i, j; + for (i = 0; i < specsPaths.length; ++i) { + var specsPath = specsPaths[i]; + var names = ["Darwin", "MacOSX"]; + for (j = 0; j < names.length; ++j) { + var name = names[j]; + var plist = new PropertyList2(); + var plist2 = new PropertyList2(); + try + { + var plistName = [name, "Package", "Types.xcspec"].join(separator); + var plistName2 = [name, "Product", "Types.xcspec"].join(separator); + var plistPath = FileInfo.joinPaths(specsPath, plistName); + var plistPath2 = FileInfo.joinPaths(specsPath, plistName2); + if (File.exists(plistPath)) { + plist.readFromFile(plistPath); + this._packageTypes = this._packageTypes.concat(plist.toObject()); + } + if (File.exists(plistPath2)) { + plist2.readFromFile(plistPath2); + this._productTypes = this._productTypes.concat(plist2.toObject()); + } + } finally { + plist.clear(); + plist2.clear(); + } + } } + + this._types = {}; + for (i = 0; i < this._packageTypes.length; ++i) + this._types[this._packageTypes[i]["Identifier"]] = this._packageTypes[i]; + for (i = 0; i < this._productTypes.length; ++i) + this._types[this._productTypes[i]["Identifier"]] = this._productTypes[i]; + } XcodeBuildSpecsReader.prototype.productTypeIdentifierChain = function (typeIdentifier) { var ids = [typeIdentifier]; @@ -291,7 +323,7 @@ var XcodeBuildSpecsReader = (function () { var original; while (original !== setting) { original = setting; - setting = DarwinTools.expandPlistEnvironmentVariables({ key: setting }, obj, true)["key"]; + setting = DarwinTools.expandPlistEnvironmentVariables({ key: setting }, obj, false)["key"]; } return setting; } diff --git a/share/qbs/modules/codesign/signtool.qbs b/share/qbs/modules/codesign/signtool.qbs index 13933c6f6..02a2c978e 100644 --- a/share/qbs/modules/codesign/signtool.qbs +++ b/share/qbs/modules/codesign/signtool.qbs @@ -35,7 +35,9 @@ import qbs.Probes import "codesign.js" as CODESIGN CodeSignModule { - condition: qbs.targetOS.contains("windows") && qbs.hostOS.contains("windows") + condition: qbs.targetOS.contains("windows") + && qbs.hostOS.contains("windows") + && qbs.toolchain.contains("msvc") _canSignArtifacts: true diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp index 4ae5f3ca7..829cc955a 100644 --- a/src/lib/corelib/language/projectresolver.cpp +++ b/src/lib/corelib/language/projectresolver.cpp @@ -232,7 +232,7 @@ static void makeSubProjectNamesUniqe(const ResolvedProjectPtr &parentProject) TopLevelProjectPtr ProjectResolver::resolveTopLevelProject() { if (m_progressObserver) - m_progressObserver->setMaximum(m_loadResult.productInfos.size()); + m_progressObserver->setMaximum(int(m_loadResult.productInfos.size())); const TopLevelProjectPtr project = TopLevelProject::create(); project->buildDirectory = TopLevelProject::deriveBuildDirectory(m_setupParams.buildRoot(), TopLevelProject::deriveId(m_setupParams.finalBuildConfigurationTree())); diff --git a/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs b/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs index db5f15b18..705f054a8 100644 --- a/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs +++ b/tests/auto/blackbox/testdata-apple/bundle-structure/bundle-structure.qbs @@ -134,6 +134,9 @@ Project { name: "G" bundle.isBundle: true bundle.resources: ["resource.txt"] + // XCode 12.5 does not support com.apple.product-type.in-app-purchase-content type anymore, + // so use older specs from Qbs + bundle._useXcodeBuildSpecs: false Group { fileTagsFilter: product.type.concat(project.bundleFileTags) qbs.install: true diff --git a/tests/auto/blackbox/testdata-apple/infoPlistVariables/Info.plist b/tests/auto/blackbox/testdata-apple/infoPlistVariables/Info.plist index b357378ac..cb879d70c 100644 --- a/tests/auto/blackbox/testdata-apple/infoPlistVariables/Info.plist +++ b/tests/auto/blackbox/testdata-apple/infoPlistVariables/Info.plist @@ -18,5 +18,7 @@ <string>${${EXE}_NAME}</string> <key>BracesNested</key> <string>${${EXE}_NAME}</string> + <key>WithDefault</key> + <string>${NON_EXISTING:default=DEFAULT}</string> </dict> </plist> diff --git a/tests/auto/blackbox/testdata-windows/codesign/codesign.qbs b/tests/auto/blackbox/testdata-windows/codesign/codesign.qbs index 2b48c67ff..ef6447ab7 100644 --- a/tests/auto/blackbox/testdata-windows/codesign/codesign.qbs +++ b/tests/auto/blackbox/testdata-windows/codesign/codesign.qbs @@ -9,6 +9,7 @@ Project { CppApplication { name: "A" files: "app.cpp" + condition: qbs.toolchain.contains("msvc") codesign.enableCodeSigning: project.enableSigning codesign.hashAlgorithm: project.hashAlgorithm codesign.subjectName: project.subjectName @@ -16,7 +17,8 @@ Project { install: true installDir: "" property bool dummy: { - console.info("signtool path: %%" + codesign.codesignPath + "%%"); + if (codesign.codesignPath) + console.info("signtool path: %%" + codesign.codesignPath + "%%"); } } @@ -24,6 +26,7 @@ Project { Depends { name: "cpp" } name: "B" files: "app.cpp" + condition: qbs.toolchain.contains("msvc") codesign.enableCodeSigning: project.enableSigning codesign.hashAlgorithm: project.hashAlgorithm codesign.subjectName: project.subjectName @@ -31,7 +34,8 @@ Project { install: true installDir: "" property bool dummy: { - console.info("signtool path: %%" + codesign.codesignPath + "%%"); + if (codesign.codesignPath) + console.info("signtool path: %%" + codesign.codesignPath + "%%"); } } } diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp index 884d2c077..8c9792211 100644 --- a/tests/auto/blackbox/tst_blackboxapple.cpp +++ b/tests/auto/blackbox/tst_blackboxapple.cpp @@ -1069,6 +1069,8 @@ void TestBlackboxApple::infoPlistVariables() QStringLiteral("infoPlistVariables")); QCOMPARE(content.value(QStringLiteral("BracesNested")), QStringLiteral("infoPlistVariables")); + QCOMPARE(content.value(QStringLiteral("WithDefault")), + QStringLiteral("DEFAULT")); } void TestBlackboxApple::objcArc() diff --git a/tests/auto/blackbox/tst_blackboxwindows.cpp b/tests/auto/blackbox/tst_blackboxwindows.cpp index d1d62496c..94257c062 100644 --- a/tests/auto/blackbox/tst_blackboxwindows.cpp +++ b/tests/auto/blackbox/tst_blackboxwindows.cpp @@ -180,7 +180,7 @@ void TestBlackboxWindows::standaloneCodesign() QCOMPARE(runQbs(params), 0); if (!m_qbsStdout.contains("signtool path:")) - QFAIL("No current signtool path pattern exists"); + QSKIP("No current signtool path pattern exists"); const auto signtoolPath = extractSigntoolPath(m_qbsStdout); QVERIFY(QFileInfo(signtoolPath).exists()); |