Skip to content

Commit

Permalink
Swift 5 Migration (#74)
Browse files Browse the repository at this point in the history
* update project settings

* migrate to Swift 5

* add Swift 5 targets to travis

* add tvOS 3 to targeted device families

* use latest CocoaPods to support #swift_versions

* fix failing tests (unsorted dictionary keys)
  • Loading branch information
DivineDominion authored Apr 25, 2019
1 parent f60695f commit bbf945f
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 42 deletions.
21 changes: 10 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ branches:
- gh-pages

install:
- gem install cocoapods --pre -N
- gem install xcpretty -N

env:
Expand All @@ -21,20 +22,18 @@ matrix:
env: SCHEME="macOS" SDK="macosx10.13" DESTINATION="arch=x86_64" SWIFT_VERSION="4.1" ACTION="test"
- osx_image: xcode10.1
env: SCHEME="macOS" SDK="macosx10.14" DESTINATION="arch=x86_64" SWIFT_VERSION="4.2" ACTION="test"
- osx_image: xcode10.1
env: SCHEME="iOS" SDK="iphonesimulator" DESTINATION="OS=12.0,name=iPhone 8" SWIFT_VERSION="4.2" ACTION="test"
- osx_image: xcode10.1
env: SCHEME="watchOS" SDK="watchsimulator" DESTINATION="OS=4.0,name=Apple Watch - 42mm" SWIFT_VERSION="4.2" ACTION="build"
- osx_image: xcode10.1
env: SCHEME="tvOS" SDK="appletvsimulator" DESTINATION="OS=12.0,name=Apple TV 4K" SWIFT_VERSION="4.2" ACTION="test"

script:
- xcodebuild -project SwiftCSV.xcodeproj -scheme "SwiftCSV" -sdk iphonesimulator
-destination "platform=iOS Simulator,name=iPhone 6" ONLY_ACTIVE_ARCH=NO test | xcpretty -c

- osx_image: xcode10.2
env: SCHEME="macOS" SDK="macosx10.14" DESTINATION="arch=x86_64" SWIFT_VERSION="5.0" ACTION="test"
- osx_image: xcode10.2
env: SCHEME="iOS" SDK="iphonesimulator" DESTINATION="OS=12.0,name=iPhone 8" SWIFT_VERSION="5.0" ACTION="test"
- osx_image: xcode10.2
env: SCHEME="watchOS" SDK="watchsimulator" DESTINATION="OS=4.0,name=Apple Watch - 42mm" SWIFT_VERSION="5.0" ACTION="build"
- osx_image: xcode10.2
env: SCHEME="tvOS" SDK="appletvsimulator" DESTINATION="OS=12.0,name=Apple TV 4K" SWIFT_VERSION="5.0" ACTION="test"

script:
- set -o pipefail
- pod --version
- xcodebuild -version
- xcodebuild -showsdks
- xcodebuild
Expand Down
55 changes: 30 additions & 25 deletions SwiftCSV.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -418,48 +418,49 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0940;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "Naoto Kaneko";
TargetAttributes = {
3D1E59B31945FFAC001CF760 = {
CreatedOnToolsVersion = 6.0;
LastSwiftMigration = 0940;
LastSwiftMigration = 1020;
ProvisioningStyle = Manual;
};
3D1E59BE1945FFAD001CF760 = {
CreatedOnToolsVersion = 6.0;
DevelopmentTeam = 2X7R4W3Y3Q;
LastSwiftMigration = 0940;
LastSwiftMigration = 1020;
TestTargetID = 3D1E59B31945FFAC001CF760;
};
5FB74B901CCB9274009DDBF1 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0940;
LastSwiftMigration = 1020;
};
5FB74B991CCB9274009DDBF1 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0940;
LastSwiftMigration = 1020;
};
5FB74BAC1CCB929D009DDBF1 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0940;
LastSwiftMigration = 1020;
};
5FB74BB51CCB929D009DDBF1 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0940;
LastSwiftMigration = 1020;
};
5FB74BC81CCB92BA009DDBF1 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0940;
LastSwiftMigration = 1020;
};
};
};
buildConfigurationList = 3D1E59AE1945FFAC001CF760 /* Build configuration list for PBXProject "SwiftCSV" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 3D1E59AA1945FFAC001CF760;
productRefGroup = 3D1E59B51945FFAC001CF760 /* Products */;
Expand Down Expand Up @@ -668,6 +669,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -726,6 +728,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -789,7 +792,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -808,7 +811,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "naoty.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -829,7 +832,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -845,7 +848,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "naoty.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -871,7 +874,7 @@
PRODUCT_NAME = SwiftCSV;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -898,7 +901,7 @@
PRODUCT_NAME = SwiftCSV;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -917,7 +920,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "naoty.SwiftCSV.SwiftCSV-OSXTests";
PRODUCT_NAME = SwiftCSVTests;
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -937,7 +940,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "naoty.SwiftCSV.SwiftCSV-OSXTests";
PRODUCT_NAME = SwiftCSVTests;
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -960,8 +963,8 @@
PRODUCT_NAME = SwiftCSV;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
Expand All @@ -986,8 +989,8 @@
PRODUCT_NAME = SwiftCSV;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
Expand All @@ -1004,7 +1007,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "naoty.SwiftCSV.SwiftCSV-tvOSTests";
PRODUCT_NAME = SwiftCSVTests;
SDKROOT = appletvos;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Debug;
Expand All @@ -1022,7 +1026,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "naoty.SwiftCSV.SwiftCSV-tvOSTests";
PRODUCT_NAME = SwiftCSVTests;
SDKROOT = appletvos;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3";
TVOS_DEPLOYMENT_TARGET = 9.2;
};
name = Release;
Expand All @@ -1047,7 +1052,7 @@
PRODUCT_NAME = SwiftCSV;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.2;
};
Expand All @@ -1074,7 +1079,7 @@
PRODUCT_NAME = SwiftCSV;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 2.2;
};
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 = "0940"
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 = "0940"
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 = "0940"
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 = "0940"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion SwiftCSVTests/CSVTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class CSVTests: XCTestCase {
"name": ["Alice", "Bob", "Charlie"],
"age": ["18", "19", "20"]
]
XCTAssertEqual(Array(csv.namedColumns.keys), Array(expected.keys))
XCTAssertEqual(Set(csv.namedColumns.keys), Set(expected.keys))
for (key, value) in csv.namedColumns {
XCTAssertEqual(expected[key] ?? [], value)
}
Expand Down
2 changes: 1 addition & 1 deletion SwiftCSVTests/TSVTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TSVTests: XCTestCase {
"name": ["Alice", "Bob", "Charlie"],
"age": ["18", "19", "20"]
]
XCTAssertEqual(Array(tsv.namedColumns.keys), Array(expected.keys))
XCTAssertEqual(Set(tsv.namedColumns.keys), Set(expected.keys))
for (key, value) in tsv.namedColumns {
XCTAssertEqual(expected[key] ?? [], value)
}
Expand Down

0 comments on commit bbf945f

Please sign in to comment.