From 3f784d1d1844c2ca07de17951983b95c92b201f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 8 Oct 2018 16:09:35 +0300 Subject: [PATCH 1/5] [build] use optional polyfill on Android, and upgrade to NDK r19 is not available anymore in newer STL versions, e.g. according to libc++'s TS deprecation policy: https://libcxx.llvm.org/TS_deprecation.html --- circle.yml | 8 ++++++-- platform/android/config.cmake | 1 + platform/android/gradle/dependencies.gradle | 2 +- vendor/optional.cmake | 7 +++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/circle.yml b/circle.yml index 68d17b774da..c7f2d322500 100644 --- a/circle.yml +++ b/circle.yml @@ -15,6 +15,7 @@ workflows: - android-arm-v7-template: name: android-gnustl-arm-v7 stl: gnustl_shared + image: android-ndk-r17c:1d5db0eb34 - android-release: filters: tags: @@ -519,8 +520,11 @@ jobs: stl: type: string default: "c++_static" + image: + type: string + default: android-ndk-r19:8e91a7ebab docker: - - image: mbgl/android-ndk-r17c:dd161efed6 + - image: mbgl/<< parameters.image >> resource_class: large working_directory: /src environment: @@ -582,7 +586,7 @@ jobs: # ------------------------------------------------------------------------------ android-release: docker: - - image: mbgl/android-ndk-r17c:dd161efed6 + - image: mbgl/android-ndk-r19:8e91a7ebab resource_class: large working_directory: /src environment: diff --git a/platform/android/config.cmake b/platform/android/config.cmake index d0d2c42eb61..50f1449a9eb 100644 --- a/platform/android/config.cmake +++ b/platform/android/config.cmake @@ -139,6 +139,7 @@ target_include_directories(example-custom-layer ) target_link_libraries(example-custom-layer + PRIVATE optional PRIVATE -llog PRIVATE -lGLESv2 ) diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index ae63b46a2a8..664d79ca908 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -4,7 +4,7 @@ ext { minSdkVersion : 14, targetSdkVersion : 27, compileSdkVersion: 27, - buildToolsVersion: '27.0.3' + buildToolsVersion: '28.0.3' ] versions = [ diff --git a/vendor/optional.cmake b/vendor/optional.cmake index 157ccc991df..fa299da6a64 100644 --- a/vendor/optional.cmake +++ b/vendor/optional.cmake @@ -1,9 +1,8 @@ add_library(optional INTERFACE) -# This polyfill is really only needed for -# Windows. We need to be careful to not leak -# it into any of our public interfaces. -if(WIN32) +# This polyfill is needed for Windows and Android since these standard libraries don't ship with +# usable versions of +if(WIN32 OR MBGL_PLATFORM STREQUAL "android") target_include_directories(optional SYSTEM INTERFACE ${CMAKE_SOURCE_DIR}/vendor/optional/include ) From ef0885dbea593c9bbcf8a18886f60fe66092c53b Mon Sep 17 00:00:00 2001 From: tobrun Date: Mon, 21 Jan 2019 09:16:13 +0100 Subject: [PATCH 2/5] [android] - update tooling of project and upstream dependencies --- platform/android/MapboxGLAndroidSDK/build.gradle | 1 - platform/android/MapboxGLAndroidSDKTestApp/build.gradle | 1 - platform/android/build.gradle | 2 +- platform/android/gradle/dependencies.gradle | 3 +-- platform/android/gradle/wrapper/gradle-wrapper.properties | 4 ++-- platform/android/vendor/mapbox-events-android | 2 +- platform/android/vendor/mapbox-gestures-android | 2 +- platform/android/vendor/mapbox-java | 2 +- 8 files changed, 7 insertions(+), 10 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 25008de9193..724242e35f7 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -22,7 +22,6 @@ dependencies { android { compileSdkVersion androidVersions.compileSdkVersion - buildToolsVersion androidVersions.buildToolsVersion defaultConfig { minSdkVersion androidVersions.minSdkVersion diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index a2a8bee22b4..386361520dd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' android { compileSdkVersion androidVersions.compileSdkVersion - buildToolsVersion androidVersions.buildToolsVersion defaultConfig { applicationId "com.mapbox.mapboxsdk.testapp" diff --git a/platform/android/build.gradle b/platform/android/build.gradle index b932188e77a..f1d88e3dc60 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.4' + classpath 'com.android.tools.build:gradle:3.3.0' classpath dependenciesList.licensesPlugin classpath dependenciesList.kotlinPlugin } diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 664d79ca908..1a55f1ee550 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -4,7 +4,6 @@ ext { minSdkVersion : 14, targetSdkVersion : 27, compileSdkVersion: 27, - buildToolsVersion: '28.0.3' ] versions = [ @@ -19,7 +18,7 @@ ext { robolectric : '3.8', timber : '4.7.1', okhttp : '3.11.0', - kotlin : '1.2.51', + kotlin : '1.3.11', licenses : '0.8.41', lint : '26.1.3', gms : '16.0.0' diff --git a/platform/android/gradle/wrapper/gradle-wrapper.properties b/platform/android/gradle/wrapper/gradle-wrapper.properties index 84af82d181a..ff890c23491 100644 --- a/platform/android/gradle/wrapper/gradle-wrapper.properties +++ b/platform/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon May 14 12:12:39 CEST 2018 +#Sun Jan 20 13:53:14 CET 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip diff --git a/platform/android/vendor/mapbox-events-android b/platform/android/vendor/mapbox-events-android index 1e733ba20b9..20c31407f25 160000 --- a/platform/android/vendor/mapbox-events-android +++ b/platform/android/vendor/mapbox-events-android @@ -1 +1 @@ -Subproject commit 1e733ba20b9f0e5c2ec4ab624b84f87eaa5b9a84 +Subproject commit 20c31407f259961db0602137a52f33ba5e580dde diff --git a/platform/android/vendor/mapbox-gestures-android b/platform/android/vendor/mapbox-gestures-android index 796b778043d..9d105dce2a4 160000 --- a/platform/android/vendor/mapbox-gestures-android +++ b/platform/android/vendor/mapbox-gestures-android @@ -1 +1 @@ -Subproject commit 796b778043d026eada8f6f02ba393db2d3b0027b +Subproject commit 9d105dce2a495d1605fbab75829d33278ae7318b diff --git a/platform/android/vendor/mapbox-java b/platform/android/vendor/mapbox-java index 0791fa4f00e..22a324ffc37 160000 --- a/platform/android/vendor/mapbox-java +++ b/platform/android/vendor/mapbox-java @@ -1 +1 @@ -Subproject commit 0791fa4f00efac2e3f9f95ed061b248580e9cf34 +Subproject commit 22a324ffc37389cebee20aa49e83c08c13221a98 From db03f01b7f41c77dc0a848850ce0ac43ff2bbdfc Mon Sep 17 00:00:00 2001 From: tobrun Date: Mon, 21 Jan 2019 12:15:19 +0100 Subject: [PATCH 3/5] [android] - ignore lint complaints about array min size --- .../com/mapbox/mapboxsdk/style/expressions/Expression.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java index d50dce9ca65..25ff8194707 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/expressions/Expression.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.style.expressions; +import android.annotation.SuppressLint; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -1826,6 +1827,7 @@ public static Expression sum(@Size(min = 2) Expression... numbers) { * @return expression * @see Style specification */ + @SuppressLint("Range") public static Expression sum(@Size(min = 2) Number... numbers) { Expression[] numberExpression = new Expression[numbers.length]; for (int i = 0; i < numbers.length; i++) { @@ -1874,6 +1876,7 @@ public static Expression product(@Size(min = 2) Expression... numbers) { * @return expression * @see Style specification */ + @SuppressLint("Range") public static Expression product(@Size(min = 2) Number... numbers) { Expression[] numberExpression = new Expression[numbers.length]; for (int i = 0; i < numbers.length; i++) { @@ -2590,6 +2593,7 @@ public static Expression min(@Size(min = 1) Expression... numbers) { * @return expression * @see Style specification */ + @SuppressLint("Range") public static Expression min(@Size(min = 1) Number... numbers) { Expression[] numberExpression = new Expression[numbers.length]; for (int i = 0; i < numbers.length; i++) { @@ -2638,6 +2642,7 @@ public static Expression max(@Size(min = 1) Expression... numbers) { * @return expression * @see Style specification */ + @SuppressLint("Range") public static Expression max(@Size(min = 1) Number... numbers) { Expression[] numberExpression = new Expression[numbers.length]; for (int i = 0; i < numbers.length; i++) { From a4c6d7a89e841d180b860d75846d6d36b6334ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 21 Jan 2019 13:10:05 +0100 Subject: [PATCH 4/5] [build] upgrade minimum CMake version --- CMakeLists.txt | 2 +- platform/android/MapboxGLAndroidSDK/build.gradle | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0b1fec60ba..bf7cc6465e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.9) project(mbgl LANGUAGES CXX C) set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo Sanitize) diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 724242e35f7..e38d61923f7 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -55,6 +55,7 @@ android { externalNativeBuild { cmake { path "../../../CMakeLists.txt" + version "3.10.2" } } } From fe320585720c2458f7760a4d1775e3ae618f6abf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Mon, 21 Jan 2019 15:45:34 +0100 Subject: [PATCH 5/5] =?UTF-8?q?[build]=20don't=20explicitly=20add=20-lstdc?= =?UTF-8?q?++=20for=20Android=20=F0=9F=98=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/android/config.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/platform/android/config.cmake b/platform/android/config.cmake index 50f1449a9eb..dd75bb3b5b1 100644 --- a/platform/android/config.cmake +++ b/platform/android/config.cmake @@ -49,7 +49,6 @@ macro(mbgl_platform_core) PUBLIC -ljnigraphics PUBLIC -lEGL PUBLIC -lGLESv2 - PUBLIC -lstdc++ PUBLIC -latomic PUBLIC -lz ) @@ -65,7 +64,6 @@ macro(mbgl_filesource) PUBLIC jni.hpp PUBLIC -llog PUBLIC -landroid - PUBLIC -lstdc++ PUBLIC -latomic ) endmacro()