From 0ec4baf922ce4547ec7f61dba6f9369874834d18 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 2 Apr 2020 14:14:13 +0200 Subject: Darwin: Adapt to Xcode 11.4 The "Version" entry in SDKSettings.plist has three digits now. Also adapt the deploymentData autotest to take into account that we no longer pass the "version_min" options. Fixes: QBS-1543 Change-Id: Ibc1bcfd44583721c4bed1db812eca892ee316eeb Reviewed-by: Leon Buckel Reviewed-by: Ivan Komissarov Reviewed-by: Joerg Bornemann --- share/qbs/modules/xcode/xcode.js | 16 ++-------------- share/qbs/modules/xcode/xcode.qbs | 16 +++++++++++----- .../testdata-apple/xcode/xcode-project.qbs | 7 +++++-- tests/auto/blackbox/tst_blackboxapple.cpp | 22 +++++++++++----------- 4 files changed, 29 insertions(+), 32 deletions(-) diff --git a/share/qbs/modules/xcode/xcode.js b/share/qbs/modules/xcode/xcode.js index bda41ade9..d20d9cf0c 100644 --- a/share/qbs/modules/xcode/xcode.js +++ b/share/qbs/modules/xcode/xcode.js @@ -114,7 +114,7 @@ function sdkInfoList(sdksPath) { if (!plist || !plist["CanonicalName"] || !plist["Version"]) return false; - var re = /^([0-9]+)\.([0-9]+)$/; + var re = /^[0-9]+\.[0-9]+(\.[0-9]+)?$/; return plist["Version"].match(re); } @@ -132,19 +132,7 @@ function sdkInfoList(sdksPath) { } // Sort by SDK version number - sdkInfo.sort(function (a, b) { - var re = /^([0-9]+)\.([0-9]+)$/; - a = a["Version"].match(re); - if (a) - a = {major: a[1], minor: a[2]}; - b = b["Version"].match(re); - if (b) - b = {major: b[1], minor: b[2]}; - - if (a.major === b.major) - return a.minor - b.minor; - return a.major - b.major; - }); + sdkInfo.sort(function (a, b) { return Utilities.versionCompare(a["Version"], b["Version"]); }); return sdkInfo; } diff --git a/share/qbs/modules/xcode/xcode.qbs b/share/qbs/modules/xcode/xcode.qbs index 648948192..7bbb29c6e 100644 --- a/share/qbs/modules/xcode/xcode.qbs +++ b/share/qbs/modules/xcode/xcode.qbs @@ -49,6 +49,12 @@ Module { return _sdkSettings["Version"]; } } + readonly property string shortSdkVersion: { + var v = sdkVersion; + if (v && v.split('.').length > 2) + v = v.slice(0, v.lastIndexOf('.')); + return v; + } readonly property string latestSdkName: { if (_latestSdk) { @@ -117,8 +123,8 @@ Module { + ".platform") readonly property path sdkPath: FileInfo.joinPaths(sdksPath, DarwinTools.applePlatformDirectoryName( - qbs.targetOS, platformType, sdkVersion) - + ".sdk") + qbs.targetOS, platformType, + shortSdkVersion) + ".sdk") // private properties readonly property path toolchainsPath: FileInfo.joinPaths(developerPath, "Toolchains") @@ -206,14 +212,14 @@ Module { validator.setRequiredProperty("platformPath", platformPath); validator.setRequiredProperty("sdksPath", sdkPath); validator.setRequiredProperty("sdkPath", sdkPath); - validator.addVersionValidator("sdkVersion", sdkVersion, 2, 2); + validator.addVersionValidator("sdkVersion", sdkVersion, 2, 3); validator.addCustomValidator("sdkName", sdkName, function (value) { return value === DarwinTools.applePlatformDirectoryName( - qbs.targetOS, platformType, sdkVersion, false).toLowerCase(); + qbs.targetOS, platformType, shortSdkVersion, false).toLowerCase(); }, "is '" + sdkName + "', but target OS is [" + qbs.targetOS.join(",") + "] and Xcode SDK version is '" + sdkVersion + "'"); validator.addCustomValidator("sdk", sdk, function (value) { - return value === sdkName || (value + sdkVersion) === sdkName; + return value === sdkName || (value + shortSdkVersion) === sdkName; }, "is '" + sdk + "', but canonical SDK name is '" + sdkName + "'"); validator.validate(); } diff --git a/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs b/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs index fbab6d0b1..fa4c67b96 100644 --- a/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs +++ b/tests/auto/blackbox/testdata-apple/xcode/xcode-project.qbs @@ -43,8 +43,11 @@ Project { } for (var i = 0; i < a.length; ++i) { - if (a[i] !== b[i]) { - throw msg; + var version1 = a[i].split('.'); + var version2 = b[i].split('.'); + for (var j = 0; j < version1.length; ++j) { + if (version1[j] !== version2[j]) + throw msg; } } } diff --git a/tests/auto/blackbox/tst_blackboxapple.cpp b/tests/auto/blackbox/tst_blackboxapple.cpp index 21cecf9ad..dca68fc33 100644 --- a/tests/auto/blackbox/tst_blackboxapple.cpp +++ b/tests/auto/blackbox/tst_blackboxapple.cpp @@ -650,47 +650,47 @@ void TestBlackboxApple::deploymentTarget_data() } QTest::newRow("macos x86_64") << "macosx" << macos << "x86_64" << "-triple x86_64-apple-macosx10.6" - << "-macosx_version_min 10.6"; + << "10.6"; if (xcodeVersion >= qbs::Version(6)) QTest::newRow("macos x86_64h") << "macosx" << macos << "x86_64h" << "-triple x86_64h-apple-macosx10.12" - << "-macosx_version_min 10.12"; + << "10.12"; QTest::newRow("ios armv7a") << "iphoneos" << ios << "armv7a" << "-triple thumbv7-apple-ios6.0" - << "-iphoneos_version_min 6.0"; + << "6.0"; QTest::newRow("ios armv7s") << "iphoneos" <= qbs::Version(5)) QTest::newRow("ios arm64") << "iphoneos" <= qbs::Version(5)) QTest::newRow("ios-simulator x86_64") << "iphonesimulator" << ios_sim << "x86_64" << "-triple x86_64-apple-ios7.0" - << "-ios_simulator_version_min 7.0"; + << "7.0"; if (xcodeVersion >= qbs::Version(7)) { if (xcodeVersion >= qbs::Version(7, 1)) { QTest::newRow("tvos arm64") << "appletvos" << tvos << "arm64" << "-triple arm64-apple-tvos9.0" - << "-tvos_version_min 9.0"; + << "9.0"; QTest::newRow("tvos-simulator x86_64") << "appletvsimulator" << tvos_sim << "x86_64" << "-triple x86_64-apple-tvos9.0" - << "-tvos_simulator_version_min 9.0"; + << "9.0"; } QTest::newRow("watchos armv7k") << "watchos" << watchos << "armv7k" << "-triple thumbv7k-apple-watchos2.0" - << "-watchos_version_min 2.0"; + << "2.0"; QTest::newRow("watchos-simulator x86") << "watchsimulator" << watchos_sim << "x86" << "-triple i386-apple-watchos2.0" - << "-watchos_simulator_version_min 2.0"; + << "2.0"; } } -- cgit v1.2.3