From 4591f14e80e66e33cbee348f8cb7cfe6810f747e Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Tue, 2 Apr 2019 21:30:32 +0900 Subject: [PATCH 1/8] Xcode 10.2: Update to recommended settings --- Himotoki.xcodeproj/project.pbxproj | 7 +++++-- .../xcshareddata/xcschemes/Himotoki-iOS.xcscheme | 2 +- .../xcshareddata/xcschemes/Himotoki-macOS.xcscheme | 2 +- .../xcshareddata/xcschemes/Himotoki-tvOS.xcscheme | 2 +- .../xcshareddata/xcschemes/Himotoki-watchOS.xcscheme | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Himotoki.xcodeproj/project.pbxproj b/Himotoki.xcodeproj/project.pbxproj index 4c047ad..46e94e2 100644 --- a/Himotoki.xcodeproj/project.pbxproj +++ b/Himotoki.xcodeproj/project.pbxproj @@ -562,7 +562,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0710; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Syo Ikeda"; TargetAttributes = { CD8F0DC61B6D014B0021196A = { @@ -599,10 +599,11 @@ }; buildConfigurationList = CD929A311AF4A2C3002F5C53 /* Build configuration list for PBXProject "Himotoki" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = CD929A2D1AF4A2C3002F5C53; productRefGroup = CD929A381AF4A2C3002F5C53 /* Products */; @@ -832,6 +833,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = CD748AE01B4440CB00632C3F /* Debug.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; @@ -864,6 +866,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = CD748AE21B4440CB00632C3F /* Release.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_INFINITE_RECURSION = YES; diff --git a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-iOS.xcscheme b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-iOS.xcscheme index bcd9e8a..d3950d3 100644 --- a/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-iOS.xcscheme +++ b/Himotoki.xcodeproj/xcshareddata/xcschemes/Himotoki-iOS.xcscheme @@ -1,6 +1,6 @@ Date: Tue, 2 Apr 2019 21:35:50 +0900 Subject: [PATCH 2/8] [SE-0185] Remove now-unnecessary Hashable implementation https://github.com/apple/swift-evolution/blob/master/proposals/0185-synthesize-equatable-hashable.md --- Sources/DecodeError.swift | 33 +-------------------------------- Sources/KeyPath.swift | 12 +----------- 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/Sources/DecodeError.swift b/Sources/DecodeError.swift index 0c4a309..32befa8 100644 --- a/Sources/DecodeError.swift +++ b/Sources/DecodeError.swift @@ -6,7 +6,7 @@ // Copyright © 2015 Syo Ikeda. All rights reserved. // -public enum DecodeError: Error { +public enum DecodeError: Error, Hashable { case missingKeyPath(KeyPath) case typeMismatch(expected: String, actual: String, keyPath: KeyPath) case custom(String) @@ -27,37 +27,6 @@ extension DecodeError: CustomDebugStringConvertible { } } -extension DecodeError: Hashable { - public static func == (lhs: DecodeError, rhs: DecodeError) -> Bool { - switch (lhs, rhs) { - case let (.missingKeyPath(l), .missingKeyPath(r)): - return l == r - - case let (.typeMismatch(la, lb, lc), .typeMismatch(ra, rb, rc)): - return la == ra && lb == rb && lc == rc - - case let (.custom(l), .custom(r)): - return l == r - - default: - return false - } - } - - public var hashValue: Int { - switch self { - case let .missingKeyPath(keyPath): - return keyPath.hashValue - - case let .typeMismatch(expected, actual, keyPath): - return expected.hashValue ^ actual.hashValue ^ keyPath.hashValue - - case let .custom(message): - return message.hashValue - } - } -} - public func missingKeyPath(_ keyPath: KeyPath) -> DecodeError { return DecodeError.missingKeyPath(keyPath) } diff --git a/Sources/KeyPath.swift b/Sources/KeyPath.swift index 425fea1..04961b0 100644 --- a/Sources/KeyPath.swift +++ b/Sources/KeyPath.swift @@ -6,7 +6,7 @@ // Copyright (c) 2015 Syo Ikeda. All rights reserved. // -public struct KeyPath { +public struct KeyPath: Hashable { public let components: [String] public init(_ key: String) { @@ -26,16 +26,6 @@ extension KeyPath { } } -extension KeyPath: Hashable { - public static func == (lhs: KeyPath, rhs: KeyPath) -> Bool { - return lhs.components == rhs.components - } - - public var hashValue: Int { - return components.reduce(0) { $0 ^ $1.hashValue } - } -} - extension KeyPath: CustomDebugStringConvertible { public var debugDescription: String { return "KeyPath(\(components))" From 4ed113cae50ae6b48c5da8956be8737bc97513a9 Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Tue, 2 Apr 2019 21:37:54 +0900 Subject: [PATCH 3/8] Update SWIFT_VERSION to 4.2 --- .swift-version | 2 +- Himotoki.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.swift-version b/.swift-version index 7d5c902..bf77d54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.1 +4.2 diff --git a/Himotoki.xcodeproj/project.pbxproj b/Himotoki.xcodeproj/project.pbxproj index 46e94e2..cad6cae 100644 --- a/Himotoki.xcodeproj/project.pbxproj +++ b/Himotoki.xcodeproj/project.pbxproj @@ -853,7 +853,7 @@ MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.ikesyo.$(PRODUCT_NAME:rfc1034identifier)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; @@ -884,7 +884,7 @@ MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.ikesyo.$(PRODUCT_NAME:rfc1034identifier)"; SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TVOS_DEPLOYMENT_TARGET = 9.0; VERSIONING_SYSTEM = "apple-generic"; From 2af78d03ed505c6459134a3469688d5631cdd0d8 Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Tue, 2 Apr 2019 21:39:11 +0900 Subject: [PATCH 4/8] Update LastSwiftMigration --- Himotoki.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Himotoki.xcodeproj/project.pbxproj b/Himotoki.xcodeproj/project.pbxproj index cad6cae..16e1915 100644 --- a/Himotoki.xcodeproj/project.pbxproj +++ b/Himotoki.xcodeproj/project.pbxproj @@ -588,12 +588,12 @@ }; CDF03E321AF606F60041C3AA = { CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0800; + LastSwiftMigration = 1020; ProvisioningStyle = Manual; }; CDF03E3C1AF606F60041C3AA = { CreatedOnToolsVersion = 6.3; - LastSwiftMigration = 0800; + LastSwiftMigration = 1020; }; }; }; From 930bad945ecdab4177e934fba39b97b3df3eb6c7 Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Tue, 2 Apr 2019 21:53:33 +0900 Subject: [PATCH 5/8] Update .travis.yml --- .travis.yml | 60 +++++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee94a6c..eb97dd6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,16 @@ +branches: + only: + - master + env: global: - LC_CTYPE=en_US.UTF-8 matrix: include: - - os: osx + - &cocoapods + os: osx language: objective-c - osx_image: xcode9.4 + osx_image: xcode10.1 script: # To work around the lint error: "ERROR | swift: Specification `Himotoki` specifies an inconsistent `swift_version` (`4.0`) compared to the one present in your `.swift-version` file (`4.1`). Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec." # `.swift-version` is for swiftenv, not for CocoaPods, so we can't remove the file as suggested. @@ -13,7 +18,8 @@ matrix: - pod lib lint env: - JOB=PODSPEC - - os: osx + - &xcode + os: osx language: objective-c osx_image: xcode9.4 script: @@ -21,15 +27,12 @@ matrix: - rake "build[build-for-testing test-without-building, Himotoki-iOS, iphonesimulator, name=iPhone 8]" - rake "build[build-for-testing test-without-building, Himotoki-tvOS, appletvsimulator, name=Apple TV]" - rake "build[build, Himotoki-watchOS, watchsimulator, name=Apple Watch - 38mm]" - - os: osx - language: objective-c + - <<: *xcode osx_image: xcode10.1 - script: - - rake "build[build-for-testing test-without-building, Himotoki-macOS, macosx, arch=x86_64]" - - rake "build[build-for-testing test-without-building, Himotoki-iOS, iphonesimulator, name=iPhone 8]" - - rake "build[build-for-testing test-without-building, Himotoki-tvOS, appletvsimulator, name=Apple TV]" - - rake "build[build, Himotoki-watchOS, watchsimulator, name=Apple Watch - 38mm]" - - os: osx + - <<: *xcode + osx_image: xcode10.2 + - &swiftpm_darwin + os: osx language: generic osx_image: xcode9.4 script: @@ -38,19 +41,12 @@ matrix: - swift test env: - JOB=SWIFTPM_DARWIN - - os: osx - language: generic + - <<: *swiftpm_darwin osx_image: xcode10.1 - before_install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - script: - - swift --version - - swift build - - swift test - env: - - JOB=SWIFTPM_DARWIN - - SWIFT_VERSION=4.2.1 - - os: linux + - <<: *swiftpm_darwin + osx_image: xcode10.2 + - &swiftpm_linux + os: linux language: generic sudo: required dist: trusty @@ -62,18 +58,14 @@ matrix: - swift test env: - JOB=SWIFTPM_LINUX - - os: linux - language: generic - sudo: required - dist: trusty - before_install: - - eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/9f442512a46d7a2af7b850d65a7e9bd31edfb09b/swiftenv-install.sh)" - script: - - swift --version - - swift build - - swift test + - SWIFT_VERSION=4.1.3 + - <<: *swiftpm_linux + env: + - JOB=SWIFTPM_LINUX + - SWIFT_VERSION=4.2.4 + - <<: *swiftpm_linux env: - JOB=SWIFTPM_LINUX - - SWIFT_VERSION=4.2.1 + - SWIFT_VERSION=5.0 notifications: email: false From 51e8d626868cc85b0f0ae3654cb27ee8806365fa Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Tue, 2 Apr 2019 22:05:16 +0900 Subject: [PATCH 6/8] Bump the requirements to Swift 4.2 and Xcode 10.1 --- .travis.yml | 12 ++---------- Himotoki.podspec | 2 +- Package.swift | 7 +++++-- Package@swift-4.2.swift | 14 ++++++++++++++ README.md | 2 +- 5 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 Package@swift-4.2.swift diff --git a/.travis.yml b/.travis.yml index eb97dd6..3bd941b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,28 +21,24 @@ matrix: - &xcode os: osx language: objective-c - osx_image: xcode9.4 + osx_image: xcode10.1 script: - rake "build[build-for-testing test-without-building, Himotoki-macOS, macosx, arch=x86_64]" - rake "build[build-for-testing test-without-building, Himotoki-iOS, iphonesimulator, name=iPhone 8]" - rake "build[build-for-testing test-without-building, Himotoki-tvOS, appletvsimulator, name=Apple TV]" - rake "build[build, Himotoki-watchOS, watchsimulator, name=Apple Watch - 38mm]" - - <<: *xcode - osx_image: xcode10.1 - <<: *xcode osx_image: xcode10.2 - &swiftpm_darwin os: osx language: generic - osx_image: xcode9.4 + osx_image: xcode10.1 script: - swift --version - swift build - swift test env: - JOB=SWIFTPM_DARWIN - - <<: *swiftpm_darwin - osx_image: xcode10.1 - <<: *swiftpm_darwin osx_image: xcode10.2 - &swiftpm_linux @@ -56,10 +52,6 @@ matrix: - swift --version - swift build - swift test - env: - - JOB=SWIFTPM_LINUX - - SWIFT_VERSION=4.1.3 - - <<: *swiftpm_linux env: - JOB=SWIFTPM_LINUX - SWIFT_VERSION=4.2.4 diff --git a/Himotoki.podspec b/Himotoki.podspec index 973f17e..66fa0d3 100644 --- a/Himotoki.podspec +++ b/Himotoki.podspec @@ -25,6 +25,6 @@ DESC s.source_files = "Sources/**/*.swift" s.requires_arc = true - s.swift_version = "4.0" s.cocoapods_version = ">= 1.4.0" + s.swift_version = "4.2" end diff --git a/Package.swift b/Package.swift index 78f568f..41ca7d8 100644 --- a/Package.swift +++ b/Package.swift @@ -1,8 +1,11 @@ -// swift-tools-version:4.0 +// swift-tools-version:5.0 import PackageDescription let package = Package( name: "Himotoki", + platforms: [ + .macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v2) + ], products: [ .library(name: "Himotoki", targets: ["Himotoki"]), ], @@ -10,5 +13,5 @@ let package = Package( .target(name: "Himotoki", dependencies: [], path: "Sources"), .testTarget(name: "HimotokiTests", dependencies: ["Himotoki"]), ], - swiftLanguageVersions: [4] + swiftLanguageVersions: [.v5] ) diff --git a/Package@swift-4.2.swift b/Package@swift-4.2.swift new file mode 100644 index 0000000..d686762 --- /dev/null +++ b/Package@swift-4.2.swift @@ -0,0 +1,14 @@ +// swift-tools-version:4.2 +import PackageDescription + +let package = Package( + name: "Himotoki", + products: [ + .library(name: "Himotoki", targets: ["Himotoki"]), + ], + targets: [ + .target(name: "Himotoki", dependencies: [], path: "Sources"), + .testTarget(name: "HimotokiTests", dependencies: ["Himotoki"]), + ], + swiftLanguageVersions: [.v4_2] +) diff --git a/README.md b/README.md index 7858190..d75ccfd 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ let otherURLs: [URL] = try URLTransformer.apply(e <| "bar_urls") Himotoki 4.x requires / supports the following environments: -- Swift 4.1 / Xcode 9.3 or later +- Swift 4.2 / Xcode 10.1 or later - OS X 10.9 or later - iOS 8.0 or later - tvOS 9.0 or later From 4f5b7615af4fae103cdc200eeda6128c0c821798 Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Tue, 2 Apr 2019 22:06:37 +0900 Subject: [PATCH 7/8] Update podspec version --- Himotoki.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Himotoki.podspec b/Himotoki.podspec index 66fa0d3..59c896f 100644 --- a/Himotoki.podspec +++ b/Himotoki.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Himotoki" - s.version = "3.2.0" + s.version = "4.0.0" s.summary = "A type-safe JSON decoding library purely written in Swift" s.description = <<-DESC Himotoki (紐解き) is a type-safe JSON decoding library purely written in Swift. This library is highly inspired by popular JSON parsing libraries in Swift: [Argo](https://github.com/thoughtbot/Argo) and [ObjectMapper](https://github.com/Hearst-DD/ObjectMapper). From b3926c449ee9322164ec40a82ab951be83b17e0f Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Tue, 2 Apr 2019 22:14:47 +0900 Subject: [PATCH 8/8] [CI] Update CocoaPods --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 3bd941b..14290ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ matrix: language: objective-c osx_image: xcode10.1 script: + - gem update cocoapods # To work around the lint error: "ERROR | swift: Specification `Himotoki` specifies an inconsistent `swift_version` (`4.0`) compared to the one present in your `.swift-version` file (`4.1`). Please remove the `.swift-version` file which is now deprecated and only use the `swift_version` attribute within your podspec." # `.swift-version` is for swiftenv, not for CocoaPods, so we can't remove the file as suggested. - rm .swift-version