summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2019-12-16 18:23:28 +0200
committerzmiao <miao.zhao@mapbox.com>2020-01-21 16:55:02 +0200
commitb392b2b7e34476d4d766c84e2b54d61e9855fef5 (patch)
tree8be623f25d6afdf4f8a87190453e3e8c541f8b60
parent92e8530361cbcd1713a5f61fc892d7bd4301daae (diff)
downloadqtlocation-mapboxgl-b392b2b7e34476d4d766c84e2b54d61e9855fef5.tar.gz
[test-runner] Make app runable on device
try to build with fastlane run with command line add gemfile build apps without codesigning seperate build steps add sign identification Try to manually sign Enable gcloud Adapt to new render-test way update xctestrun file try to add attachment update test result with xctest, try to extract test result from firebase
-rw-r--r--circle.yml75
-rw-r--r--metrics/next-ios-render-test-runner-style.json11
-rw-r--r--next/platform/ios/ios.cmake109
-rw-r--r--platform/darwin/src/http_file_source.mm139
-rw-r--r--platform/darwin/src/native_apple_interface.m1
-rw-r--r--platform/ios/CHANGELOG.md2
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj10
-rw-r--r--platform/ios/sdk-files.json2
-rw-r--r--platform/ios/src/MGLNativeInterfaceReceiver.h8
-rw-r--r--platform/ios/src/MGLNativeInterfaceReceiver.m50
-rw-r--r--platform/macos/macos.xcodeproj/project.pbxproj6
-rw-r--r--platform/macos/sdk-files.json2
-rw-r--r--platform/macos/src/MGLNativeInterfaceReceiver.h8
-rw-r--r--platform/macos/src/MGLNativeInterfaceReceiver.m40
-rw-r--r--render-test/ios-manifest.json7
-rw-r--r--render-test/ios/Gemfile3
-rw-r--r--render-test/ios/Gemfile.lock159
-rw-r--r--render-test/ios/Info.plist20
-rw-r--r--render-test/ios/Prefix.pch7
-rw-r--r--render-test/ios/RenderTestApp_iphoneos13.2-arm64e.xctestrun68
-rw-r--r--render-test/ios/ViewController.h3
-rw-r--r--render-test/ios/ViewController.m2
-rw-r--r--render-test/ios/codesigning/RenderTestApp.app.xcent.template16
-rw-r--r--render-test/ios/codesigning/RenderTestAppTests.xctest.xcent.template16
-rw-r--r--render-test/ios/codesigning/XCTAutomationSupport.framework.xcent.template16
-rw-r--r--render-test/ios/codesigning/XCTest.framework.xcent.template16
-rwxr-xr-xrender-test/ios/codesigning/codesign_all.sh8
-rwxr-xr-xrender-test/ios/codesigning/generate-entitlements.swift40
-rw-r--r--render-test/ios/codesigning/libXCTestSwiftSupport.dylib.xcent.template16
-rw-r--r--render-test/ios/fastlane/Appfile3
-rw-r--r--render-test/ios/fastlane/Matchfile5
-rw-r--r--render-test/ios/fastlane/README.md44
-rw-r--r--render-test/ios/iosTestRunner.h2
-rw-r--r--render-test/ios/iosTestRunner.mm88
-rw-r--r--render-test/ios/ios_test_runner.cpp10
-rw-r--r--render-test/ios/ios_test_runner.hpp7
-rw-r--r--render-test/ios/main.m4
-rwxr-xr-xrender-test/ios/setup_test_data.sh14
-rw-r--r--render-test/ios/tests/Info.plist22
-rw-r--r--render-test/ios/tests/Tests.m50
-rw-r--r--render-test/runner.cpp2
41 files changed, 750 insertions, 361 deletions
diff --git a/circle.yml b/circle.yml
index 7aa497708c..15446e2b1b 100644
--- a/circle.yml
+++ b/circle.yml
@@ -9,6 +9,7 @@ workflows:
- next-android-api-breakage
- next-android-render-test-runner
- next-android-unit-test-runner
+ - next-ios-render-test-runner
- next-baselines:
requires:
- next-android-arm64-v8a-release
@@ -246,6 +247,8 @@ commands:
name: Prepare macOS
command: |
brew install cmake ccache glfw ninja pkgconfig qt
+ brew cask install google-cloud-sdk
+ brew install chargepoint/xcparse/xcparse
- run:
name: Code Generators macOS
command: |
@@ -671,6 +674,78 @@ commands:
fi
jobs:
+ next-ios-render-test-runner:
+ executor: macos-11_0_0
+ steps:
+ - checkout
+ - next-prepare
+ - next-prepare-macos
+ - run:
+ name: Prepare codesign keychain
+ command: |
+ cd render-test/ios
+ fastlane run setup_circle_ci
+ fastlane run create_keychain name:fastlane_keychain password:$FASTLANE_PASSWORD timeout:false unlock:true
+ fastlane match
+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $FASTLANE_PASSWORD fastlane_keychain
+ /usr/bin/env xcrun security find-identity -v -p codesigning
+ - run:
+ name: Build IOS RenderTestApp
+ command: |
+ cd render-test/ios && ./setup_test_data.sh
+ cmake ../../next -B Build -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos
+ cd Build
+ xcodebuild -sdk iphoneos -project Mapbox\ GL\ Native.xcodeproj -scheme RenderTestApp build-for-testing -arch arm64 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
+ xcodebuild -sdk iphoneos -project Mapbox\ GL\ Native.xcodeproj build -target RenderTestAppTests -arch arm64 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
+ - run:
+ name: Codesign Apps for running on a physical device
+ command: |
+ cd render-test/ios
+ ./codesigning/generate-entitlements.swift
+ ls codesigning
+ cd Build
+ ../codesigning/codesign_all.sh
+ codesign -dv --verbose=4 Debug-iphoneos/RenderTestApp.app # for debugging
+ - run:
+ name: Log in to IOS Google Cloud Platform
+ command: |
+ if [[ -n "${GCLOUD_SERVICE_ACCOUNT_JSON_IOS}" ]]; then
+ echo "${GCLOUD_SERVICE_ACCOUNT_JSON_IOS}" > iosAccount.json
+ gcloud auth activate-service-account --key-file iosAccount.json --project ios-mapbox-gl-native
+ rm iosAccount.json
+ fi
+ - run:
+ name: Run tests on Firebase
+ no_output_timeout: 20m
+ command: |
+ if [[ -n "${GCLOUD_SERVICE_ACCOUNT_JSON_IOS}" ]]; then
+ # arrange files in a way Firebase expects it, and package them in a zip file
+ cd render-test/ios/Build
+ cp ../RenderTestApp_iphoneos13.2-arm64e.xctestrun .
+ # Prepare a zip file for Firebase we are standing in the build directory
+ zip ../testapp.zip -r Debug-iphoneos/RenderTestApp.app
+ zip ../testapp.zip RenderTestApp_iphoneos13.2-arm64e.xctestrun
+ cd ..
+ gcloud firebase test ios run \
+ --test testapp.zip \
+ --device model=iphonexs,version=12.1,locale=en,orientation=portrait --xcode-version=11.1 --timeout 20m \
+ --verbosity=debug --no-record-video --results-dir ios-render-test-app-${CIRCLE_BUILD_NUM}
+ fi
+ - run:
+ name: Retrieve TestResult from gcloud
+ when: always
+ command: |
+ if [[ -n "${GCLOUD_SERVICE_ACCOUNT_JSON_IOS}" ]]; then
+ testResult=$(gsutil ls -d gs://test-lab-hn7kwqcz3108z-hjm4qtbqqkymk/ios-render-test-app-${CIRCLE_BUILD_NUM}/iphonexs-12.1-en-portrait/TestLogs/)
+ mkdir -p render-test-app
+ gsutil -m cp -r $testResult render-test-app
+ cd render-test-app/TestLogs && ls
+ xcparse attachments *.xcresult
+ cd ../.. && mkdir -p /tmp/tests/ios-render-test
+ cp render-test-app/TestLogs/*.html /tmp/tests/ios-render-test
+ ls /tmp/tests/ios-render-test
+ fi
+ - next-save
next-android-benchmark-runner:
executor: ubuntu-disco
steps:
diff --git a/metrics/next-ios-render-test-runner-style.json b/metrics/next-ios-render-test-runner-style.json
new file mode 100644
index 0000000000..fbee81962c
--- /dev/null
+++ b/metrics/next-ios-render-test-runner-style.json
@@ -0,0 +1,11 @@
+{
+ "base_test_path": "integration",
+ "cache_path": "cache-style.db",
+ "expectation_paths": [
+ "expectations/platform-all"
+ ],
+ "ignore_paths": [
+ "ignores/platform-all.json",
+ "ignores/platform-macos.json"
+ ]
+} \ No newline at end of file
diff --git a/next/platform/ios/ios.cmake b/next/platform/ios/ios.cmake
index c1162eac18..71eea71303 100644
--- a/next/platform/ios/ios.cmake
+++ b/next/platform/ios/ios.cmake
@@ -7,10 +7,12 @@ if(NOT DEFINED IOS_DEPLOYMENT_TARGET)
set(IOS_DEPLOYMENT_TARGET "9.0")
endif()
+set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
+
macro(initialize_ios_target target)
set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IOS_DEPLOYMENT_TARGET}")
- set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE "YES")
- set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE bitcode)
+ # set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE "YES") set_target_properties(${target} PROPERTIES
+ # XCODE_ATTRIBUTE_BITCODE_GENERATION_MODE bitcode)
set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH $<$<CONFIG:Debug>:YES>)
endmacro()
@@ -93,62 +95,13 @@ target_link_libraries(
z
)
-# add_custom_command(
-# TARGET RenderTestAPP PRE_BUILD
-# COMMAND
-# ${CMAKE_COMMAND} -E
-# copy_directory
-# ${MBGL_ROOT}/mapbox-gl-js/test/integration/
-# ${MBGL_ROOT}/test-data/mapbox-gl-js/test/integration/
-# COMMAND
-# ${CMAKE_COMMAND}
-# -E
-# copy_directory
-# ${MBGL_ROOT}/vendor/mapbox-gl-styles
-# ${MBGL_ROOT}/test-data/vendor/mapbox-gl-styles
-# COMMAND
-# ${CMAKE_COMMAND}
-# -E
-# copy_directory
-# ${MBGL_ROOT}/render-test/ignores
-# ${MBGL_ROOT}/test-data/render-test/ignores
-# COMMAND
-# ${CMAKE_COMMAND}
-# -E
-# copy_directory
-# ${MBGL_ROOT}/render-test/expected
-# ${MBGL_ROOT}/test-data/render-test/expected
-# COMMAND
-# ${CMAKE_COMMAND}
-# -E
-# copy
-# ${MBGL_ROOT}/platform/node/test/ignores.json
-# ${MBGL_ROOT}test-data/platform/node/test/ignores.json
-# COMMAND
-# ${CMAKE_COMMAND}
-# -E
-# copy
-# ${MBGL_ROOT}/render-test/mac-manifest.json
-# ${MBGL_ROOT}/test-data/render-test/mac-manifest.json
-# WORKING_DIRECTORY ${MBGL_ROOT}
-# )
-
-set(
- RESOURCES
- ${MBGL_ROOT}/render-test/ios/Main.storyboard
- ${MBGL_ROOT}/render-test/ios/LaunchScreen.storyboard
- # ${MBGL_ROOT}/test-data
- ${MBGL_ROOT}/mapbox-gl-js/test/integration
- ${MBGL_ROOT}/vendor/mapbox-gl-styles
- ${MBGL_ROOT}/render-test/ignores
- ${MBGL_ROOT}/render-test/expected
- ${MBGL_ROOT}/platform/node/test/ignores.json
- ${MBGL_ROOT}/render-test/mac-ignores.json
- ${MBGL_ROOT}/render-test/ios-manifest.json
-)
+enable_testing()
+set(RESOURCES ${MBGL_ROOT}/render-test/ios/Main.storyboard ${MBGL_ROOT}/render-test/ios/LaunchScreen.storyboard ${MBGL_ROOT}/test-data)
+
+set(PUBLIC_HEADER ${MBGL_ROOT}/render-test/ios/iosTestRunner.h)
add_executable(
- RenderTestAPP
+ RenderTestApp
${MBGL_ROOT}/render-test/ios/ios_test_runner.hpp
${MBGL_ROOT}/render-test/ios/ios_test_runner.cpp
${MBGL_ROOT}/render-test/ios/AppDelegate.h
@@ -157,27 +110,17 @@ add_executable(
${MBGL_ROOT}/render-test/ios/ViewController.m
${MBGL_ROOT}/render-test/ios/iosTestRunner.h
${MBGL_ROOT}/render-test/ios/iosTestRunner.mm
- ${MBGL_ROOT}/render-test/ios/Prefix.pch
${MBGL_ROOT}/render-test/ios/main.m
${RESOURCES}
)
-initialize_ios_target(RenderTestAPP)
-
-set(DEPLOYMENT_TARGET 8.0)
+initialize_ios_target(RenderTestApp)
-set(MACOSX_BUNDLE_INFO_STRING "com.mapbox.RenderTestAPP")
-set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.mapbox.RenderTestAPP")
-set(MACOSX_BUNDLE_BUNDLE_NAME "com.mapbox.RenderTestAPP")
-set(MACOSX_BUNDLE_ICON_FILE "")
-set(MACOSX_BUNDLE_LONG_VERSION_STRING "1.0")
-set(MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0")
-set(MACOSX_BUNDLE_BUNDLE_VERSION "1.0")
-set(MACOSX_BUNDLE_COPYRIGHT "Copyright YOU")
-set(MACOSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET})
+# Turn on ARC
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fobjc-arc")
set_target_properties(
- RenderTestAPP
+ RenderTestApp
PROPERTIES
MACOSX_BUNDLE
TRUE
@@ -190,12 +133,12 @@ set_target_properties(
)
target_include_directories(
- RenderTestAPP
+ RenderTestApp
PUBLIC {MBGL_ROOT}/render-test/include ${MBGL_ROOT}/include
)
target_include_directories(
- RenderTestAPP
+ RenderTestApp
PRIVATE
${MBGL_ROOT}/platform/darwin/src
${MBGL_ROOT}/platform/darwin/include
@@ -204,8 +147,13 @@ target_include_directories(
${MBGL_ROOT}/src
)
+target_include_directories(
+ RenderTestApp
+ PUBLIC ${MBGL_ROOT}/render-test/ios
+)
+
target_link_libraries(
- RenderTestAPP
+ RenderTestApp
PRIVATE
"-framework CoreGraphics"
"-framework CoreLocation"
@@ -216,4 +164,19 @@ target_link_libraries(
mbgl-render-test
)
+find_package(XCTest REQUIRED)
+
+xctest_add_bundle(RenderTestAppTests RenderTestApp ${MBGL_ROOT}/render-test/ios/tests/Tests.m)
+
+initialize_ios_target(RenderTestAppTests)
+
+target_include_directories(
+ RenderTestAppTests
+ PUBLIC ${MBGL_ROOT}/render-test/ios
+)
+
+xctest_add_test(XCTest.RenderTestApp RenderTestAppTests)
+
+set_target_properties(RenderTestAppTests PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${MBGL_ROOT}/render-test/ios/tests/Info.plist)
+
unset(IOS_DEPLOYMENT_TARGET CACHE)
diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm
index 0abae701d7..a72a97e299 100644
--- a/platform/darwin/src/http_file_source.mm
+++ b/platform/darwin/src/http_file_source.mm
@@ -26,10 +26,10 @@ namespace mbgl {
class HTTPRequestShared {
public:
HTTPRequestShared(Response& response_, util::AsyncTask& async_)
- : response(response_),
- async(async_) {
+ : response(response_),
+ async(async_) {
}
-
+
void notify(const Response& response_) {
std::lock_guard<std::mutex> lock(mutex);
if (!cancelled) {
@@ -37,16 +37,16 @@ public:
async.send();
}
}
-
+
void cancel() {
std::lock_guard<std::mutex> lock(mutex);
cancelled = true;
}
-
+
private:
std::mutex mutex;
bool cancelled = false;
-
+
Response& response;
util::AsyncTask& async;
};
@@ -54,24 +54,24 @@ private:
class HTTPRequest : public AsyncRequest {
public:
HTTPRequest(FileSource::Callback callback_)
- : shared(std::make_shared<HTTPRequestShared>(response, async)),
- callback(callback_) {
+ : shared(std::make_shared<HTTPRequestShared>(response, async)),
+ callback(callback_) {
}
-
+
~HTTPRequest() override {
shared->cancel();
if (task) {
[task cancel];
}
}
-
+
std::shared_ptr<HTTPRequestShared> shared;
NSURLSessionDataTask* task = nil;
-
+
private:
FileSource::Callback callback;
Response response;
-
+
util::AsyncTask async { [this] {
// Calling `callback` may result in deleting `this`. Copy data to temporaries first.
auto callback_ = callback;
@@ -86,15 +86,15 @@ public:
@autoreleasepool {
NSURLSessionConfiguration *sessionConfig = MGLNativeNetworkManager.sharedManager.sessionConfiguration;
session = [NSURLSession sessionWithConfiguration:sessionConfig];
-
+
userAgent = getUserAgent();
}
}
-
+
NSURLSession* session = nil;
NSString* userAgent = nil;
NSInteger accountType = 0;
-
+
private:
NSString* getUserAgent() const;
NSBundle* getSDKBundle() const;
@@ -102,7 +102,7 @@ private:
NSString *HTTPFileSource::Impl::getUserAgent() const {
NSMutableArray *userAgentComponents = [NSMutableArray array];
-
+
NSBundle *appBundle = [NSBundle mainBundle];
if (appBundle) {
NSString *appName = appBundle.infoDictionary[@"CFBundleName"];
@@ -112,7 +112,7 @@ NSString *HTTPFileSource::Impl::getUserAgent() const {
} else {
[userAgentComponents addObject:[NSProcessInfo processInfo].processName];
}
-
+
NSBundle *sdkBundle = HTTPFileSource::Impl::getSDKBundle();
if (sdkBundle) {
NSString *versionString = sdkBundle.infoDictionary[@"MGLSemanticVersionString"];
@@ -124,12 +124,12 @@ NSString *HTTPFileSource::Impl::getUserAgent() const {
sdkBundle.infoDictionary[@"CFBundleName"], versionString]];
}
}
-
+
// Avoid %s here because it inserts hidden bidirectional markers on macOS when the system
// language is set to a right-to-left language.
[userAgentComponents addObject:[NSString stringWithFormat:@"MapboxGL/0.0.0 (%@)",
@(mbgl::version::revision)]];
-
+
NSString *systemName = @"Darwin";
#if TARGET_OS_IPHONE
systemName = @"iOS";
@@ -152,7 +152,7 @@ NSString *HTTPFileSource::Impl::getUserAgent() const {
if (systemVersion) {
[userAgentComponents addObject:[NSString stringWithFormat:@"%@/%@", systemName, systemVersion]];
}
-
+
NSString *cpu = nil;
#if TARGET_CPU_X86
cpu = @"x86";
@@ -166,7 +166,7 @@ NSString *HTTPFileSource::Impl::getUserAgent() const {
if (cpu) {
[userAgentComponents addObject:[NSString stringWithFormat:@"(%@)", cpu]];
}
-
+
return [userAgentComponents componentsJoinedByString:@" "];
}
@@ -182,7 +182,7 @@ NSBundle *HTTPFileSource::Impl::getSDKBundle() const {
}
HTTPFileSource::HTTPFileSource()
-: impl(std::make_unique<Impl>()) {
+ : impl(std::make_unique<Impl>()) {
}
HTTPFileSource::~HTTPFileSource() = default;
@@ -204,7 +204,7 @@ NSURL *resourceURLWithAccountType(const Resource& resource, NSInteger accountTyp
if (accountType == 0 && isValidMapboxEndpoint(url)) {
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
NSMutableArray *queryItems = [NSMutableArray array];
-
+
if (resource.usage == Resource::Usage::Offline) {
[queryItems addObject:[NSURLQueryItem queryItemWithName:@"offline" value:@"true"]];
} else {
@@ -224,11 +224,11 @@ NSURL *resourceURLWithAccountType(const Resource& resource, NSInteger accountTyp
#endif
return url;
}
-
+
std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource, Callback callback) {
auto request = std::make_unique<HTTPRequest>(callback);
auto shared = request->shared; // Explicit copy so that it also gets copied into the completion handler block below.
-
+
@autoreleasepool {
NSURL *url = resourceURLWithAccountType(resource, impl->accountType);
[MGLNativeNetworkManager.sharedManager debugLog:@"Requesting URI: %@", url.relativePath];
@@ -236,16 +236,16 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
if (resource.priorEtag) {
[req addValue:@(resource.priorEtag->c_str())
- forHTTPHeaderField:@"If-None-Match"];
+ forHTTPHeaderField:@"If-None-Match"];
} else if (resource.priorModified) {
[req addValue:@(util::rfc1123(*resource.priorModified).c_str())
- forHTTPHeaderField:@"If-Modified-Since"];
+ forHTTPHeaderField:@"If-Modified-Since"];
}
-
+
[req addValue:impl->userAgent forHTTPHeaderField:@"User-Agent"];
-
+
const bool isTile = resource.kind == mbgl::Resource::Kind::Tile;
-
+
if (isTile) {
[MGLNativeNetworkManager.sharedManager startDownloadEvent:url.relativePath type:@"tile"];
}
@@ -272,9 +272,9 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
switch ([error code]) {
case NSURLErrorBadServerResponse: // 5xx errors
response.error = std::make_unique<Error>(
- Error::Reason::Server, [[error localizedDescription] UTF8String]);
+ Error::Reason::Server, [[error localizedDescription] UTF8String]);
break;
-
+
case NSURLErrorNetworkConnectionLost:
case NSURLErrorCannotFindHost:
case NSURLErrorCannotConnectToHost:
@@ -285,55 +285,13 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
case NSURLErrorDataNotAllowed:
case NSURLErrorTimedOut:
response.error = std::make_unique<Error>(
- Error::Reason::Connection, [[error localizedDescription] UTF8String]);
+ Error::Reason::Connection, [[error localizedDescription] UTF8String]);
break;
-
+
default:
response.error = std::make_unique<Error>(
- Error::Reason::Other, [[error localizedDescription] UTF8String]);
+ Error::Reason::Other, [[error localizedDescription] UTF8String]);
break;
- }
- } else if ([res isKindOfClass:[NSHTTPURLResponse class]]) {
- const long responseCode = [(NSHTTPURLResponse *)res statusCode];
-
- NSDictionary *headers = [(NSHTTPURLResponse *)res allHeaderFields];
- NSString *cache_control = [headers objectForKey:@"Cache-Control"];
- if (cache_control) {
- const auto cc = http::CacheControl::parse([cache_control UTF8String]);
- response.expires = cc.toTimePoint();
- response.mustRevalidate = cc.mustRevalidate;
- }
-
- NSString *expires = [headers objectForKey:@"Expires"];
- if (expires) {
- response.expires = util::parseTimestamp([expires UTF8String]);
- }
-
- NSString *last_modified = [headers objectForKey:@"Last-Modified"];
- if (last_modified) {
- response.modified = util::parseTimestamp([last_modified UTF8String]);
- }
-
- NSString *etag = [headers objectForKey:@"ETag"];
- if (etag) {
- response.etag = std::string([etag UTF8String]);
- }
-
- if (responseCode == 200) {
- response.data = std::make_shared<std::string>((const char *)[data bytes], [data length]);
- } else if (responseCode == 204 || (responseCode == 404 && isTile)) {
- response.noContent = true;
- } else if (responseCode == 304) {
- response.notModified = true;
- } else if (responseCode == 404) {
- response.error =
- std::make_unique<Error>(Error::Reason::NotFound, "HTTP status code 404");
- } else if (responseCode == 429) {
- // Get the standard header
- optional<std::string> retryAfter;
- NSString *retryAfterHeader = headers[@"Retry-After"];
- if (retryAfterHeader) {
- retryAfter = std::string([retryAfterHeader UTF8String]);
}
} else if ([res isKindOfClass:[NSHTTPURLResponse class]]) {
const long responseCode = [(NSHTTPURLResponse *)res statusCode];
@@ -396,29 +354,18 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
std::make_unique<Error>(Error::Reason::Other, std::string{ "HTTP status code " } +
std::to_string(responseCode));
}
-
- response.error = std::make_unique<Error>(Error::Reason::RateLimit, "HTTP status code 429", http::parseRetryHeaders(retryAfter, xRateLimitReset));
- } else if (responseCode >= 500 && responseCode < 600) {
- response.error =
- std::make_unique<Error>(Error::Reason::Server, std::string{ "HTTP status code " } +
- std::to_string(responseCode));
} else {
- response.error =
- std::make_unique<Error>(Error::Reason::Other, std::string{ "HTTP status code " } +
- std::to_string(responseCode));
+ // This should never happen.
+ response.error = std::make_unique<Error>(Error::Reason::Other,
+ "Response class is not NSHTTPURLResponse");
}
- } else {
- // This should never happen.
- response.error = std::make_unique<Error>(Error::Reason::Other,
- "Response class is not NSHTTPURLResponse");
- }
-
- shared->notify(response);
- }];
-
+
+ shared->notify(response);
+ }];
+
[request->task resume];
}
-
+
return std::move(request);
}
diff --git a/platform/darwin/src/native_apple_interface.m b/platform/darwin/src/native_apple_interface.m
index 82ec4aa390..07dce0d5b0 100644
--- a/platform/darwin/src/native_apple_interface.m
+++ b/platform/darwin/src/native_apple_interface.m
@@ -53,7 +53,6 @@ static MGLNativeNetworkManager *instance = nil;
}
- (void)stopDownloadEventForResponse:(NSURLResponse *)response {
-
if (_delegate && [_delegate respondsToSelector:@selector(stopDownloadEventForResponse:)]) {
return [_delegate stopDownloadEventForResponse:response];
}
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index f1eeef17a4..fcb581a0e0 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -6,10 +6,8 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* Added support for [image expression](https://docs.mapbox.com/mapbox-gl-js/style-spec/#expressions-types-image) in core library. Runtime APIs for image expression will be implemented separately. ([#15877](https://github.com/mapbox/mapbox-gl-native/pull/15877))
* Make network requests for expired resources lower priority than requests for new resources. ([#15950](https://github.com/mapbox/mapbox-gl-native/pull/15950))
-
### Other changes
* Convert GeoJSON features to tiles for the loaded source description in a background thread and thus unblock the UI thread ([#15885](https://github.com/mapbox/mapbox-gl-native/pull/15885))
-* Separate platform codes from native codes. ([#16031](https://github.com/mapbox/mapbox-gl-native/pull/16031))
### Bug fixes
* Fixed the rendering bug caused by redundant pending requests for already requested images [#15864](https://github.com/mapbox/mapbox-gl-native/pull/15864)
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 5e1e311496..4db9409081 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -532,10 +532,6 @@
CAE7AD5520F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAE7AD5420F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift */; };
CAFB3C14234505D500399265 /* MGLMapSnapshotter_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = CAFB3C13234505D500399265 /* MGLMapSnapshotter_Private.h */; };
CAFB3C15234505D500399265 /* MGLMapSnapshotter_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = CAFB3C13234505D500399265 /* MGLMapSnapshotter_Private.h */; };
- CF0E9076239EA6950074A30D /* MGLNativeInterfaceReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = CF0E9074239EA6950074A30D /* MGLNativeInterfaceReceiver.h */; };
- CF0E9077239EA6950074A30D /* MGLNativeInterfaceReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = CF0E9074239EA6950074A30D /* MGLNativeInterfaceReceiver.h */; };
- CF0E9078239EA6950074A30D /* MGLNativeInterfaceReceiver.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0E9075239EA6950074A30D /* MGLNativeInterfaceReceiver.m */; };
- CF0E9079239EA6950074A30D /* MGLNativeInterfaceReceiver.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0E9075239EA6950074A30D /* MGLNativeInterfaceReceiver.m */; };
CF75A91522D85E860058A5C4 /* MGLLoggingConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = CF75A91422D85E860058A5C4 /* MGLLoggingConfiguration.mm */; };
CF75A91622D85E860058A5C4 /* MGLLoggingConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = CF75A91422D85E860058A5C4 /* MGLLoggingConfiguration.mm */; };
CFF9F98623A24BF500B0DE92 /* MGLNetworkIntegrationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CFF9F98423A24BF400B0DE92 /* MGLNetworkIntegrationManager.h */; };
@@ -1233,8 +1229,6 @@
CAE7AD5320F46EF5003B6782 /* integration-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "integration-Bridging-Header.h"; sourceTree = "<group>"; };
CAE7AD5420F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MGLMapSnapshotterSwiftTests.swift; sourceTree = "<group>"; };
CAFB3C13234505D500399265 /* MGLMapSnapshotter_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLMapSnapshotter_Private.h; sourceTree = "<group>"; };
- CF0E9074239EA6950074A30D /* MGLNativeInterfaceReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLNativeInterfaceReceiver.h; sourceTree = "<group>"; };
- CF0E9075239EA6950074A30D /* MGLNativeInterfaceReceiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLNativeInterfaceReceiver.m; sourceTree = "<group>"; };
CF75A91422D85E860058A5C4 /* MGLLoggingConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLLoggingConfiguration.mm; sourceTree = "<group>"; };
CFF9F98423A24BF400B0DE92 /* MGLNetworkIntegrationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLNetworkIntegrationManager.h; path = ../../darwin/src/MGLNetworkIntegrationManager.h; sourceTree = "<group>"; };
CFF9F98523A24BF400B0DE92 /* MGLNetworkIntegrationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLNetworkIntegrationManager.m; path = ../../darwin/src/MGLNetworkIntegrationManager.m; sourceTree = "<group>"; };
@@ -2640,7 +2634,6 @@
350098BB1D480108004B2AF0 /* MGLVectorTileSource.h in Headers */,
DA8847F61CBAFA5100AB86E3 /* MGLOfflineStorage.h in Headers */,
DAD1656E1CF41981001FF4B9 /* MGLFeature_Private.h in Headers */,
- CF0E9076239EA6950074A30D /* MGLNativeInterfaceReceiver.h in Headers */,
DA88483C1CBAFB8500AB86E3 /* MGLMapView.h in Headers */,
3EA9363147E77DD29FA06063 /* MGLRendererConfiguration.h in Headers */,
55E5665121C2A1C20008B8B5 /* MMEReachability.h in Headers */,
@@ -2836,7 +2829,6 @@
74CB5EB2219B252C00102936 /* MGLStyleLayerManager.h in Headers */,
9221BAB020699F8A0054BDF4 /* MGLTilePyramidOfflineRegion_Private.h in Headers */,
96E516F5200059B100A02306 /* MGLNetworkConfiguration.h in Headers */,
- CF0E9077239EA6950074A30D /* MGLNativeInterfaceReceiver.h in Headers */,
96E516DD200054F200A02306 /* MGLPolygon_Private.h in Headers */,
353933F91D3FB79F003F57D7 /* MGLLineStyleLayer.h in Headers */,
9C6E282622A980AC0056B7BE /* UIKit+MMEMobileEvents.h in Headers */,
@@ -3381,7 +3373,6 @@
9620BB3A1E69FE1700705A1D /* MGLSDKUpdateChecker.mm in Sources */,
354B83981D2E873E005D9406 /* MGLUserLocationAnnotationView.m in Sources */,
40834BEE1FE05E1800C1BD0D /* MMEEventsConfiguration.m in Sources */,
- CF0E9078239EA6950074A30D /* MGLNativeInterfaceReceiver.m in Sources */,
DA88485D1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.m in Sources */,
DAD165701CF41981001FF4B9 /* MGLFeature.mm in Sources */,
30E578191DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */,
@@ -3510,7 +3501,6 @@
DAA4E4221CBB730400178DFB /* MGLPointAnnotation.mm in Sources */,
40834C021FE05E1800C1BD0D /* MMEEventsConfiguration.m in Sources */,
DAED38661D62D0FC00D7640F /* NSURL+MGLAdditions.m in Sources */,
- CF0E9079239EA6950074A30D /* MGLNativeInterfaceReceiver.m in Sources */,
DAD165711CF41981001FF4B9 /* MGLFeature.mm in Sources */,
30E5781A1DAA855E0050F07E /* UIImage+MGLAdditions.mm in Sources */,
ACD0245B2187EABA00D8C8A7 /* MMEMetricsManager.m in Sources */,
diff --git a/platform/ios/sdk-files.json b/platform/ios/sdk-files.json
index 45cc0088f1..47dacb7cce 100644
--- a/platform/ios/sdk-files.json
+++ b/platform/ios/sdk-files.json
@@ -9,7 +9,6 @@
"platform/ios/src/MGLSDKUpdateChecker.mm",
"platform/ios/src/MGLUserLocationAnnotationView.m",
"platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventsConfiguration.m",
- "platform/ios/src/MGLNativeInterfaceReceiver.m",
"platform/ios/src/MGLFaux3DUserLocationAnnotationView.m",
"platform/darwin/src/MGLFeature.mm",
"platform/ios/src/UIImage+MGLAdditions.mm",
@@ -287,7 +286,6 @@
"MGLUserLocationAnnotationView_Private.h": "platform/ios/src/MGLUserLocationAnnotationView_Private.h",
"MGLRasterTileSource_Private.h": "platform/darwin/src/MGLRasterTileSource_Private.h",
"MGLFeature_Private.h": "platform/darwin/src/MGLFeature_Private.h",
- "MGLNativeInterfaceReceiver.h": "platform/ios/src/MGLNativeInterfaceReceiver.h",
"MGLRendererConfiguration.h": "platform/darwin/src/MGLRendererConfiguration.h",
"MMEReachability.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/Reachability/MMEReachability.h",
"MMENamespacedDependencies.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMENamespacedDependencies.h",
diff --git a/platform/ios/src/MGLNativeInterfaceReceiver.h b/platform/ios/src/MGLNativeInterfaceReceiver.h
deleted file mode 100644
index 367adf9f3f..0000000000
--- a/platform/ios/src/MGLNativeInterfaceReceiver.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#import <Foundation/Foundation.h>
-#include <mbgl/interface/native_apple_interface.h>
-
-@interface MGLNativeInterfaceReceiver : NSObject <MGLNativeAppleInterfaceDelegate>
-
-+ (MGLNativeInterfaceReceiver *)shared;
-
-@end
diff --git a/platform/ios/src/MGLNativeInterfaceReceiver.m b/platform/ios/src/MGLNativeInterfaceReceiver.m
deleted file mode 100644
index a703c55d38..0000000000
--- a/platform/ios/src/MGLNativeInterfaceReceiver.m
+++ /dev/null
@@ -1,50 +0,0 @@
-#import "MGLNativeInterfaceReceiver.h"
-
-#import "MGLLoggingConfiguration_Private.h"
-#import "MGLNetworkConfiguration_Private.h"
-
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
-#import "MGLAccountManager_Private.h"
-#endif
-
-@implementation MGLNativeInterfaceReceiver
-
-static MGLNativeInterfaceReceiver *instance = nil;
-
-+ (MGLNativeInterfaceReceiver *)shared {
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- instance = [[MGLNativeInterfaceReceiver alloc] init];
- });
- return instance;
-}
-
-#pragma mark - MGLNativeAppleInterfaceManager delegate -
-
-- (NSURLSessionConfiguration *)nai_sessionConfiguration {
- return [MGLNetworkConfiguration sharedManager].sessionConfiguration;
-}
-
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
-- (NSString *)nai_accountTypeKey {
- return MGLMapboxAccountTypeKey;
-}
-
-- (NSString *)nai_skuToken {
- return MGLAccountManager.skuToken;
-}
-#endif
-
-- (void)nai_startDownloadEvent:(NSString *)event type:(NSString *)type {
- [[MGLNetworkConfiguration sharedManager] startDownloadEvent:event type:@"tile"];
-}
-
-- (void)nai_cancelDownloadEventForResponse:(NSURLResponse *)response {
- [[MGLNetworkConfiguration sharedManager] cancelDownloadEventForResponse:response];
-}
-
-- (void)nai_stopDownloadEventForResponse:(NSURLResponse *)response {
- [[MGLNetworkConfiguration sharedManager] stopDownloadEventForResponse:response];
-}
-
-@end
diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj
index a10ae16e9c..7dcd72b47d 100644
--- a/platform/macos/macos.xcodeproj/project.pbxproj
+++ b/platform/macos/macos.xcodeproj/project.pbxproj
@@ -134,8 +134,6 @@
CA8FBC0D21A4A74300D1203C /* MGLRendererConfigurationTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CA8FBC0C21A4A74300D1203C /* MGLRendererConfigurationTests.mm */; };
CA9461A620884CCB0015EB12 /* MGLAnnotationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA9461A520884CCB0015EB12 /* MGLAnnotationTests.m */; };
CAD9D0AC22A88A32001B25EE /* MGLResourceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CAD9D0AB22A88A32001B25EE /* MGLResourceTests.mm */; };
- CF0E907E239EA6BB0074A30D /* MGLNativeInterfaceReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = CF0E907C239EA6BB0074A30D /* MGLNativeInterfaceReceiver.h */; };
- CF0E907F239EA6BB0074A30D /* MGLNativeInterfaceReceiver.m in Sources */ = {isa = PBXBuildFile; fileRef = CF0E907D239EA6BB0074A30D /* MGLNativeInterfaceReceiver.m */; };
CF762DEF22DC7EFF00338472 /* MGLLoggingConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = CF762DEE22DC7EFF00338472 /* MGLLoggingConfiguration.mm */; };
CFF9F98D23A2505700B0DE92 /* MGLNetworkIntegrationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CFF9F98B23A2505700B0DE92 /* MGLNetworkIntegrationManager.m */; };
CFF9F98E23A2505700B0DE92 /* MGLNetworkIntegrationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CFF9F98C23A2505700B0DE92 /* MGLNetworkIntegrationManager.h */; };
@@ -479,8 +477,6 @@
CA8FBC0C21A4A74300D1203C /* MGLRendererConfigurationTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLRendererConfigurationTests.mm; path = ../../darwin/test/MGLRendererConfigurationTests.mm; sourceTree = "<group>"; };
CA9461A520884CCB0015EB12 /* MGLAnnotationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLAnnotationTests.m; path = test/MGLAnnotationTests.m; sourceTree = SOURCE_ROOT; };
CAD9D0AB22A88A32001B25EE /* MGLResourceTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLResourceTests.mm; path = ../../darwin/test/MGLResourceTests.mm; sourceTree = "<group>"; };
- CF0E907C239EA6BB0074A30D /* MGLNativeInterfaceReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLNativeInterfaceReceiver.h; sourceTree = "<group>"; };
- CF0E907D239EA6BB0074A30D /* MGLNativeInterfaceReceiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLNativeInterfaceReceiver.m; sourceTree = "<group>"; };
CF762DEE22DC7EFF00338472 /* MGLLoggingConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLLoggingConfiguration.mm; sourceTree = "<group>"; };
CFF9F98B23A2505700B0DE92 /* MGLNetworkIntegrationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLNetworkIntegrationManager.m; path = ../../darwin/src/MGLNetworkIntegrationManager.m; sourceTree = "<group>"; };
CFF9F98C23A2505700B0DE92 /* MGLNetworkIntegrationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MGLNetworkIntegrationManager.h; path = ../../darwin/src/MGLNetworkIntegrationManager.h; sourceTree = "<group>"; };
@@ -1425,7 +1421,6 @@
3538AA231D542685008EC33D /* MGLStyleLayer.h in Headers */,
DAE6C35C1CC31E0400DB3429 /* MGLGeometry.h in Headers */,
DAE6C35A1CC31E0400DB3429 /* MGLAccountManager.h in Headers */,
- CF0E907E239EA6BB0074A30D /* MGLNativeInterfaceReceiver.h in Headers */,
DA551B821DB496AC0009AFAF /* MGLTileSource.h in Headers */,
35602C001D3EA9B40050646F /* MGLForegroundStyleLayer.h in Headers */,
DAE6C35D1CC31E0400DB3429 /* MGLMapCamera.h in Headers */,
@@ -1674,7 +1669,6 @@
files = (
07A019EF1ED665CD00ACD43E /* MGLImageSource.mm in Sources */,
92092EF11F5EB10E00AF5130 /* MGLMapSnapshotter.mm in Sources */,
- CF0E907F239EA6BB0074A30D /* MGLNativeInterfaceReceiver.m in Sources */,
40ABDB561DB0022100372083 /* NSImage+MGLAdditions.mm in Sources */,
DAF25715201901C200367EF5 /* MGLHillshadeStyleLayer.mm in Sources */,
DAE6C3901CC31E2A00DB3429 /* MGLPointAnnotation.mm in Sources */,
diff --git a/platform/macos/sdk-files.json b/platform/macos/sdk-files.json
index d24b7c3fa7..65b946cd06 100644
--- a/platform/macos/sdk-files.json
+++ b/platform/macos/sdk-files.json
@@ -3,7 +3,6 @@
"sources": [
"platform/darwin/src/MGLImageSource.mm",
"platform/darwin/src/MGLMapSnapshotter.mm",
- "platform/macos/src/MGLNativeInterfaceReceiver.m",
"platform/macos/src/NSImage+MGLAdditions.mm",
"platform/darwin/src/MGLHillshadeStyleLayer.mm",
"platform/darwin/src/MGLPointAnnotation.mm",
@@ -196,7 +195,6 @@
"MGLValueEvaluator.h": "platform/darwin/src/MGLValueEvaluator.h",
"MGLOfflinePack_Private.h": "platform/darwin/src/MGLOfflinePack_Private.h",
"MGLFoundation_Private.h": "platform/darwin/src/MGLFoundation_Private.h",
- "MGLNativeInterfaceReceiver.h": "platform/macos/src/MGLNativeInterfaceReceiver.h",
"MGLCompassCell.h": "platform/macos/src/MGLCompassCell.h",
"MGLShapeSource_Private.h": "platform/darwin/src/MGLShapeSource_Private.h",
"MGLStyle_Private.h": "platform/darwin/src/MGLStyle_Private.h",
diff --git a/platform/macos/src/MGLNativeInterfaceReceiver.h b/platform/macos/src/MGLNativeInterfaceReceiver.h
deleted file mode 100644
index 367adf9f3f..0000000000
--- a/platform/macos/src/MGLNativeInterfaceReceiver.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#import <Foundation/Foundation.h>
-#include <mbgl/interface/native_apple_interface.h>
-
-@interface MGLNativeInterfaceReceiver : NSObject <MGLNativeAppleInterfaceDelegate>
-
-+ (MGLNativeInterfaceReceiver *)shared;
-
-@end
diff --git a/platform/macos/src/MGLNativeInterfaceReceiver.m b/platform/macos/src/MGLNativeInterfaceReceiver.m
deleted file mode 100644
index c9ee9ca6d7..0000000000
--- a/platform/macos/src/MGLNativeInterfaceReceiver.m
+++ /dev/null
@@ -1,40 +0,0 @@
-#import "MGLNativeInterfaceReceiver.h"
-
-#import "MGLLoggingConfiguration_Private.h"
-#import "MGLNetworkConfiguration_Private.h"
-
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
-#import "MGLAccountManager_Private.h"
-#endif
-
-@implementation MGLNativeInterfaceReceiver
-
-static MGLNativeInterfaceReceiver *instance = nil;
-
-+ (MGLNativeInterfaceReceiver *)shared {
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- instance = [[MGLNativeInterfaceReceiver alloc] init];
- });
- return instance;
-}
-
-#pragma mark - MGLNativeAppleInterfaceManager delegate -
-
-- (NSURLSessionConfiguration *)nai_sessionConfiguration {
- return [MGLNetworkConfiguration sharedManager].sessionConfiguration;
-}
-
-- (void)nai_startDownloadEvent:(NSString *)event type:(NSString *)type {
- [[MGLNetworkConfiguration sharedManager] startDownloadEvent:event type:@"tile"];
-}
-
-- (void)nai_cancelDownloadEventForResponse:(NSURLResponse *)response {
- [[MGLNetworkConfiguration sharedManager] cancelDownloadEventForResponse:response];
-}
-
-- (void)nai_stopDownloadEventForResponse:(NSURLResponse *)response {
- [[MGLNetworkConfiguration sharedManager] stopDownloadEventForResponse:response];
-}
-
-@end
diff --git a/render-test/ios-manifest.json b/render-test/ios-manifest.json
deleted file mode 100644
index 7eb03a3253..0000000000
--- a/render-test/ios-manifest.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "base_test_path":"integration",
- "expectation_paths":["expected/"],
- "ignore_paths":["ignores.json", "mac-ignores.json"],
- "vendor_path":"mapbox-gl-styles",
- "asset_path": "integration"
-}
diff --git a/render-test/ios/Gemfile b/render-test/ios/Gemfile
new file mode 100644
index 0000000000..adc90d98cf
--- /dev/null
+++ b/render-test/ios/Gemfile
@@ -0,0 +1,3 @@
+source "https://rubygems.org"
+
+gem "fastlane" \ No newline at end of file
diff --git a/render-test/ios/Gemfile.lock b/render-test/ios/Gemfile.lock
new file mode 100644
index 0000000000..23018150b9
--- /dev/null
+++ b/render-test/ios/Gemfile.lock
@@ -0,0 +1,159 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ CFPropertyList (3.0.2)
+ addressable (2.7.0)
+ public_suffix (>= 2.0.2, < 5.0)
+ atomos (0.1.3)
+ babosa (1.0.3)
+ claide (1.0.3)
+ colored (1.2)
+ colored2 (3.1.2)
+ commander-fastlane (4.4.6)
+ highline (~> 1.7.2)
+ declarative (0.0.10)
+ declarative-option (0.1.0)
+ digest-crc (0.4.1)
+ domain_name (0.5.20190701)
+ unf (>= 0.0.5, < 1.0.0)
+ dotenv (2.7.5)
+ emoji_regex (1.0.1)
+ excon (0.71.1)
+ faraday (0.17.3)
+ multipart-post (>= 1.2, < 3)
+ faraday-cookie_jar (0.0.6)
+ faraday (>= 0.7.4)
+ http-cookie (~> 1.0.0)
+ faraday_middleware (0.13.1)
+ faraday (>= 0.7.4, < 1.0)
+ fastimage (2.1.7)
+ fastlane (2.139.0)
+ CFPropertyList (>= 2.3, < 4.0.0)
+ addressable (>= 2.3, < 3.0.0)
+ babosa (>= 1.0.2, < 2.0.0)
+ bundler (>= 1.12.0, < 3.0.0)
+ colored
+ commander-fastlane (>= 4.4.6, < 5.0.0)
+ dotenv (>= 2.1.1, < 3.0.0)
+ emoji_regex (>= 0.1, < 2.0)
+ excon (>= 0.71.0, < 1.0.0)
+ faraday (~> 0.17)
+ faraday-cookie_jar (~> 0.0.6)
+ faraday_middleware (~> 0.13.1)
+ fastimage (>= 2.1.0, < 3.0.0)
+ gh_inspector (>= 1.1.2, < 2.0.0)
+ google-api-client (>= 0.29.2, < 0.37.0)
+ google-cloud-storage (>= 1.15.0, < 2.0.0)
+ highline (>= 1.7.2, < 2.0.0)
+ json (< 3.0.0)
+ jwt (~> 2.1.0)
+ mini_magick (>= 4.9.4, < 5.0.0)
+ multi_xml (~> 0.5)
+ multipart-post (~> 2.0.0)
+ plist (>= 3.1.0, < 4.0.0)
+ public_suffix (~> 2.0.0)
+ rubyzip (>= 1.3.0, < 2.0.0)
+ security (= 0.1.3)
+ simctl (~> 1.6.3)
+ slack-notifier (>= 2.0.0, < 3.0.0)
+ terminal-notifier (>= 2.0.0, < 3.0.0)
+ terminal-table (>= 1.4.5, < 2.0.0)
+ tty-screen (>= 0.6.3, < 1.0.0)
+ tty-spinner (>= 0.8.0, < 1.0.0)
+ word_wrap (~> 1.0.0)
+ xcodeproj (>= 1.13.0, < 2.0.0)
+ xcpretty (~> 0.3.0)
+ xcpretty-travis-formatter (>= 0.0.3)
+ gh_inspector (1.1.3)
+ google-api-client (0.36.4)
+ addressable (~> 2.5, >= 2.5.1)
+ googleauth (~> 0.9)
+ httpclient (>= 2.8.1, < 3.0)
+ mini_mime (~> 1.0)
+ representable (~> 3.0)
+ retriable (>= 2.0, < 4.0)
+ signet (~> 0.12)
+ google-cloud-core (1.4.1)
+ google-cloud-env (~> 1.0)
+ google-cloud-env (1.3.0)
+ faraday (~> 0.11)
+ google-cloud-storage (1.25.0)
+ addressable (~> 2.5)
+ digest-crc (~> 0.4)
+ google-api-client (~> 0.33)
+ google-cloud-core (~> 1.2)
+ googleauth (~> 0.9)
+ mini_mime (~> 1.0)
+ googleauth (0.10.0)
+ faraday (~> 0.12)
+ jwt (>= 1.4, < 3.0)
+ memoist (~> 0.16)
+ multi_json (~> 1.11)
+ os (>= 0.9, < 2.0)
+ signet (~> 0.12)
+ highline (1.7.10)
+ http-cookie (1.0.3)
+ domain_name (~> 0.5)
+ httpclient (2.8.3)
+ json (2.3.0)
+ jwt (2.1.0)
+ memoist (0.16.2)
+ mini_magick (4.10.1)
+ mini_mime (1.0.2)
+ multi_json (1.14.1)
+ multi_xml (0.6.0)
+ multipart-post (2.0.0)
+ nanaimo (0.2.6)
+ naturally (2.2.0)
+ os (1.0.1)
+ plist (3.5.0)
+ public_suffix (2.0.5)
+ representable (3.0.4)
+ declarative (< 0.1.0)
+ declarative-option (< 0.2.0)
+ uber (< 0.2.0)
+ retriable (3.1.2)
+ rouge (2.0.7)
+ rubyzip (1.3.0)
+ security (0.1.3)
+ signet (0.12.0)
+ addressable (~> 2.3)
+ faraday (~> 0.9)
+ jwt (>= 1.5, < 3.0)
+ multi_json (~> 1.10)
+ simctl (1.6.7)
+ CFPropertyList
+ naturally
+ slack-notifier (2.3.2)
+ terminal-notifier (2.0.0)
+ terminal-table (1.8.0)
+ unicode-display_width (~> 1.1, >= 1.1.1)
+ tty-cursor (0.7.0)
+ tty-screen (0.7.0)
+ tty-spinner (0.9.2)
+ tty-cursor (~> 0.7)
+ uber (0.1.0)
+ unf (0.1.4)
+ unf_ext
+ unf_ext (0.0.7.6)
+ unicode-display_width (1.6.0)
+ word_wrap (1.0.0)
+ xcodeproj (1.14.0)
+ CFPropertyList (>= 2.3.3, < 4.0)
+ atomos (~> 0.1.3)
+ claide (>= 1.0.2, < 2.0)
+ colored2 (~> 3.1)
+ nanaimo (~> 0.2.6)
+ xcpretty (0.3.0)
+ rouge (~> 2.0.7)
+ xcpretty-travis-formatter (1.0.0)
+ xcpretty (~> 0.2, >= 0.0.7)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ fastlane
+
+BUNDLED WITH
+ 2.1.4
diff --git a/render-test/ios/Info.plist b/render-test/ios/Info.plist
index 74d7179bde..de3af9d725 100644
--- a/render-test/ios/Info.plist
+++ b/render-test/ios/Info.plist
@@ -7,33 +7,29 @@
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
- <string>RenderTestAPP</string>
+ <string>RenderTestApp</string>
<key>CFBundleIdentifier</key>
- <string>com.mapbox.render</string>
+ <string>com.mapbox.RenderTestApp</string>
<key>CFBundleGetInfoString</key>
- <string>${MACOSX_BUNDLE_INFO_STRING}</string>
- <key>CFBundleIconFile</key>
- <string>${MACOSX_BUNDLE_ICON_FILE}</string>
- <key>CFBundleIdentifier</key>
- <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+ <string>com.mapbox.RenderTestApp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>1.0</string>
<key>CFBundleLongVersionString</key>
- <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+ <string>1.0</string>
<key>CFBundleName</key>
- <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+ <string>com.mapbox.RenderTestApp</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+ <string>1.0</string>
<key>CFBundleSignature</key>
- <string>????</string>
+ <string>MBGL</string>
<key>CFBundleVersion</key>
<string>7877</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
- <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+ <string>© 2014–2020 Mapbox</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>LSRequiresIPhoneOS</key>
diff --git a/render-test/ios/Prefix.pch b/render-test/ios/Prefix.pch
deleted file mode 100644
index b717e4a446..0000000000
--- a/render-test/ios/Prefix.pch
+++ /dev/null
@@ -1,7 +0,0 @@
-#import <Availability.h>
-
-#ifdef __OBJC__
- #import <UIKit/UIKit.h>
- #import <Foundation/Foundation.h>
-#endif
-
diff --git a/render-test/ios/RenderTestApp_iphoneos13.2-arm64e.xctestrun b/render-test/ios/RenderTestApp_iphoneos13.2-arm64e.xctestrun
new file mode 100644
index 0000000000..b92ac8c32e
--- /dev/null
+++ b/render-test/ios/RenderTestApp_iphoneos13.2-arm64e.xctestrun
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>RenderTestAppTests</key>
+ <dict>
+ <key>BlueprintName</key>
+ <string>RenderTestAppTests</string>
+ <key>BundleIdentifiersForCrashReportEmphasis</key>
+ <array>
+ <string>com.mapbox.RenderTestApp</string>
+ <string>com.mapbox.RenderTestAppTests</string>
+ </array>
+ <key>CommandLineArguments</key>
+ <array/>
+ <key>DependentProductPaths</key>
+ <array>
+ <string>__TESTROOT__/Debug-iphoneos/RenderTestApp.app</string>
+ <string>__TESTROOT__/Debug-iphoneos/RenderTestApp.app/PlugIns/RenderTestAppTests.xctest</string>
+ </array>
+ <key>EnvironmentVariables</key>
+ <dict>
+ <key>OS_ACTIVITY_DT_MODE</key>
+ <string>YES</string>
+ <key>SQLITE_ENABLE_THREAD_ASSERTIONS</key>
+ <string>1</string>
+ </dict>
+ <key>IsAppHostedTestBundle</key>
+ <true/>
+ <key>ProductModuleName</key>
+ <string>RenderTestAppTests</string>
+ <key>RunOrder</key>
+ <integer>0</integer>
+ <key>SystemAttachmentLifetime</key>
+ <string>deleteOnSuccess</string>
+ <key>TestBundlePath</key>
+ <string>__TESTHOST__/PlugIns/RenderTestAppTests.xctest</string>
+ <key>TestHostBundleIdentifier</key>
+ <string>com.mapbox.RenderTestApp</string>
+ <key>TestHostPath</key>
+ <string>__TESTROOT__/Debug-iphoneos/RenderTestApp.app</string>
+ <key>TestLanguage</key>
+ <string></string>
+ <key>TestRegion</key>
+ <string></string>
+ <key>TestingEnvironmentVariables</key>
+ <dict>
+ <key>DYLD_FALLBACK_FRAMEWORK_PATH</key>
+ <string></string>
+ <key>DYLD_INSERT_LIBRARIES</key>
+ <string>__PLATFORMS__/iPhoneOS.platform/Developer/usr/lib/libXCTestBundleInject.dylib</string>
+ <key>XCInjectBundleInto</key>
+ <string>unused</string>
+ </dict>
+ <key>ToolchainsSettingValue</key>
+ <array/>
+ <key>UITargetAppCommandLineArguments</key>
+ <array/>
+ <key>UserAttachmentLifetime</key>
+ <string>deleteOnSuccess</string>
+ </dict>
+ <key>__xctestrun_metadata__</key>
+ <dict>
+ <key>FormatVersion</key>
+ <integer>1</integer>
+ </dict>
+</dict>
+</plist>
diff --git a/render-test/ios/ViewController.h b/render-test/ios/ViewController.h
index 40ea147a8a..9c7dfc57ec 100644
--- a/render-test/ios/ViewController.h
+++ b/render-test/ios/ViewController.h
@@ -1,6 +1,3 @@
-// ViewController.h
-// Your main view controller
-
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
diff --git a/render-test/ios/ViewController.m b/render-test/ios/ViewController.m
index 892ada7231..eb7bbb0754 100644
--- a/render-test/ios/ViewController.m
+++ b/render-test/ios/ViewController.m
@@ -11,7 +11,7 @@
- (void)viewDidLoad {
[super viewDidLoad];
- i = [[IosTestRunner alloc]init];
+// i = [[IosTestRunner alloc]init];
}
- (void)didReceiveMemoryWarning {
diff --git a/render-test/ios/codesigning/RenderTestApp.app.xcent.template b/render-test/ios/codesigning/RenderTestApp.app.xcent.template
new file mode 100644
index 0000000000..933c054b3d
--- /dev/null
+++ b/render-test/ios/codesigning/RenderTestApp.app.xcent.template
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>application-identifier</key>
+ <string>$TEAM_ID.com.mapbox.RenderTestApp</string>
+ <key>com.apple.developer.team-identifier</key>
+ <string>$TEAM_ID</string>
+ <key>get-task-allow</key>
+ <true/>
+ <key>keychain-access-groups</key>
+ <array>
+ <string>$TEAM_ID.com.mapbox.RenderTestApp</string>
+ </array>
+</dict>
+</plist> \ No newline at end of file
diff --git a/render-test/ios/codesigning/RenderTestAppTests.xctest.xcent.template b/render-test/ios/codesigning/RenderTestAppTests.xctest.xcent.template
new file mode 100644
index 0000000000..c2138e492f
--- /dev/null
+++ b/render-test/ios/codesigning/RenderTestAppTests.xctest.xcent.template
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>application-identifier</key>
+ <string>$TEAM_ID.com.mapbox.RenderTestAppTests</string>
+ <key>com.apple.developer.team-identifier</key>
+ <string>$TEAM_ID</string>
+ <key>get-task-allow</key>
+ <true/>
+ <key>keychain-access-groups</key>
+ <array>
+ <string>$TEAM_ID.com.mapbox.RenderTestAppTests</string>
+ </array>
+</dict>
+</plist> \ No newline at end of file
diff --git a/render-test/ios/codesigning/XCTAutomationSupport.framework.xcent.template b/render-test/ios/codesigning/XCTAutomationSupport.framework.xcent.template
new file mode 100644
index 0000000000..c2138e492f
--- /dev/null
+++ b/render-test/ios/codesigning/XCTAutomationSupport.framework.xcent.template
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>application-identifier</key>
+ <string>$TEAM_ID.com.mapbox.RenderTestAppTests</string>
+ <key>com.apple.developer.team-identifier</key>
+ <string>$TEAM_ID</string>
+ <key>get-task-allow</key>
+ <true/>
+ <key>keychain-access-groups</key>
+ <array>
+ <string>$TEAM_ID.com.mapbox.RenderTestAppTests</string>
+ </array>
+</dict>
+</plist> \ No newline at end of file
diff --git a/render-test/ios/codesigning/XCTest.framework.xcent.template b/render-test/ios/codesigning/XCTest.framework.xcent.template
new file mode 100644
index 0000000000..c2138e492f
--- /dev/null
+++ b/render-test/ios/codesigning/XCTest.framework.xcent.template
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>application-identifier</key>
+ <string>$TEAM_ID.com.mapbox.RenderTestAppTests</string>
+ <key>com.apple.developer.team-identifier</key>
+ <string>$TEAM_ID</string>
+ <key>get-task-allow</key>
+ <true/>
+ <key>keychain-access-groups</key>
+ <array>
+ <string>$TEAM_ID.com.mapbox.RenderTestAppTests</string>
+ </array>
+</dict>
+</plist> \ No newline at end of file
diff --git a/render-test/ios/codesigning/codesign_all.sh b/render-test/ios/codesigning/codesign_all.sh
new file mode 100755
index 0000000000..caa38731c6
--- /dev/null
+++ b/render-test/ios/codesigning/codesign_all.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+codesign --force --sign $CODESIGNIDENTITY --entitlements ../codesigning/RenderTestApp.app.xcent --timestamp=none ./Debug-iphoneos/RenderTestApp.app
+codesign --force --sign $CODESIGNIDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Debug-iphoneos/RenderTestApp.app/Frameworks/libXCTestSwiftSupport.dylib
+codesign --force --sign $CODESIGNIDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Debug-iphoneos/RenderTestApp.app/Frameworks/libXCTestBundleInject.dylib
+codesign --force --sign $CODESIGNIDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Debug-iphoneos/RenderTestApp.app/Frameworks/XCTAutomationSupport.framework
+codesign --force --sign $CODESIGNIDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Debug-iphoneos/RenderTestApp.app/Frameworks/XCTest.framework
+codesign --force --sign $CODESIGNIDENTITY --deep --entitlements ../codesigning/RenderTestAppTests.xctest.xcent --timestamp=none ./Debug-iphoneos/RenderTestApp.app/PlugIns/RenderTestAppTests.xctest
diff --git a/render-test/ios/codesigning/generate-entitlements.swift b/render-test/ios/codesigning/generate-entitlements.swift
new file mode 100755
index 0000000000..83834483bf
--- /dev/null
+++ b/render-test/ios/codesigning/generate-entitlements.swift
@@ -0,0 +1,40 @@
+#!/usr/bin/swift
+
+/// Generates Entitlement files .xcent for codesigning, containing the correct team id
+import Swift
+import Foundation
+
+let fileManager = FileManager.default
+
+let contentsOfCurrentWorkingDirectory = try FileManager.default.contentsOfDirectory(at: URL(fileURLWithPath: "./codesigning/"), includingPropertiesForKeys: nil, options: [])
+
+guard let rawTeamIdEnv = getenv("IOS_DEVELOPMENT_TEAM") else {
+ print("Please add a IOS_DEVELOPMENT_TEAM environment variable.")
+ exit(1)
+}
+
+let teamId2 = String(utf8String: rawTeamIdEnv)
+
+for file in contentsOfCurrentWorkingDirectory {
+ if (file.pathExtension == "template") {
+ var content = ""
+ do {
+ content = try String(contentsOf: file, encoding: .utf8)
+ }
+ catch {
+ print("Error reading xcent file: \(error).")
+ }
+
+ content = content.replacingOccurrences(of: "$TEAM_ID", with: teamId2!)
+
+ var targetFile = file
+ targetFile.deletePathExtension()
+ do {
+ try content.write(to: targetFile, atomically: false, encoding: .utf8)
+ print("Entitlement " + targetFile.absoluteString + " generated.")
+ }
+ catch {
+ print("Error writing xcent file: \(error).")
+ }
+ }
+} \ No newline at end of file
diff --git a/render-test/ios/codesigning/libXCTestSwiftSupport.dylib.xcent.template b/render-test/ios/codesigning/libXCTestSwiftSupport.dylib.xcent.template
new file mode 100644
index 0000000000..c2138e492f
--- /dev/null
+++ b/render-test/ios/codesigning/libXCTestSwiftSupport.dylib.xcent.template
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>application-identifier</key>
+ <string>$TEAM_ID.com.mapbox.RenderTestAppTests</string>
+ <key>com.apple.developer.team-identifier</key>
+ <string>$TEAM_ID</string>
+ <key>get-task-allow</key>
+ <true/>
+ <key>keychain-access-groups</key>
+ <array>
+ <string>$TEAM_ID.com.mapbox.RenderTestAppTests</string>
+ </array>
+</dict>
+</plist> \ No newline at end of file
diff --git a/render-test/ios/fastlane/Appfile b/render-test/ios/fastlane/Appfile
new file mode 100644
index 0000000000..b9fbc62d2b
--- /dev/null
+++ b/render-test/ios/fastlane/Appfile
@@ -0,0 +1,3 @@
+app_identifier("com.mapbox.RenderTestApp") # The bundle identifier of your app
+apple_id ENV['MAPBOX_APPLE_ID']
+team_id ENV['MAPBOX_APPLE_TEAM_ID'] # Developer Portal Team ID \ No newline at end of file
diff --git a/render-test/ios/fastlane/Matchfile b/render-test/ios/fastlane/Matchfile
new file mode 100644
index 0000000000..c5c76e4c0d
--- /dev/null
+++ b/render-test/ios/fastlane/Matchfile
@@ -0,0 +1,5 @@
+git_url("git@github.com:mapbox/apple-certificates.git")
+type("development") # The default type, can be: appstore, adhoc, enterprise or development
+app_identifier(["com.mapbox.RenderTestApp", "com.mapbox.RenderTestAppTests"])
+username("applemachine@mapbox.com")
+keychain_name("fastlane_keychain") \ No newline at end of file
diff --git a/render-test/ios/fastlane/README.md b/render-test/ios/fastlane/README.md
new file mode 100644
index 0000000000..29cbacab75
--- /dev/null
+++ b/render-test/ios/fastlane/README.md
@@ -0,0 +1,44 @@
+fastlane documentation
+================
+# Installation
+
+Make sure you have the latest version of the Xcode command line tools installed:
+
+```
+xcode-select --install
+```
+
+Install _fastlane_ using
+```
+[sudo] gem install fastlane -NV
+```
+or alternatively using `brew cask install fastlane`
+
+# Available Actions
+## iOS
+### ios ios_build
+```
+fastlane ios ios_build
+```
+Description of what the lane does
+### ios gym_build
+```
+fastlane ios gym_build
+```
+Description of what the lane does
+### ios xcode_build
+```
+fastlane ios xcode_build
+```
+Description of what the lane does
+### ios ci_build
+```
+fastlane ios ci_build
+```
+Description of what the lane does
+
+----
+
+This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run.
+More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
+The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
diff --git a/render-test/ios/iosTestRunner.h b/render-test/ios/iosTestRunner.h
index 768a20a91e..a674c6d678 100644
--- a/render-test/ios/iosTestRunner.h
+++ b/render-test/ios/iosTestRunner.h
@@ -1,5 +1,5 @@
#import <Foundation/Foundation.h>
-
+__attribute__((visibility ("default")))
@interface IosTestRunner : NSObject
@end
diff --git a/render-test/ios/iosTestRunner.mm b/render-test/ios/iosTestRunner.mm
index 9326602bef..50531c0870 100644
--- a/render-test/ios/iosTestRunner.mm
+++ b/render-test/ios/iosTestRunner.mm
@@ -1,13 +1,15 @@
#import "iosTestRunner.h"
-#import "ios_test_runner.hpp"
+#include "ios_test_runner.hpp"
#include <string>
@interface IosTestRunner ()
-{
- TestRunner* runner;
-}
+
+@property (nullable) TestRunner* runner;
+
+@property (copy, nullable) NSString *resultPath;
+
@end
@implementation IosTestRunner
@@ -16,19 +18,77 @@
{
self = [super init];
if (self) {
- runner = new TestRunner();
- NSString *path = [[NSBundle mainBundle] pathForResource:@"mac-manifest" ofType:@"json"];
+ self.runner = new TestRunner();
+ NSString *path = nil;
+ NSError *error;
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ NSString *bundleRoot = [[NSBundle mainBundle] bundlePath];
+ NSArray *bundleContents = [fileManager contentsOfDirectoryAtPath: bundleRoot error: &error];
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+ NSString *documentsDir = [paths objectAtIndex: 0];
-// NSString * path1 = [[NSBundle mainBundle] pathForResource:@"package-lock" ofType:@"json" inDirectory:@"integration"];
- NSString *path1 = [[NSBundle mainBundle] bundlePath];
- (void)path1;
-// NSURL *url = [NSURL fileURLWithPath:path];
- std::string manifest = std::string([path UTF8String]);
- runner->startTest(manifest);
- delete runner;
- runner = nullptr;
+ for (uint32_t i = 0; i < bundleContents.count; i++) {
+ NSString *dirName = [bundleContents objectAtIndex: i];
+ if ([dirName isEqualToString:@"test-data"]) {
+ NSString *destinationPath = [documentsDir stringByAppendingPathComponent: dirName];
+ //Using NSFileManager we can perform many file system operations.
+ BOOL success = [fileManager fileExistsAtPath: destinationPath];
+ if (success) {
+ success = [fileManager removeItemAtPath:destinationPath error:NULL];
+ }
+ break;
+ }
+ }
+
+ for (uint32_t i = 0; i < bundleContents.count; i++) {
+ NSString *dirName = [bundleContents objectAtIndex: i];
+ if ([dirName isEqualToString:@"test-data"]) {
+ NSString *destinationPath = [documentsDir stringByAppendingPathComponent: dirName];
+ BOOL success = [fileManager fileExistsAtPath: destinationPath];
+ if (!success) {
+ NSString *copyDirPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: dirName];
+
+ success = [fileManager copyItemAtPath: copyDirPath toPath: destinationPath error: &error];
+
+ if (!success){
+ NSAssert1(0, @"Failed to copy file '%@'.", [error localizedDescription]);
+ NSLog(@"Failed to copy %@ file, error %@", dirName, [error localizedDescription]);
+
+ }
+ else {
+ path = destinationPath;
+ NSLog(@"File copied %@ OK", dirName);
+ }
+ }
+ else {
+ NSLog(@"File exits %@, skip copy", dirName);
+ }
+ break;
+ }
+ }
+ if (path) {
+ NSString *manifestPath = [path stringByAppendingPathComponent:@"/next-ios-render-test-runner-style.json"];
+
+ std::string manifest = std::string([manifestPath UTF8String]);
+
+ self.runner->startTest(manifest);
+
+ self.resultPath = [path stringByAppendingPathComponent:@"/next-ios-render-test-runner-style.html"];
+
+ BOOL success = [fileManager fileExistsAtPath: self.resultPath];
+ if (!success) {
+ NSLog(@"File doese not exit %@", self.resultPath);
+ }
+ }
+
+ delete self.runner;
+ self.runner = nullptr;
}
return self;
}
+- (NSString*) getResultPath {
+
+ return self.resultPath;
+}
@end
diff --git a/render-test/ios/ios_test_runner.cpp b/render-test/ios/ios_test_runner.cpp
index f2184fdf72..53c66a5a13 100644
--- a/render-test/ios/ios_test_runner.cpp
+++ b/render-test/ios/ios_test_runner.cpp
@@ -1,10 +1,3 @@
-//
-// ios_test_runner.cpp
-// RenderTestAPP
-//
-// Created by Miao Zhao on 12/11/19.
-//
-
#include "ios_test_runner.hpp"
#include <mbgl/render_test.hpp>
@@ -13,6 +6,9 @@
#include <vector>
+#define EXPORT __attribute__((visibility("default")))
+
+EXPORT
void TestRunner::startTest(const std::string& manifest) {
auto runTestWithManifest = [](const std::string& manifest) -> bool {
diff --git a/render-test/ios/ios_test_runner.hpp b/render-test/ios/ios_test_runner.hpp
index 8d721a4eeb..a2cd12d797 100644
--- a/render-test/ios/ios_test_runner.hpp
+++ b/render-test/ios/ios_test_runner.hpp
@@ -1,10 +1,3 @@
-//
-// ios_test_runner.hpp
-// RenderTestAPP
-//
-// Created by Miao Zhao on 12/11/19.
-//
-
#ifndef ios_test_runner_hpp
#define ios_test_runner_hpp
diff --git a/render-test/ios/main.m b/render-test/ios/main.m
index 9aa3af5003..f813c8fea9 100644
--- a/render-test/ios/main.m
+++ b/render-test/ios/main.m
@@ -1,5 +1,3 @@
-// UIApplicationMain()
-
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@@ -8,4 +6,4 @@ int main(int argc, char * argv[])
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
-} \ No newline at end of file
+}
diff --git a/render-test/ios/setup_test_data.sh b/render-test/ios/setup_test_data.sh
new file mode 100755
index 0000000000..10bd0f0e41
--- /dev/null
+++ b/render-test/ios/setup_test_data.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+rm -rf ../../test-data
+mkdir ../../test-data
+mkdir ../../test-data/integration
+
+cp -r ../../mapbox-gl-js/test/integration/render-tests ../../test-data/integration/
+cp -r ../../mapbox-gl-js/test/integration/query-tests ../../test-data/integration/
+cp -r ../../metrics/expectations ../../test-data/
+cp -r ../../metrics/ignores ../../test-data/
+# cp -r ../../metrics/tests/
+# cp -r ../../metrics/next-android-render-test-runner/
+cp -r ../../metrics/next-ios-render-test-runner-style.json ../../test-data/
+cp -r ../../metrics/cache-metrics.db ../../test-data/
+cp -r ../../metrics/cache-style.db ../../test-data/ \ No newline at end of file
diff --git a/render-test/ios/tests/Info.plist b/render-test/ios/tests/Info.plist
new file mode 100644
index 0000000000..aa599858d6
--- /dev/null
+++ b/render-test/ios/tests/Info.plist
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>RenderTestAppTests</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.mapbox.RenderTestAppTests</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>1.0</string>
+ <key>CFBundleName</key>
+ <string>RenderTestAppTests</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+</dict>
+</plist>
diff --git a/render-test/ios/tests/Tests.m b/render-test/ios/tests/Tests.m
new file mode 100644
index 0000000000..936939f165
--- /dev/null
+++ b/render-test/ios/tests/Tests.m
@@ -0,0 +1,50 @@
+#import <XCTest/XCTest.h>
+#import "iosTestRunner.h"
+@interface Tests : XCTestCase
+
+@end
+
+@implementation Tests
+
+- (void)setUp {
+ // Put setup code here. This method is called before the invocation of each test method in the class.
+
+ // In UI tests it is usually best to stop immediately when a failure occurs.
+ [super setUp];
+
+ // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
+}
+
+- (void)tearDown {
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
+ [super tearDown];
+}
+
+- (void)testExample {
+ // UI tests must launch the application that they test.
+ IosTestRunner* runner = [[IosTestRunner alloc] init];
+ XCTAssert(runner);
+ XCTAttachment *attachment = [XCTAttachment attachmentWithString:@"Hello"];
+ XCTAssert(attachment);
+ attachment.lifetime = XCTAttachmentLifetimeKeepAlways;
+ [self addAttachment:attachment];
+
+ NSString* result = [runner getResultPath];
+ XCTAssert(result);
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ BOOL success = [fileManager fileExistsAtPath: result];
+ if (!success) {
+ NSLog(@"File doese not exit %@", result);
+ }
+ NSURL *url = [NSURL fileURLWithPath:result];
+
+ XCTAttachment *attachmentURL = [XCTAttachment attachmentWithContentsOfFileAtURL: url];
+ XCTAssert(attachmentURL);
+ attachmentURL.lifetime = XCTAttachmentLifetimeKeepAlways;
+ [self addAttachment:attachmentURL];
+
+ // Use recording to get started writing UI tests.
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
+}
+
+@end
diff --git a/render-test/runner.cpp b/render-test/runner.cpp
index cbfb0c34be..b0fdcc386b 100644
--- a/render-test/runner.cpp
+++ b/render-test/runner.cpp
@@ -666,7 +666,7 @@ uint32_t getImageTileOffset(const std::set<uint32_t>& dims, uint32_t dim) {
assert(false);
return 0;
}
- return std::distance(dims.begin(), it) * kTileSizeUint;
+ return static_cast<uint32_t>(std::distance(dims.begin(), it)) * kTileSizeUint;
}
} // namespace