Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from mapbox/master
Browse files Browse the repository at this point in the history
Merge Master
  • Loading branch information
TimWatson authored Apr 3, 2019
2 parents ba2b7a7 + 0f416fb commit 0ff2506
Show file tree
Hide file tree
Showing 402 changed files with 13,398 additions and 4,603 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,6 @@
[submodule "platform/darwin/docs/theme"]
path = platform/darwin/docs/theme
url = https://github.com/mapbox/jazzy-theme.git
[submodule "vendor/args"]
path = vendor/args
url = https://github.com/Taywee/args
30 changes: 22 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +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)
Expand Down Expand Up @@ -55,6 +58,8 @@ default: test
BUILD_DEPS += Makefile
BUILD_DEPS += CMakeLists.txt

BUILD_DOCS ?= true

#### macOS targets ##############################################################

ifeq ($(HOST_PLATFORM), macos)
Expand Down Expand Up @@ -92,7 +97,7 @@ macos: $(MACOS_PROJ_PATH)

.PHONY: xproj
xproj: $(MACOS_PROJ_PATH)
open $(MACOS_WORK_PATH)
xed $(MACOS_WORK_PATH)

.PHONY: test
test: $(MACOS_PROJ_PATH)
Expand Down Expand Up @@ -188,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 ##############################################################
Expand Down Expand Up @@ -234,7 +238,7 @@ ios: $(IOS_PROJ_PATH)

.PHONY: iproj
iproj: $(IOS_PROJ_PATH)
open $(IOS_WORK_PATH)
xed $(IOS_WORK_PATH)

.PHONY: ios-lint
ios-lint:
Expand Down Expand Up @@ -272,7 +276,7 @@ ipackage%:

.PHONY: iframework
iframework: $(IOS_PROJ_PATH)
FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) \
FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) BUILD_DOCS=$(BUILD_DOCS) \
./platform/ios/scripts/package.sh

.PHONY: ideploy
Expand Down Expand Up @@ -380,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

Expand Down Expand Up @@ -691,6 +695,16 @@ run-android-unit-test: platform/android/gradle/configuration.gradle
run-android-unit-test-%: platform/android/gradle/configuration.gradle
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDK:testDebugUnitTest --info --tests "$*"

# Run unit test and build a coverage report from .exec file generated by unit tests and .ec file generated by instrumentation tests
.PHONY: android-create-jacoco-report
android-create-jacoco-report: platform/android/gradle/configuration.gradle
cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDK:jacocoTestReport

# Parse merged jacoco report and send it to S3
.PHONY: android-parse-and-send-jacoco-report
android-parse-and-send-jacoco-report:
python platform/android/scripts/parse-jacoco-report.py

# Builds a release package of the Android SDK
.PHONY: apackage
apackage: platform/android/gradle/configuration.gradle
Expand Down
8 changes: 3 additions & 5 deletions benchmark/api/query.benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <mbgl/renderer/renderer.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/image.hpp>
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/storage/network_status.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
Expand All @@ -21,7 +20,6 @@ class QueryBenchmark {
public:
QueryBenchmark() {
NetworkStatus::Set(NetworkStatus::Status::Offline);
fileSource.setAccessToken("foobar");

map.getStyle().loadJSON(util::read_file("benchmark/fixtures/api/style.json"));
map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan
Expand All @@ -32,11 +30,11 @@ class QueryBenchmark {
}

util::RunLoop loop;
DefaultFileSource fileSource{ "benchmark/fixtures/api/cache.db", "." };
ThreadPool threadPool{ 4 };
HeadlessFrontend frontend { { 1000, 1000 }, 1, threadPool };
Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1,
fileSource, threadPool, MapOptions().withMapMode(MapMode::Static) };
Map map { frontend, MapObserver::nullObserver(), threadPool,
MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()),
ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") };
ScreenBox box{{ 0, 0 }, { 1000, 1000 }};
};

Expand Down
49 changes: 28 additions & 21 deletions benchmark/api/render.benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <mbgl/renderer/renderer.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/image.hpp>
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/storage/resource_options.hpp>
#include <mbgl/storage/network_status.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
Expand All @@ -18,32 +18,36 @@ using namespace mbgl;

