Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for Xcode 9 -> 10.2 #363

Merged
merged 7 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
version: 2.1

step-library:
- &restore-cache
restore_cache:
keys:
- carthage-cache-mbdirections-v3-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cartfile.resolved" }}
- carthage-cache-mbdirections-v3-{{ .Environment.CIRCLE_JOB }} # used if checksum fails

- &save-cache
save_cache:
key: carthage-cache-mbdirections-v3-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cartfile.resolved" }}
paths:
- Carthage

- &prepare
run:
name: Prepare
command: |
if [ $(carthage outdated | grep -cF "latest Carthage version") -eq 0 ]; then brew update && brew upgrade carthage || true; fi
echo "foo" > ~/.mapbox

- &publish-codecov
run:
name: Publish code coverage
command: bash <(curl -s https://codecov.io/bash)

jobs:
build-job:
parameters:
xcode:
type: string
device:
type: string
default: "iPhone 6 Plus"
iOS:
type: string
default: "12.1"
watchOS:
type: string
default: "5.0"
tvOS:
type: string
default: "12.0"
test:
type: boolean
default: true
codecoverage:
type: boolean
default: false
macos:
xcode: << parameters.xcode >>
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- checkout
- *prepare
- *restore-cache
- run:
name: Install prerequisites
command: |
if [ $(xcversion simulators | grep -cF "iOS << parameters.iOS >> Simulator (installed)") -eq 0 ]; then xcversion simulators --install="iOS << parameters.iOS >>" || true; fi
- run:
name: Dependencies
command: |
carthage bootstrap --platform ios --cache-builds --configuration Debug --no-use-binaries
carthage bootstrap --platform tvos --cache-builds --configuration Debug --no-use-binaries
carthage bootstrap --platform macos --cache-builds --configuration Debug --no-use-binaries
carthage bootstrap --platform watchos --cache-builds --configuration Debug --no-use-binaries
- *save-cache
- run:
name: iOS
command: xcodebuild -sdk iphonesimulator -project MapboxDirections.xcodeproj -scheme 'MapboxDirections iOS' -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=<< parameters.device >>' clean build <<# parameters.test >>test<</ parameters.test >><<# parameters.codecoverage >> -enableCodeCoverage "YES"<</ parameters.codecoverage >>
- when:
condition: << parameters.codecoverage >>
steps:
- *publish-codecov
- run:
name: tvOS
command: xcodebuild -project MapboxDirections.xcodeproj -scheme 'MapboxDirections tvOS' -destination 'platform=tvOS Simulator,name=Apple TV 4K (at 1080p),OS=<< parameters.tvOS >>' clean build <<# parameters.test >>test <</ parameters.test >> <<# parameters.codecoverage >>-enableCodeCoverage YES<</ parameters.codecoverage >>
- when:
condition: << parameters.codecoverage >>
steps:
- *publish-codecov
- run:
name: macOS
command: xcodebuild -project MapboxDirections.xcodeproj -scheme 'MapboxDirections Mac' clean build<<# parameters.test >> test <</ parameters.test >><<# parameters.codecoverage >>-enableCodeCoverage YES<</ parameters.codecoverage >>
- run:
name: watchOS
command: xcodebuild -project MapboxDirections.xcodeproj -scheme 'MapboxDirections watchOS' -destination 'platform=watchOS Simulator,name=Apple Watch Series 3 - 42mm,OS=<< parameters.watchOS >>' clean build

workflows:
workflow:
jobs:
- build-job:
name: "Xcode_10.2"
xcode: "10.2.0"
iOS: "12.2"
tvOS: "12.2"
watchOS: "5.2"
- build-job:
name: "Xcode_10.0"
xcode: "10.0.0"
iOS: "12.0"
tvOS: "12.0"
codecoverage: true
- build-job:
name: "Xcode_9.4"
xcode: "9.4.1"
iOS: "9.3"
tvOS: "11.4"
watchOS: "4.3"
test: false
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes to MapboxDirections.swift

## master

* Fixed compatibility issues with Xcode 10.2 when the SDK is installed using Carthage. ([#363](https://github.com/mapbox/MapboxDirections.swift/pull/363))

## v0.27.2

* Fixed an issue where `Waypoint.separatesLegs` caused the resulting `RouteLeg.source` and `RouteLeg.destination` to have mismatched coordinates and names. ([#358](https://github.com/mapbox/MapboxDirections.swift/pull/358))
Expand Down
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" ~> 4.4
github "AliSoftware/OHHTTPStubs" ~> 6.0
github "linksmt/OHHTTPStubs" "563f48d3fab84ef04639649c770b00f4fa502cca"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a PR for this change or something else we can keep track of for when master gets updated? AliSoftware/OHHTTPStubs#295 is already in v7.0.0; is this for something else?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, looks like this commit also pulls in AliSoftware/OHHTTPStubs#286. The CircleCI configuration isn’t testing on watchOS anyways. So I think we can pin to the main pod’s v7.x.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, the reason why I switched to the fork here is the missing watchOS scheme in the original. We don't test on watchOS but we do compile for watchOS. We could switch back but it would require a workaround to run carthage bootstrap and ignore the .private and .resolved files.

4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "4.8.0"
github "AliSoftware/OHHTTPStubs" "6.1.0"
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "4.9.0"
github "linksmt/OHHTTPStubs" "563f48d3fab84ef04639649c770b00f4fa502cca"
github "raphaelmor/Polyline" "v4.2.0"
24 changes: 4 additions & 20 deletions MapboxDirections.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 1010;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = Mapbox;
TargetAttributes = {
DA1A10AE1D00F8FF009F82FA = {
Expand All @@ -1035,11 +1035,11 @@
};
DA6C9D871CAE442B00094FBC = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0910;
LastSwiftMigration = 1020;
};
DA6C9D901CAE442B00094FBC = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0910;
LastSwiftMigration = 1020;
};
DADD27B41E5AAAD800D31FAD = {
CreatedOnToolsVersion = 8.2.1;
Expand All @@ -1053,7 +1053,7 @@
};
buildConfigurationList = DD6254491AE70C1700017857 /* Build configuration list for PBXProject "MapboxDirections" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -1515,7 +1515,6 @@
PRODUCT_NAME = MapboxDirections;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -1544,7 +1543,6 @@
PRODUCT_NAME = MapboxDirections;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -1566,7 +1564,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxDirectionsTests;
PRODUCT_NAME = MapboxDirectionsTests;
SDKROOT = macosx;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -1585,7 +1582,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxDirectionsTests;
PRODUCT_NAME = MapboxDirectionsTests;
SDKROOT = macosx;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand All @@ -1612,7 +1608,6 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -1642,7 +1637,6 @@
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -1665,7 +1659,6 @@
PRODUCT_NAME = MapboxDirectionsTests;
SDKROOT = appletvos;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
Expand All @@ -1684,7 +1677,6 @@
PRODUCT_NAME = MapboxDirectionsTests;
SDKROOT = appletvos;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Release;
Expand Down Expand Up @@ -1713,7 +1705,6 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 4;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1744,7 +1735,6 @@
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 4;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -1775,7 +1765,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -1803,7 +1792,6 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -1823,8 +1811,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(PROJECT_DIR)/Carthage/Build/iOS @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxDirectionsTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -1841,8 +1827,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) $(PROJECT_DIR)/Carthage/Build/iOS @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxDirectionsTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
};
name = Release;
};
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 = "1010"
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 = "1010"
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 = "1010"
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 = "1010"
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 = "1010"
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 = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion MapboxDirections/Match/MBMatchOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ open class MatchOptions: DirectionsOptions {

If specified, each index must correspond to a valid index in `coordinates`, and the index set must contain 0 and the last index (one less than `endIndex`) of `coordinates`.
*/
@available(*, deprecated: 0.1, message: "Use Waypoint.separatesLegs instead.")
@available(*, deprecated, message: "Use Waypoint.separatesLegs instead.")
@objc open var waypointIndices: IndexSet?

override var legSeparators: [Waypoint] {
Expand Down
2 changes: 1 addition & 1 deletion MapboxDirectionsTests/V5Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class V5Tests: XCTestCase {
}
XCTAssertNotNil(task)

waitForExpectations(timeout: 2) { (error) in
waitForExpectations(timeout: 5) { (error) in
Copy link
Contributor Author

@frederoni frederoni Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even locally, 2 seconds did timeout 1/16 times for the 3.2 MB GeoJSON

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes, somehow I didn’t realize our test fixtures were that big. This isn’t a performance test, so we should probably think about breaking this test case up into minimal test cases the next time we need to fix it.

XCTAssertNil(error, "Error: \(error!)")
XCTAssertEqual(task.state, .completed)
}
Expand Down
Loading