summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@gmail.com>2019-04-02 17:52:29 -0400
committerGitHub <noreply@github.com>2019-04-02 17:52:29 -0400
commitec3f115d19d7b2775c69121bd8f040d90fd19083 (patch)
treec7e1e40da07b472bf6c0ff267f577f573507c0b3
parentffc7948fabff4a9e4aa1c0b6afe59467f66bd234 (diff)
downloadqtlocation-mapboxgl-ec3f115d19d7b2775c69121bd8f040d90fd19083.tar.gz
CP [ios,macos, core] Release Liquid cherry picks (#14274)
* [core] don't access empty texture pos optionals when buckets are out of sync * [ios, core] Updates project for iOS SDK 12.2 / Always use vendored optional (#14241) * [ios, macos] Added missing changelog entries for #14241 (#14250) * [ios] Tweak change log for clarity * [core] Adds target branch parameter to clang-tools.sh (#14301)
-rw-r--r--Makefile11
-rw-r--r--circle.yml29
-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/CHANGELOG.md1
-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--platform/macos/CHANGELOG.md1
-rwxr-xr-xscripts/clang-tools.sh6
-rw-r--r--src/mbgl/renderer/layers/render_line_layer.cpp4
-rw-r--r--src/mbgl/renderer/paint_property_binder.hpp2
-rw-r--r--vendor/optional.cmake10
16 files changed, 85 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index afbcd70d0f..0f40e90cd7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,8 @@
export BUILDTYPE ?= Debug
export IS_LOCAL_DEVELOPMENT ?= true
export WITH_CXX11ABI ?= $(shell scripts/check-cxx11abi.sh)
+export TARGET_BRANCH ?= master
+
ifeq ($(BUILDTYPE), Release)
else ifeq ($(BUILDTYPE), RelWithDebInfo)
@@ -191,12 +193,11 @@ compdb: $(BUILD_DEPS) $(TEST_DEPS) $(MACOS_COMPDB_PATH)/Makefile
.PHONY: tidy
tidy: compdb
- scripts/clang-tools.sh $(MACOS_COMPDB_PATH)
+ scripts/clang-tools.sh $(MACOS_COMPDB_PATH) $(TARGET_BRANCH)
.PHONY: check
check: compdb
- scripts/clang-tools.sh $(MACOS_COMPDB_PATH) --diff
-
+ scripts/clang-tools.sh $(MACOS_COMPDB_PATH) $(TARGET_BRANCH) --diff
endif
#### iOS targets ##############################################################
@@ -383,11 +384,11 @@ compdb: $(LINUX_BUILD)
.PHONY: tidy
tidy: compdb
- scripts/clang-tools.sh $(LINUX_OUTPUT_PATH)
+ scripts/clang-tools.sh $(LINUX_OUTPUT_PATH) $(TARGET_BRANCH)
.PHONY: check
check: compdb
- scripts/clang-tools.sh $(LINUX_OUTPUT_PATH) --diff
+ scripts/clang-tools.sh $(LINUX_OUTPUT_PATH) $(TARGET_BRANCH) --diff
endif
diff --git a/circle.yml b/circle.yml
index b47281cf26..1eda60b54b 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:
@@ -500,7 +502,7 @@ jobs:
command: make compdb
- run:
name: Run Clang checks
- command: make check
+ command: make check TARGET_BRANCH=${CIRCLE_TARGET_BRANCH:master}
no_output_timeout: 20m
- save-dependencies: { ccache: false }
@@ -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/CHANGELOG.md b/platform/ios/CHANGELOG.md
index eb6bc78d06..f1cc77064f 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -15,6 +15,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
### Packaging
* Added a Galician localization. ([#14095](https://github.com/mapbox/mapbox-gl-native/pull/14095))
+* Added support for building from source with Xcode 10.2 / iOS SDK 12.2. ([#14241](https://github.com/mapbox/mapbox-gl-native/pull/14241))
### Offline maps
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 535f83728f..2e09e9063f 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";
};
@@ -3991,7 +3991,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 bf2421521f..51db11ab8c 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -2508,10 +2508,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/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index 36668dfe22..65c18ea611 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -24,6 +24,7 @@
### Packaging
* Added Czech and Galician localizations. ([#13782](https://github.com/mapbox/mapbox-gl-native/pull/13782), [#14095](https://github.com/mapbox/mapbox-gl-native/pull/14095))
+* Added support for building with Xcode 10.2 / iOS SDK 12.2. ([#14241](https://github.com/mapbox/mapbox-gl-native/pull/14241))
## 0.13.0 - December 20, 2018
diff --git a/scripts/clang-tools.sh b/scripts/clang-tools.sh
index bdda4544b9..1e73951176 100755
--- a/scripts/clang-tools.sh
+++ b/scripts/clang-tools.sh
@@ -33,7 +33,7 @@ function run_clang_tidy() {
}
function run_clang_tidy_diff() {
- OUTPUT=$(git diff origin/master --src-prefix=${CDUP} --dst-prefix=${CDUP} | \
+ OUTPUT=$(git diff origin/$2 --src-prefix=${CDUP} --dst-prefix=${CDUP} | \
${CLANG_TIDY_PREFIX}/share/clang-tidy-diff.py \
-clang-tidy-binary ${CLANG_TIDY} \
2>/dev/null)
@@ -45,7 +45,7 @@ function run_clang_tidy_diff() {
function run_clang_format() {
echo "Running clang-format on $0..."
- DIFF_FILES=$(git diff origin/master --name-only *cpp)
+ DIFF_FILES=$(git diff origin/$2 --name-only *cpp)
echo "${DIFF_FILES}" | xargs -I{} -P ${JOBS} bash -c 'run_clang_format' {}
${CLANG_FORMAT} -i ${CDUP}/$0 || exit 1
}
@@ -54,7 +54,7 @@ export -f run_clang_tidy run_clang_tidy_diff run_clang_format
echo "Running Clang checks... (this might take a while)"
-if [[ -n $2 ]] && [[ $2 == "--diff" ]]; then
+if [[ -n $3 ]] && [[ $3 == "--diff" ]]; then
run_clang_tidy_diff $@
# XXX disabled until we run clang-format over the entire codebase.
#run_clang_format $@
diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp
index eee151ccaa..8016ed2343 100644
--- a/src/mbgl/renderer/layers/render_line_layer.cpp
+++ b/src/mbgl/renderer/layers/render_line_layer.cpp
@@ -145,8 +145,8 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) {
texsize,
crossfade,
parameters.pixelRatio),
- *posA,
- *posB,
+ posA,
+ posB,
LinePatternProgram::TextureBindings{
textures::u_image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear },
});
diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp
index a014b36ece..814d1b3eb4 100644
--- a/src/mbgl/renderer/paint_property_binder.hpp
+++ b/src/mbgl/renderer/paint_property_binder.hpp
@@ -147,7 +147,7 @@ public:
void upload(gfx::Context&) override {}
void setPatternParameters(const optional<ImagePosition>& posA, const optional<ImagePosition>& posB, CrossfadeParameters&) override {
- if (!posA && !posB) {
+ if (!posA || !posB) {
return;
} else {
constantPatternPositions = std::tuple<std::array<uint16_t, 4>, std::array<uint16_t, 4>> { posB->tlbr(), posA->tlbr() };
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
+)