diff --git a/.mason b/.mason index ace19da71..abdc13127 160000 --- a/.mason +++ b/.mason @@ -1 +1 @@ -Subproject commit ace19da711199cb0283c6243b435575fbec16a90 +Subproject commit abdc131273c3e50e42f245b1166c27de4c34c582 diff --git a/.travis.yml b/.travis.yml index 1ac66b386..e5b94a813 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,8 +25,10 @@ matrix: sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5' ] packages: [ 'gdb', 'clang-3.5', 'libstdc++-4.9-dev', 'libstdc++6', 'libllvm3.4', 'xutils-dev', 'libxxf86vm-dev', 'x11proto-xf86vidmode-dev', 'mesa-utils' ] - os: osx + osx_image: beta-xcode6.3 env: FLAVOR=osx BUILDTYPE=Debug - os: osx + osx_image: beta-xcode6.3 env: FLAVOR=ios BUILDTYPE=Release - os: linux env: FLAVOR=android ANDROID_ABI=arm-v7 BUILDTYPE=Release diff --git a/README.md b/README.md index 389f03242..625e970fa 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,15 @@ pod 'MapboxGL' #### Manually -1. Install [appledoc](http://appledoc.gentlebytes.com/appledoc/) for API docs generation. We recommend [`2.2v963`](https://github.com/tomaz/appledoc/releases/tag/v2.2-963), which currently isn't available in Homebrew. +1. Install [appledoc](http://appledoc.gentlebytes.com/appledoc/) 2.2v963 for API docs generation (only this exact version works). + + ``` + curl -L -o appledoc.zip https://github.com/tomaz/appledoc/releases/download/v2.2-963/appledoc.zip + unzip appledoc.zip + cp appledoc /usr/local/bin + cp -Rf Templates/ ~/.appledoc + ``` + 1. Run `make ipackage`. The packaging script will produce the statically-linked `libMapboxGL.a`, `MapboxGL.bundle` for resources, a `Headers` folder, and a `Docs` folder with HTML API documentation. 1. Copy the contents of `build/ios/pkg/static` into your project. It should happen automatically, but ensure that: - `Headers` is in your *Header Search Paths* (`HEADER_SEARCH_PATHS`) build setting. @@ -82,6 +90,7 @@ pod 'MapboxGL' If you want to build from source and/or contribute to development of the project, run `make iproj`, which will create and open an Xcode project which can build the entire library from source as well as an Objective-C test app. If you don't have an Apple Developer account, change the destination from "My Mac" to a simulator such as "iPhone 6" before you run and build the app. +#### Testing You can run `make itest` to run the included integration tests. Requires `gem install xcpretty`. If you want to run the tests in Xcode instead, first `make ipackage` to create a local static library version, then open `test/ios/ios-tests.xcodeproj`, and lastly `Command + U` on the `Mapbox GL Tests` application target. Target devices: iPhone 4S and above (5, 5c, 5s, 6, 6 Plus) and iPad 2 and above (3, 4, Mini, Air, Mini 2, Air 2). diff --git a/include/mbgl/platform/event.hpp b/include/mbgl/platform/event.hpp index 8cdd1d50a..c80186da2 100644 --- a/include/mbgl/platform/event.hpp +++ b/include/mbgl/platform/event.hpp @@ -29,7 +29,7 @@ enum class Event : uint8_t { ParseStyle, ParseTile, Render, - ResourceLoader, + Style, Database, HttpRequest, Sprite, @@ -47,7 +47,7 @@ MBGL_DEFINE_ENUM_CLASS(EventClass, Event, { { Event::ParseStyle, "ParseStyle" }, { Event::ParseTile, "ParseTile" }, { Event::Render, "Render" }, - { Event::ResourceLoader, "ResourceLoader" }, + { Event::Style, "Style" }, { Event::Database, "Database" }, { Event::HttpRequest, "HttpRequest" }, { Event::Sprite, "Sprite" }, diff --git a/ios/benchmark/MBXBenchViewController.mm b/ios/benchmark/MBXBenchViewController.mm index dfd3b254a..8883ebff0 100644 --- a/ios/benchmark/MBXBenchViewController.mm +++ b/ios/benchmark/MBXBenchViewController.mm @@ -33,7 +33,7 @@ [super viewDidLoad]; NSURL* url = [[NSURL alloc] initWithString:@"asset://styles/mapbox-streets-v7.json"]; - self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds accessToken:nil styleURL:url]; + self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds styleURL:url]; self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.mapView.delegate = self; self.mapView.zoomEnabled = NO; diff --git a/ios/docs/install_docs.sh b/ios/docs/install_docs.sh index 7d4bf279f..8fa768b99 100755 --- a/ios/docs/install_docs.sh +++ b/ios/docs/install_docs.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash if [ -z `which appledoc` ]; then - echo "Unable to find appledoc. Consider installing it from source or Homebrew." + echo "Unable to find appledoc. See https://github.com/mapbox/mapbox-gl-native#manually" exit 1 fi diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m index e7f400c5d..bf730af94 100644 --- a/platform/ios/MGLMapboxEvents.m +++ b/platform/ios/MGLMapboxEvents.m @@ -148,6 +148,8 @@ const NSTimeInterval MGLFlushInterval = 60; @property (atomic) NSURLSession *session; @property (atomic) NSData *digicertCert; @property (atomic) NSData *geoTrustCert; +@property (atomic) NSData *testServerCert; +@property (atomic) BOOL usesTestServer; // Main thread only @property (nonatomic) CLLocationManager *locationManager; @@ -239,6 +241,10 @@ const NSTimeInterval MGLFlushInterval = 60; NSString *testURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"MGLMetricsTestServerURL"]; if (testURL != nil) { MGLMapboxEventsAPIBase = testURL; + _usesTestServer = YES; + } else { + // Explicitly Set For Clarity + _usesTestServer = NO; } _paused = YES; @@ -256,6 +262,10 @@ const NSTimeInterval MGLFlushInterval = 60; if (cerPath != nil) { _digicertCert = [NSData dataWithContentsOfFile:cerPath]; } + cerPath = [resourceBundle pathForResource:@"star_tilestream_net" ofType:@"der"]; + if (cerPath != nil) { + _testServerCert = [NSData dataWithContentsOfFile:cerPath]; + } // Events Control _eventQueue = [[NSMutableArray alloc] init]; @@ -848,7 +858,7 @@ const NSTimeInterval MGLFlushInterval = 60; // Look for a pinned certificate in the server's certificate chain long numKeys = SecTrustGetCertificateCount(serverTrust); - BOOL found = false; + BOOL found = NO; // Try GeoTrust Cert First for (int lc = 0; lc < numKeys; lc++) { SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc); @@ -858,7 +868,7 @@ const NSTimeInterval MGLFlushInterval = 60; if ([remoteCertificateData isEqualToData:_geoTrustCert]) { // Found the certificate; continue connecting completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); - found = true; + found = YES; break; } } @@ -873,11 +883,27 @@ const NSTimeInterval MGLFlushInterval = 60; if ([remoteCertificateData isEqualToData:_digicertCert]) { // Found the certificate; continue connecting completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); - found = true; + found = YES; break; } } + if (!found && _usesTestServer) { + // See if this is test server + for (int lc = 0; lc < numKeys; lc++) { + SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc); + NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate)); + + // Compare Remote Key With Local Version + if ([remoteCertificateData isEqualToData:_testServerCert]) { + // Found the certificate; continue connecting + completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); + found = YES; + break; + } + } + } + if (!found) { // The certificate wasn't found in GeoTrust nor Digicert. Cancel the connection. completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]); diff --git a/platform/ios/resources/star_tilestream_net.der b/platform/ios/resources/star_tilestream_net.der new file mode 100644 index 000000000..e302cd768 Binary files /dev/null and b/platform/ios/resources/star_tilestream_net.der differ diff --git a/scripts/ios/install.sh b/scripts/ios/install.sh index ffa714f36..da081254f 100755 --- a/scripts/ios/install.sh +++ b/scripts/ios/install.sh @@ -15,4 +15,10 @@ brew install git mapbox_time "install_awscli" \ brew install awscli +mapbox_time "install_appledoc" \ +wget https://github.com/tomaz/appledoc/releases/download/v2.2-963/appledoc.zip && \ +tar xvzf appledoc.zip && \ +cp appledoc /usr/local/bin && \ +cp -Rf Templates/ ~/.appledoc + mkdir -p ${KIF_SCREENSHOTS} diff --git a/scripts/ios/package.sh b/scripts/ios/package.sh index 35162ce5d..e4bba0e9f 100755 --- a/scripts/ios/package.sh +++ b/scripts/ios/package.sh @@ -98,7 +98,7 @@ cp -prv styles/styles "${OUTPUT}/static/${NAME}.bundle/styles" step "Creating API Docs..." if [ -z `which appledoc` ]; then - echo "Unable to find appledoc. Consider installing it from source or Homebrew." + echo "Unable to find appledoc. See https://github.com/mapbox/mapbox-gl-native#manually" exit 1 fi DOCS_OUTPUT="${OUTPUT}/static/Docs" diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp index c8948097f..a834f5065 100644 --- a/src/mbgl/map/map_context.cpp +++ b/src/mbgl/map/map_context.cpp @@ -2,19 +2,12 @@ #include #include #include -#include #include #include #include -#include - -#include -#include -#include - #include #include @@ -34,10 +27,6 @@ MapContext::MapContext(uv_loop_t* loop, View& view_, FileSource& fileSource, Map envScope(env, ThreadType::Map, "Map"), updated(static_cast(Update::Nothing)), asyncUpdate(std::make_unique(loop, [this] { update(); })), - glyphStore(std::make_unique(loop, env)), - glyphAtlas(std::make_unique(1024, 1024)), - spriteAtlas(std::make_unique(512, 512)), - lineAtlas(std::make_unique(512, 512)), texturePool(std::make_unique()) { assert(Environment::currentlyOn(ThreadType::Map)); @@ -51,14 +40,9 @@ MapContext::~MapContext() { // Explicit resets currently necessary because these abandon resources that need to be // cleaned up by env.performCleanup(); - resourceLoader.reset(); style.reset(); painter.reset(); texturePool.reset(); - lineAtlas.reset(); - spriteAtlas.reset(); - glyphAtlas.reset(); - glyphStore.reset(); env.performCleanup(); @@ -116,21 +100,11 @@ void MapContext::setStyleJSON(const std::string& json, const std::string& base) void MapContext::loadStyleJSON(const std::string& json, const std::string& base) { assert(Environment::currentlyOn(ThreadType::Map)); - resourceLoader.reset(); style.reset(); - - style = std::make_unique