Skip to content

Commit

Permalink
Merge pull request #206 from ikesyo/xcode-10.2
Browse files Browse the repository at this point in the history
Xcode 10.2
  • Loading branch information
ikesyo authored Apr 2, 2019
2 parents a056d3f + b3926c4 commit 1fad810
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.1
4.2
57 changes: 21 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,49 @@
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:
- 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
- pod lib lint
env:
- JOB=PODSPEC
- os: osx
language: objective-c
osx_image: xcode9.4
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
os: osx
language: objective-c
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
language: generic
osx_image: xcode9.4
script:
- swift --version
- swift build
- swift test
env:
- JOB=SWIFTPM_DARWIN
- os: osx
- <<: *xcode
osx_image: xcode10.2
- &swiftpm_darwin
os: osx
language: generic
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
Expand All @@ -62,18 +55,10 @@ 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.2.4
- <<: *swiftpm_linux
env:
- JOB=SWIFTPM_LINUX
- SWIFT_VERSION=4.2.1
- SWIFT_VERSION=5.0
notifications:
email: false
4 changes: 2 additions & 2 deletions Himotoki.podspec
Original file line number Diff line number Diff line change
@@ -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).
Expand All @@ -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
15 changes: 9 additions & 6 deletions Himotoki.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Syo Ikeda";
TargetAttributes = {
CD8F0DC61B6D014B0021196A = {
Expand All @@ -588,21 +588,22 @@
};
CDF03E321AF606F60041C3AA = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
ProvisioningStyle = Manual;
};
CDF03E3C1AF606F60041C3AA = {
CreatedOnToolsVersion = 6.3;
LastSwiftMigration = 0800;
LastSwiftMigration = 1020;
};
};
};
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 */;
Expand Down Expand Up @@ -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;
Expand All @@ -851,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";
Expand All @@ -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;
Expand All @@ -881,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";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
7 changes: 5 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
// 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"]),
],
targets: [
.target(name: "Himotoki", dependencies: [], path: "Sources"),
.testTarget(name: "HimotokiTests", dependencies: ["Himotoki"]),
],
swiftLanguageVersions: [4]
swiftLanguageVersions: [.v5]
)
14 changes: 14 additions & 0 deletions Package@swift-4.2.swift
Original file line number Diff line number Diff line change
@@ -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]
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 1 addition & 32 deletions Sources/DecodeError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down
12 changes: 1 addition & 11 deletions Sources/KeyPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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))"
Expand Down

0 comments on commit 1fad810

Please sign in to comment.