From 65e2320de188d57b368f09e513bc6af29cb01af3 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Fri, 13 Dec 2019 16:04:05 -0800 Subject: [PATCH] Podspec / submodule updates for 5.6.0-beta.1, adapt to gl-native immutable GeoJSON sources (V2) (#103) * Podspec updates for 5.6.0-beta.1 * Bump gl-native submodule to release-tequila * adapt to mapbox/mapbox-gl-native#15989 (#102) * More changelog/install updates * Fix telem dependency docs * More clarifying documentation * Fix typo --- platform/darwin/src/MGLShapeSource.mm | 26 +++++++++---------- platform/darwin/src/MGLShapeSource_Private.h | 3 ++- platform/darwin/test/MGLShapeSourceTests.mm | 16 ++++++------ platform/ios/CHANGELOG.md | 10 +++---- platform/ios/INSTALL.md | 7 +++++ .../Mapbox-iOS-SDK-snapshot-dynamic.podspec | 2 +- platform/ios/Mapbox-iOS-SDK-stripped.podspec | 2 +- platform/ios/Mapbox-iOS-SDK.podspec | 2 +- vendor/mapbox-gl-native | 2 +- 9 files changed, 39 insertions(+), 31 deletions(-) diff --git a/platform/darwin/src/MGLShapeSource.mm b/platform/darwin/src/MGLShapeSource.mm index a4a100aaa2..2590865ac2 100644 --- a/platform/darwin/src/MGLShapeSource.mm +++ b/platform/darwin/src/MGLShapeSource.mm @@ -27,15 +27,15 @@ const MGLShapeSourceOption MGLShapeSourceOptionSimplificationTolerance = @"MGLShapeSourceOptionSimplificationTolerance"; const MGLShapeSourceOption MGLShapeSourceOptionLineDistanceMetrics = @"MGLShapeSourceOptionLineDistanceMetrics"; -mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary *options) { - auto geoJSONOptions = mbgl::style::GeoJSONOptions(); +mbgl::Immutable MGLGeoJSONOptionsFromDictionary(NSDictionary *options) { + auto geoJSONOptions = mbgl::makeMutable(); if (NSNumber *value = options[MGLShapeSourceOptionMinimumZoomLevel]) { if (![value isKindOfClass:[NSNumber class]]) { [NSException raise:NSInvalidArgumentException format:@"MGLShapeSourceOptionMaximumZoomLevel must be an NSNumber."]; } - geoJSONOptions.minzoom = value.integerValue; + geoJSONOptions->minzoom = value.integerValue; } if (NSNumber *value = options[MGLShapeSourceOptionMaximumZoomLevel]) { @@ -43,7 +43,7 @@ [NSException raise:NSInvalidArgumentException format:@"MGLShapeSourceOptionMaximumZoomLevel must be an NSNumber."]; } - geoJSONOptions.maxzoom = value.integerValue; + geoJSONOptions->maxzoom = value.integerValue; } if (NSNumber *value = options[MGLShapeSourceOptionBuffer]) { @@ -51,7 +51,7 @@ [NSException raise:NSInvalidArgumentException format:@"MGLShapeSourceOptionBuffer must be an NSNumber."]; } - geoJSONOptions.buffer = value.integerValue; + geoJSONOptions->buffer = value.integerValue; } if (NSNumber *value = options[MGLShapeSourceOptionSimplificationTolerance]) { @@ -59,7 +59,7 @@ [NSException raise:NSInvalidArgumentException format:@"MGLShapeSourceOptionSimplificationTolerance must be an NSNumber."]; } - geoJSONOptions.tolerance = value.doubleValue; + geoJSONOptions->tolerance = value.doubleValue; } if (NSNumber *value = options[MGLShapeSourceOptionClusterRadius]) { @@ -67,7 +67,7 @@ [NSException raise:NSInvalidArgumentException format:@"MGLShapeSourceOptionClusterRadius must be an NSNumber."]; } - geoJSONOptions.clusterRadius = value.integerValue; + geoJSONOptions->clusterRadius = value.integerValue; } if (NSNumber *value = options[MGLShapeSourceOptionMaximumZoomLevelForClustering]) { @@ -75,7 +75,7 @@ [NSException raise:NSInvalidArgumentException format:@"MGLShapeSourceOptionMaximumZoomLevelForClustering must be an NSNumber."]; } - geoJSONOptions.clusterMaxZoom = value.integerValue; + geoJSONOptions->clusterMaxZoom = value.integerValue; } if (NSNumber *value = options[MGLShapeSourceOptionClustered]) { @@ -83,7 +83,7 @@ [NSException raise:NSInvalidArgumentException format:@"MGLShapeSourceOptionClustered must be an NSNumber."]; } - geoJSONOptions.cluster = value.boolValue; + geoJSONOptions->cluster = value.boolValue; } if (NSDictionary *value = options[MGLShapeSourceOptionClusterProperties]) { @@ -133,7 +133,7 @@ std::string keyString = std::string([key UTF8String]); - geoJSONOptions.clusterProperties.emplace(keyString, std::make_pair(std::move(map), std::move(reduce))); + geoJSONOptions->clusterProperties.emplace(keyString, std::make_pair(std::move(map), std::move(reduce))); } } @@ -142,7 +142,7 @@ [NSException raise:NSInvalidArgumentException format:@"MGLShapeSourceOptionLineDistanceMetrics must be an NSNumber."]; } - geoJSONOptions.lineMetrics = value.boolValue; + geoJSONOptions->lineMetrics = value.boolValue; } return geoJSONOptions; @@ -159,7 +159,7 @@ @implementation MGLShapeSource - (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url options:(NSDictionary *)options { auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options); - auto source = std::make_unique(identifier.UTF8String, geoJSONOptions); + auto source = std::make_unique(identifier.UTF8String, std::move(geoJSONOptions)); if (self = [super initWithPendingSource:std::move(source)]) { self.URL = url; } @@ -168,7 +168,7 @@ - (instancetype)initWithIdentifier:(NSString *)identifier URL:(NSURL *)url optio - (instancetype)initWithIdentifier:(NSString *)identifier shape:(nullable MGLShape *)shape options:(NSDictionary *)options { auto geoJSONOptions = MGLGeoJSONOptionsFromDictionary(options); - auto source = std::make_unique(identifier.UTF8String, geoJSONOptions); + auto source = std::make_unique(identifier.UTF8String, std::move(geoJSONOptions)); if (self = [super initWithPendingSource:std::move(source)]) { if ([shape isMemberOfClass:[MGLShapeCollection class]]) { static dispatch_once_t onceToken; diff --git a/platform/darwin/src/MGLShapeSource_Private.h b/platform/darwin/src/MGLShapeSource_Private.h index c7eaf3d0a8..fd288ef687 100644 --- a/platform/darwin/src/MGLShapeSource_Private.h +++ b/platform/darwin/src/MGLShapeSource_Private.h @@ -1,5 +1,6 @@ #import "MGLFoundation.h" #import "MGLShapeSource.h" +#include NS_ASSUME_NONNULL_BEGIN @@ -10,7 +11,7 @@ namespace mbgl { } MGL_EXPORT -mbgl::style::GeoJSONOptions MGLGeoJSONOptionsFromDictionary(NSDictionary *options); +mbgl::Immutable MGLGeoJSONOptionsFromDictionary(NSDictionary *options); @interface MGLShapeSource (Private) diff --git a/platform/darwin/test/MGLShapeSourceTests.mm b/platform/darwin/test/MGLShapeSourceTests.mm index 3bf3ef04bd..9046607010 100644 --- a/platform/darwin/test/MGLShapeSourceTests.mm +++ b/platform/darwin/test/MGLShapeSourceTests.mm @@ -26,14 +26,14 @@ - (void)testGeoJSONOptionsFromDictionary { MGLShapeSourceOptionLineDistanceMetrics: @YES}; auto mbglOptions = MGLGeoJSONOptionsFromDictionary(options); - XCTAssertTrue(mbglOptions.cluster); - XCTAssertEqual(mbglOptions.clusterRadius, 42); - XCTAssertEqual(mbglOptions.clusterMaxZoom, 98); - XCTAssertEqual(mbglOptions.maxzoom, 99); - XCTAssertEqual(mbglOptions.buffer, 1976); - XCTAssertEqual(mbglOptions.tolerance, 0.42); - XCTAssertTrue(mbglOptions.lineMetrics); - XCTAssertTrue(!mbglOptions.clusterProperties.empty()); + XCTAssertTrue(mbglOptions->cluster); + XCTAssertEqual(mbglOptions->clusterRadius, 42); + XCTAssertEqual(mbglOptions->clusterMaxZoom, 98); + XCTAssertEqual(mbglOptions->maxzoom, 99); + XCTAssertEqual(mbglOptions->buffer, 1976); + XCTAssertEqual(mbglOptions->tolerance, 0.42); + XCTAssertTrue(mbglOptions->lineMetrics); + XCTAssertTrue(!mbglOptions->clusterProperties.empty()); options = @{MGLShapeSourceOptionClustered: @"number 1"}; XCTAssertThrows(MGLGeoJSONOptionsFromDictionary(options)); diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 0bb9eba8cc..a838c5ebf9 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -4,13 +4,13 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT ## 5.6.0 -* No public-facing changes in v5.6.0-alpha.2. +* No public-facing changes in v5.6.0-beta.1. ### Packaging -* Integrates [`MapboxMobileEvents`](https://github.com/mapbox/mapbox-events-ios) as a dependency. ([#60](https://github.com/mapbox/mapbox-gl-native-ios/pull/60)) - - CocoaPods: no change. - - Carthage: as an interim measure, please specify `github "mapbox/mapbox-events-ios" == 0.10.1-alpha` in your Cartfile. - - Manual installation: New Github release artifact (`mapbox-ios-sdk-5.6.0-alpha.1-dynamic-with-events.zip`) contains the `MapboxMobileEvents.framework`; please install this along with `Mapbox.framework` +* Integrates [`MapboxMobileEvents`](https://github.com/mapbox/mapbox-events-ios) as a dependency ([#60](https://github.com/mapbox/mapbox-gl-native-ios/pull/60)). As a result, the following installation processes have changed: + - CocoaPods: You now must include `use frameworks!` in your Podfile. + - Carthage: Specify `github "mapbox/mapbox-events-ios" == 0.10.2` in your Cartfile. Additionally, please note that if you are using `--no-use-binaries`, the `MapboxMobileEvents.framework` will still be installed as a dynamic framework. + - Manual installation: New Github release artifact (`mapbox-ios-sdk-5.6.0-beta.1-dynamic-with-events.zip`) contains the `MapboxMobileEvents.framework`; please install this along with `Mapbox.framework` ### Networking and storage * Make network requests for expired resources lower priority than requests for new resources. ([#15950](https://github.com/mapbox/mapbox-gl-native/pull/15950)) diff --git a/platform/ios/INSTALL.md b/platform/ios/INSTALL.md index 9feea010bc..96fda7bd81 100644 --- a/platform/ios/INSTALL.md +++ b/platform/ios/INSTALL.md @@ -106,6 +106,8 @@ You can alternatively install the SDK as a static framework: For instructions on installing stable release versions of the Mapbox Maps SDK for iOS with CocoaPods, see [our website](https://www.mapbox.com/install/ios/cocoapods/). +As of v5.6.0, you must specify `use_frameworks!` in your Podfile. + ##### Testing pre-releases with CocoaPods To test pre-releases of the dynamic framework, directly specify the version in your `Podfile`: @@ -162,14 +164,19 @@ Note that these builds lack some debugging information, which could make develop For instructions on installing stable release versions of the Mapbox Maps SDK for iOS with Carthage, see [our website](https://www.mapbox.com/install/ios/carthage/). +Please note that as of ios-v5.6.0-alpha.2, `--no-use-binaries` has no affect on projects built with the Mapbox framework. + ##### Testing pre-releases with Carthage To test pre-releases of the dynamic framework, directly specify the version in your Cartfile: ```json binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" ~> x.x.x-alpha.1 +github "mapbox/mapbox-events-ios" == x.x.x ``` +Where `x.x.x` is the latest version of the [Mapbox Mobile Events](https://github.com/mapbox/mapbox-events-ios) library. + ##### Testing snapshot releases with Carthage This project does not currently support using snapshot releases via Carthage. diff --git a/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec b/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec index 0a95083f8d..0d217da0c4 100644 --- a/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec +++ b/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '5.6.0-alpha.2' + version = '5.6.0-beta.1' m.name = 'Mapbox-iOS-SDK-snapshot-dynamic' m.version = "#{version}-snapshot" diff --git a/platform/ios/Mapbox-iOS-SDK-stripped.podspec b/platform/ios/Mapbox-iOS-SDK-stripped.podspec index 5b39826b43..00d18fbce8 100644 --- a/platform/ios/Mapbox-iOS-SDK-stripped.podspec +++ b/platform/ios/Mapbox-iOS-SDK-stripped.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '5.6.0-alpha.2' + version = '5.6.0-beta.1' m.name = 'Mapbox-iOS-SDK-stripped' m.version = "#{version}-stripped" diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec index ec79c620d6..0365e3b96e 100644 --- a/platform/ios/Mapbox-iOS-SDK.podspec +++ b/platform/ios/Mapbox-iOS-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '5.6.0-alpha.2' + version = '5.6.0-beta.1' m.name = 'Mapbox-iOS-SDK' m.version = version diff --git a/vendor/mapbox-gl-native b/vendor/mapbox-gl-native index 3600dd8a1a..1ac3e9e9c2 160000 --- a/vendor/mapbox-gl-native +++ b/vendor/mapbox-gl-native @@ -1 +1 @@ -Subproject commit 3600dd8a1a4d91290d752d699ed964eab03bb1a5 +Subproject commit 1ac3e9e9c2a8bfc731e3bba978a28562c3f083e5