From ce1571ac01e815c71a6075a4bad1c7b5ec4820dd Mon Sep 17 00:00:00 2001 From: der richter Date: Fri, 25 Dec 2020 14:47:35 +0100 Subject: mac: drop build support for swift versions earlier than version 4.1 this drops support for swift <4.1 and with this support for xcode <=9.2. this was the last setup that is officially working on macOS 10.12. our old legacy build macOS 10.12 + xcode 9.2 is replaced by macOS 10.13 + xcode 9.4.1 with swift 4.1. the macOS 10.13 + xcode 10.1 VM is replaced by the latest macOS 10.14 + xcode 11.3.1 VM. this is the oldest version officially supported by Apple. this is in preparations for the following commit. --- .travis.yml | 20 +++++++------------- osdep/macos/swift_compat.swift | 27 --------------------------- waftools/checks/custom.py | 24 +++++++++++++----------- wscript | 2 +- 4 files changed, 21 insertions(+), 52 deletions(-) diff --git a/.travis.yml b/.travis.yml index 85d4cc2485..18946c05e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,18 +36,13 @@ matrix: - <<: *mac osx_image: xcode12.2 - <<: *mac - osx_image: xcode10.1 - env: - - HOMEBREW_NO_AUTO_UPDATE=1 - - HOMEBREW_NO_INSTALL_CLEANUP=1 - - CI_HOMEBREW_HASH=7242872d7878f1a4c2706e5837faafcf0782b58d + osx_image: xcode11.3 - <<: *mac - osx_image: xcode9.2 + osx_image: xcode9.4 env: - HOMEBREW_NO_AUTO_UPDATE=1 - HOMEBREW_NO_INSTALL_CLEANUP=1 - - CI_SWIFT_FLAGS="\-target x86_64-apple-macosx10.12" - - CI_HOMEBREW_HASH=55e02323812604add9a69bab8730319b9255a697 + - CI_HOMEBREW_HASH=7242872d7878f1a4c2706e5837faafcf0782b58d - os: freebsd compiler: clang - os: linux @@ -62,7 +57,7 @@ matrix: env: CI_SCRIPT=ci/build-mingw64.sh TARGET=x86_64-w64-mingw32 allow_failures: - os: osx - osx_image: xcode9.2 + osx_image: xcode9.4 fast_finish: true dist: focal @@ -123,15 +118,14 @@ before_install: fi - | if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - remove=$(brew list) + remove=$(brew list --formula) keep="gettext pcre2 git" install="autoconf automake pkg-config libtool python freetype fribidi little-cms2 luajit libass ffmpeg" for formula in ${keep[@]}; do remove=("${remove[@]/$formula}"); done for formula in ${install[@]}; do remove=("${remove[@]/$formula}"); done brew remove --force $remove --ignore-dependencies - if [[ "$TRAVIS_OSX_IMAGE" == "xcode9.2" ]]; then - brew untap caskroom/cask - fi + brew remove --cask $(brew list --cask) + brew untap homebrew/cask brew update if [[ -n "$CI_HOMEBREW_HASH" ]]; then pushd "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" diff --git a/osdep/macos/swift_compat.swift b/osdep/macos/swift_compat.swift index c14aa08282..24c00b0ae1 100644 --- a/osdep/macos/swift_compat.swift +++ b/osdep/macos/swift_compat.swift @@ -33,7 +33,6 @@ extension String { #endif extension NSPasteboard.PasteboardType { - static let fileURLCompat: NSPasteboard.PasteboardType = { if #available(OSX 10.13, *) { return .fileURL @@ -53,7 +52,6 @@ extension NSPasteboard.PasteboardType { #if !swift(>=5.0) extension Data { - mutating func withUnsafeMutableBytes(_ body: (UnsafeMutableRawBufferPointer) throws -> Type) rethrows -> Type { let dataCount = count return try withUnsafeMutableBytes { (ptr: UnsafeMutablePointer) throws -> Type in @@ -65,33 +63,8 @@ extension Data { #if !swift(>=4.2) extension NSDraggingInfo { - var draggingPasteboard: NSPasteboard { get { return draggingPasteboard() } } } #endif - -#if !swift(>=4.1) -extension Array { - - func compactMap(_ transform: (Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] { - return try self.flatMap(transform) - } -} - -extension Array where Element == [CGLPixelFormatAttribute] { - - func contains(_ obj: [CGLPixelFormatAttribute]) -> Bool { - return self.contains(where:{ $0 == obj }) - } -} - -extension NSWindow.Level { - - static func +(left: NSWindow.Level, right: Int) -> NSWindow.Level { - return NSWindow.Level(left.rawValue + right) - } -} -#endif - diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py index 36c1d85d06..964546977b 100644 --- a/waftools/checks/custom.py +++ b/waftools/checks/custom.py @@ -114,17 +114,19 @@ def check_cocoa(ctx, dependency_identifier): return res -def check_swift(ctx, dependency_identifier): - minVer = StrictVersion("3.0.2") - if ctx.env.SWIFT_VERSION: - if StrictVersion(ctx.env.SWIFT_VERSION) >= minVer: - ctx.add_optional_message(dependency_identifier, - 'version found: ' + str(ctx.env.SWIFT_VERSION)) - return True - ctx.add_optional_message(dependency_identifier, - "'swift >= " + str(minVer) + "' not found, found " + - str(ctx.env.SWIFT_VERSION or None)) - return False +def check_swift(version): + def fn(ctx, dependency_identifier): + minVer = StrictVersion(version) + if ctx.env.SWIFT_VERSION: + if StrictVersion(ctx.env.SWIFT_VERSION) >= minVer: + ctx.add_optional_message(dependency_identifier, + 'version found: ' + str(ctx.env.SWIFT_VERSION)) + return True + ctx.add_optional_message(dependency_identifier, + "'swift >= " + str(minVer) + "' not found, found " + + str(ctx.env.SWIFT_VERSION or None)) + return False + return fn def check_egl_provider(minVersion=None, name='egl', check=None): def fn(ctx, dependency_identifier, **kw): diff --git a/wscript b/wscript index cee9086666..86231b79b1 100644 --- a/wscript +++ b/wscript @@ -182,7 +182,7 @@ main_dependencies = [ 'name': '--swift', 'desc': 'macOS Swift build tools', 'deps': 'os-darwin', - 'func': compose_checks(check_swift, check_macos_sdk('10.10')), + 'func': compose_checks(check_swift('4.1'), check_macos_sdk('10.10')), }, { 'name': '--uwp', 'desc': 'Universal Windows Platform', -- cgit v1.2.3