summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@gmail.com>2019-03-27 09:58:41 -0400
committerGitHub <noreply@github.com>2019-03-27 09:58:41 -0400
commitc7d53676d0dcbc72d71d921e385c656087b788a5 (patch)
treed785dccc56729a28d602cb613bd69e4388906364
parentf07a24dd3d2b67d2b3525f9c65f6152048454640 (diff)
downloadqtlocation-mapboxgl-c7d53676d0dcbc72d71d921e385c656087b788a5.tar.gz
[ios, core] Updates project for iOS SDK 12.2 / Always use vendored optional (#14241)
-rw-r--r--circle.yml27
-rw-r--r--cmake/loop-darwin.cmake4
-rw-r--r--platform/darwin/src/NSBundle+MGLAdditions.m7
-rw-r--r--platform/darwin/test/MGLAttributionInfoTests.m15
-rw-r--r--platform/darwin/test/MGLOfflineStorageTests.mm9
-rw-r--r--platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m1
-rw-r--r--platform/ios/Integration Tests/MGLCameraTransitionTests.mm2
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj6
-rw-r--r--platform/ios/src/MGLMapView.mm13
-rw-r--r--vendor/optional.cmake10
10 files changed, 70 insertions, 24 deletions
diff --git a/circle.yml b/circle.yml
index b47281cf26..063df5573b 100644
--- a/circle.yml
+++ b/circle.yml
@@ -44,6 +44,8 @@ workflows:
- linux-gcc5-debug-coverage
- linux-doxygen
- ios-debug
+ - ios-debug-xcode-102:
+ name: ios-debug-xcode-10.2
- ios-release-template:
name: ios-release
- ios-release-tag:
@@ -925,6 +927,31 @@ jobs:
- upload-xcode-build-logs
# ------------------------------------------------------------------------------
+ ios-debug-xcode-102:
+ macos:
+ xcode: "10.2.0"
+ environment:
+ BUILDTYPE: Debug
+ HOMEBREW_NO_AUTO_UPDATE: 1
+ steps:
+ - install-macos-dependencies
+ - install-dependencies
+ - build-ios-test
+ - check-public-symbols
+ - run:
+ name: Check symbol namespacing for mapbox-events-ios
+ command: make ios-check-events-symbols
+ - run:
+ name: Lint plist files
+ command: make ios-lint
+ - run:
+ name: Nitpick Darwin code generation
+ command: scripts/nitpick/generated-code.js darwin
+ - save-dependencies
+ - collect-xcode-build-logs
+ - upload-xcode-build-logs
+
+# ------------------------------------------------------------------------------
ios-sanitize-nightly:
macos:
xcode: "10.1.0"
diff --git a/cmake/loop-darwin.cmake b/cmake/loop-darwin.cmake
index a330375653..46d8f9edc0 100644
--- a/cmake/loop-darwin.cmake
+++ b/cmake/loop-darwin.cmake
@@ -7,6 +7,10 @@ target_include_directories(mbgl-loop-darwin
PRIVATE src
)
+target_link_libraries(mbgl-loop-darwin PUBLIC
+ optional
+)
+
create_source_groups(mbgl-loop-darwin)
set_target_properties(mbgl-loop-darwin PROPERTIES FOLDER "Core")
diff --git a/platform/darwin/src/NSBundle+MGLAdditions.m b/platform/darwin/src/NSBundle+MGLAdditions.m
index d472e40b1f..da70a95373 100644
--- a/platform/darwin/src/NSBundle+MGLAdditions.m
+++ b/platform/darwin/src/NSBundle+MGLAdditions.m
@@ -35,10 +35,15 @@ const MGLExceptionName MGLBundleNotFoundException = @"MGLBundleNotFoundException
+ (nullable NSString *)mgl_applicationBundleIdentifier {
NSString *bundleIdentifier = [NSBundle mainBundle].bundleIdentifier;
+
+#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED < 120200)) || \
+ (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && (__MAC_OS_X_VERSION_MAX_ALLOWED < 101404))
+ // Before SDK 12.2 (bundled with Xcode 10.2): There’s no main bundle identifier when running in a unit test bundle.
+ // 12.2 and after: the above bundle identifier is: com.apple.dt.xctest.tool
if (!bundleIdentifier) {
- // There’s no main bundle identifier when running in a unit test bundle.
bundleIdentifier = [NSBundle bundleForClass:[MGLAccountManager class]].bundleIdentifier;
}
+#endif
return bundleIdentifier;
}
diff --git a/platform/darwin/test/MGLAttributionInfoTests.m b/platform/darwin/test/MGLAttributionInfoTests.m
index 48779f3407..b6f053a8af 100644
--- a/platform/darwin/test/MGLAttributionInfoTests.m
+++ b/platform/darwin/test/MGLAttributionInfoTests.m
@@ -55,10 +55,21 @@
XCTAssertEqualObjects(infos[3].URL, [NSURL URLWithString:@"https://apps.mapbox.com/feedback/"]);
XCTAssertTrue(infos[3].feedbackLink);
NSURL *styleURL = [MGLStyle satelliteStreetsStyleURLWithVersion:99];
+
+#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 120200) || \
+ (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101404)
+ NSString *bundleId = @"com.apple.dt.xctest.tool";
+#else
+ NSString *bundleId = @"com.mapbox.Mapbox";
+#endif
+
+ NSString *urlString = [NSString stringWithFormat:@"https://apps.mapbox.com/feedback/?referrer=%@#/77.63680/12.98108/14.00/0.0/0", bundleId];
XCTAssertEqualObjects([infos[3] feedbackURLAtCenterCoordinate:mapbox zoomLevel:14],
- [NSURL URLWithString:@"https://apps.mapbox.com/feedback/?referrer=com.mapbox.Mapbox#/77.63680/12.98108/14.00/0.0/0"]);
+ [NSURL URLWithString:urlString]);
+
+ urlString = [NSString stringWithFormat:@"https://apps.mapbox.com/feedback/?referrer=%@&owner=mapbox&id=satellite-streets-v99&access_token=pk.feedcafedeadbeefbadebede&map_sdk_version=1.0.0#/77.63680/12.98108/3.14/90.9/13", bundleId];
XCTAssertEqualObjects([infos[3] feedbackURLForStyleURL:styleURL atCenterCoordinate:mapbox zoomLevel:3.14159 direction:90.9 pitch:12.5],
- [NSURL URLWithString:@"https://apps.mapbox.com/feedback/?referrer=com.mapbox.Mapbox&owner=mapbox&id=satellite-streets-v99&access_token=pk.feedcafedeadbeefbadebede&map_sdk_version=1.0.0#/77.63680/12.98108/3.14/90.9/13"]);
+ [NSURL URLWithString:urlString]);
}
- (void)testStyle {
diff --git a/platform/darwin/test/MGLOfflineStorageTests.mm b/platform/darwin/test/MGLOfflineStorageTests.mm
index 7f0ead7cab..86dc28eb04 100644
--- a/platform/darwin/test/MGLOfflineStorageTests.mm
+++ b/platform/darwin/test/MGLOfflineStorageTests.mm
@@ -1,6 +1,7 @@
#import <Mapbox/Mapbox.h>
#import "MGLOfflineStorage_Private.h"
+#import "NSBundle+MGLAdditions.h"
#import "NSDate+MGLAdditions.h"
#import <XCTest/XCTest.h>
@@ -10,7 +11,6 @@
#pragma clang diagnostic ignored "-Wshadow"
@interface MGLOfflineStorageTests : XCTestCase <MGLOfflineStorageDelegate>
-
@end
@implementation MGLOfflineStorageTests
@@ -21,8 +21,7 @@
appropriateForURL:nil
create:NO
error:nil];
- // Unit tests don't use the main bundle; use com.mapbox.ios.sdk instead.
- NSString *bundleIdentifier = [NSBundle bundleForClass:[MGLMapView class]].bundleIdentifier;
+ NSString *bundleIdentifier = [NSBundle mgl_applicationBundleIdentifier];
cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:bundleIdentifier];
cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:@".mapbox"];
XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:cacheDirectoryURL.path], @"Cache subdirectory should exist.");
@@ -208,8 +207,8 @@
appropriateForURL:nil
create:NO
error:nil];
- // Unit tests don't use the main bundle; use com.mapbox.ios.sdk instead.
- NSString *bundleIdentifier = [NSBundle bundleForClass:[MGLMapView class]].bundleIdentifier;
+ // As of iOS SDK 12.2 unit tests now have a bundle id: com.apple.dt.xctest.tool
+ NSString *bundleIdentifier = [NSBundle mgl_applicationBundleIdentifier];
cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:bundleIdentifier];
cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:@".mapbox"];
XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:cacheDirectoryURL.path], @"Cache subdirectory should exist.");
diff --git a/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m b/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m
index 7ec45de072..0b32df55b4 100644
--- a/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m
+++ b/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m
@@ -405,7 +405,6 @@ static const CGFloat kAnnotationScale = 0.125f;
NSString * const MGLTestAnnotationReuseIdentifer = @"MGLTestAnnotationReuseIdentifer";
- CGFloat epsilon = 0.0000001;
CGSize size = self.mapView.bounds.size;
CGSize annotationSize = CGSizeMake(40.0, 40.0);
diff --git a/platform/ios/Integration Tests/MGLCameraTransitionTests.mm b/platform/ios/Integration Tests/MGLCameraTransitionTests.mm
index e422c46cf4..60d5fc6c9a 100644
--- a/platform/ios/Integration Tests/MGLCameraTransitionTests.mm
+++ b/platform/ios/Integration Tests/MGLCameraTransitionTests.mm
@@ -277,7 +277,7 @@
// Now set another coordinate.
MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:target2
- fromDistance:altitude
+ altitude:altitude
pitch:0.0
heading:0.0];
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index a514f4a017..5122a60b11 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -3677,7 +3677,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Integration Tests/integration-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Integration Test Harness.app/Integration Test Harness";
};
@@ -3707,7 +3707,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.integration-tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Integration Tests/integration-Bridging-Header.h";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Integration Test Harness.app/Integration Test Harness";
};
@@ -3992,7 +3992,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.integration-tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Integration Tests/integration-Bridging-Header.h";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Integration Test Harness.app/Integration Test Harness";
};
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 50e022013b..eab690b854 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -2512,10 +2512,15 @@ public:
{
MGLLogInfo(@"Resetting the map to the current style’s default viewport.");
auto camera = self.mbglMap.getStyle().getDefaultCamera();
- CGFloat pitch = *camera.pitch;
- CLLocationDirection heading = mbgl::util::wrap(*camera.bearing, 0., 360.);
- CLLocationDistance altitude = MGLAltitudeForZoomLevel(*camera.zoom, pitch, 0, self.frame.size);
- self.camera = [MGLMapCamera cameraLookingAtCenterCoordinate:MGLLocationCoordinate2DFromLatLng(*camera.center)
+
+ double pitch = camera.pitch ? *camera.pitch : 0.0;
+ double bearing = camera.bearing ? *camera.bearing : 0.0;
+ double zoom = camera.zoom ? *camera.zoom : 0.0;
+ mbgl::LatLng center = camera.center ? *camera.center : mbgl::LatLng();
+
+ CLLocationDirection heading = mbgl::util::wrap(bearing, 0., 360.);
+ CLLocationDistance altitude = MGLAltitudeForZoomLevel(zoom, pitch, 0, self.frame.size);
+ self.camera = [MGLMapCamera cameraLookingAtCenterCoordinate:MGLLocationCoordinate2DFromLatLng(center)
altitude:altitude
pitch:pitch
heading:heading];
diff --git a/vendor/optional.cmake b/vendor/optional.cmake
index fa299da6a6..ed7bfe8a38 100644
--- a/vendor/optional.cmake
+++ b/vendor/optional.cmake
@@ -1,9 +1,5 @@
add_library(optional INTERFACE)
-# This polyfill is needed for Windows and Android since these standard libraries don't ship with
-# usable versions of <experimental/optional>
-if(WIN32 OR MBGL_PLATFORM STREQUAL "android")
- target_include_directories(optional SYSTEM INTERFACE
- ${CMAKE_SOURCE_DIR}/vendor/optional/include
- )
-endif()
+target_include_directories(optional SYSTEM INTERFACE
+ ${CMAKE_SOURCE_DIR}/vendor/optional/include
+)