From e65206c00c3b471b862b22a09c7cdfc15af9fe8c Mon Sep 17 00:00:00 2001 From: Matt Rubin Date: Thu, 11 Apr 2019 19:39:16 -0400 Subject: [PATCH] Migrate all targets to Swift 4.2 --- SwiftGit2.xcodeproj/project.pbxproj | 14 ++++++-------- SwiftGit2Tests/RepositorySpec.swift | 8 +++++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/SwiftGit2.xcodeproj/project.pbxproj b/SwiftGit2.xcodeproj/project.pbxproj index 44304c1..ab9cd09 100644 --- a/SwiftGit2.xcodeproj/project.pbxproj +++ b/SwiftGit2.xcodeproj/project.pbxproj @@ -601,18 +601,18 @@ ORGANIZATIONNAME = "GitHub, Inc"; TargetAttributes = { 621E66611C72958800A0F352 = { - LastSwiftMigration = 0810; + LastSwiftMigration = 1010; }; 621E66B61C72958D00A0F352 = { - LastSwiftMigration = 0810; + LastSwiftMigration = 1010; }; BEB31F221A0D6F7A00F525B9 = { CreatedOnToolsVersion = 6.1; - LastSwiftMigration = 0810; + LastSwiftMigration = 1010; }; BEB31F2D1A0D6F7A00F525B9 = { CreatedOnToolsVersion = 6.1; - LastSwiftMigration = 0810; + LastSwiftMigration = 1010; }; BEB31F8E1A0E563900F525B9 = { CreatedOnToolsVersion = 6.1; @@ -983,7 +983,7 @@ INSTALL_OWNER = ""; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -998,7 +998,7 @@ INSTALL_OWNER = ""; IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.9; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -1027,7 +1027,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = SwiftGit2; SWIFT_INCLUDE_PATHS = "$(SRCROOT)/libgit2"; - SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -1056,7 +1055,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = SwiftGit2; SWIFT_INCLUDE_PATHS = "$(SRCROOT)/libgit2"; - SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/SwiftGit2Tests/RepositorySpec.swift b/SwiftGit2Tests/RepositorySpec.swift index 081ed64..ee1855c 100644 --- a/SwiftGit2Tests/RepositorySpec.swift +++ b/SwiftGit2Tests/RepositorySpec.swift @@ -59,7 +59,7 @@ class RepositorySpec: QuickSpec { try! FileManager.default.createDirectory( at: localURL, withIntermediateDirectories: true, - attributes: nonReadablePermissions) + attributes: convertToOptionalFileAttributeKeyDictionary(nonReadablePermissions)) let result = Repository.isValid(url: localURL) expect(result.value).to(beNil()) @@ -969,3 +969,9 @@ class RepositorySpec: QuickSpec { return URL(fileURLWithPath: path) } } + +// Helper function inserted by Swift 4.2 migrator. +fileprivate func convertToOptionalFileAttributeKeyDictionary(_ input: [String: Any]?) -> [FileAttributeKey: Any]? { + guard let input = input else { return nil } + return Dictionary(uniqueKeysWithValues: input.map { key, value in (FileAttributeKey(rawValue: key), value)}) +}