namespace {

static std::string cachePath { "benchmark/fixtures/api/cache.db" };
constexpr double pixelRatio { 1.0 };
constexpr Size size { 1000, 1000 };

class RenderBenchmark {
public:
RenderBenchmark() {
NetworkStatus::Set(NetworkStatus::Status::Offline);
fileSource.setAccessToken("foobar");
}

util::RunLoop loop;
DefaultFileSource fileSource { "benchmark/fixtures/api/cache.db", "." };
ThreadPool threadPool { 4 };
};

static void prepare(Map& map, optional<std::string> json = {}) {
map.getStyle().loadJSON(json ? *json : util::read_file("benchmark/fixtures/api/style.json"));
map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan
map.getStyle().addImage(std::make_unique<style::Image>("test-icon",
decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png")), 1.0));

auto image = decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png"));
map.getStyle().addImage(std::make_unique<style::Image>("test-icon", std::move(image), 1.0));
}

} // end namespace

static void API_renderStill_reuse_map(::benchmark::State& state) {
RenderBenchmark bench;
HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool };
Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1,
bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) };
HeadlessFrontend frontend { size, pixelRatio, bench.threadPool };
Map map { frontend, MapObserver::nullObserver(), bench.threadPool,
MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio),
ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") };
prepare(map);

while (state.KeepRunning()) {
Expand All @@ -53,9 +57,10 @@ static void API_renderStill_reuse_map(::benchmark::State& state) {

static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state) {
RenderBenchmark bench;
HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool };
Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1,
bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) };
HeadlessFrontend frontend { size, pixelRatio, bench.threadPool };
Map map { frontend, MapObserver::nullObserver(), bench.threadPool,
MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio),
ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") };
prepare(map, util::read_file("benchmark/fixtures/api/style_formatted_labels.json"));

while (state.KeepRunning()) {
Expand All @@ -65,10 +70,11 @@ static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state

static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) {
RenderBenchmark bench;
HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool };
Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1,
bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) };

HeadlessFrontend frontend { size, pixelRatio, bench.threadPool };
Map map { frontend, MapObserver::nullObserver(), bench.threadPool,
MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio),
ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") };

while (state.KeepRunning()) {
prepare(map, { "{}" });
frontend.render(map);
Expand All @@ -79,11 +85,12 @@ static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) {

static void API_renderStill_recreate_map(::benchmark::State& state) {
RenderBenchmark bench;

while (state.KeepRunning()) {
HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool };
Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1,
bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) };
HeadlessFrontend frontend { size, pixelRatio, bench.threadPool };
Map map { frontend, MapObserver::nullObserver(), bench.threadPool,
MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio),
ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") };
prepare(map);
frontend.render(map);
}
Expand Down
2 changes: 1 addition & 1 deletion bin/offline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <mbgl/storage/default_file_source.hpp>

#include <args/args.hxx>
#include <args.hxx>

#include <cstdlib>
#include <iostream>
Expand Down
14 changes: 4 additions & 10 deletions bin/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

#include <mbgl/gl/headless_frontend.hpp>
#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/style/style.hpp>

#include <args/args.hxx>
#include <args.hxx>

#include <cstdlib>
#include <iostream>
Expand Down Expand Up @@ -76,17 +75,12 @@ int main(int argc, char *argv[]) {
using namespace mbgl;

util::RunLoop loop;
DefaultFileSource fileSource(cache_file, asset_root);

// Set access token if present
if (token.size()) {
fileSource.setAccessToken(std::string(token));
}

ThreadPool threadPool(4);
HeadlessFrontend frontend({ width, height }, pixelRatio, threadPool);
Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio,
fileSource, threadPool, MapOptions().withMapMode(MapMode::Static));
Map map(frontend, MapObserver::nullObserver(), threadPool,
MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()).withPixelRatio(pixelRatio),
ResourceOptions().withCachePath(cache_file).withAssetPath(asset_root).withAccessToken(std::string(token)));

if (style.find("://") == std::string::npos) {
style = std::string("file://") + style;
Expand Down
Loading

0 comments on commit 0ff2506

Please sign in to comment.