summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobrun <tobrun.van.nuland@gmail.com>2019-05-28 18:24:14 +0200
committerTobrun <tobrun.van.nuland@gmail.com>2019-05-29 11:51:39 +0200
commitff980010d71fed4e7787f32e50da86d0d4db45cb (patch)
treea6890407fa1c1d342b8f66b499481cd3588b6f0d
parentb50aa497cc96e0572adf4b1f2b9fd9a145b3d4f4 (diff)
downloadqtlocation-mapboxgl-ff980010d71fed4e7787f32e50da86d0d4db45cb.tar.gz
[android] - move example custom layer compilation to testapp
-rw-r--r--platform/android/MapboxGLAndroidSDK/build.gradle4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/build.gradle65
2 files changed, 65 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle
index 510dc79d43..7909148ff4 100644
--- a/platform/android/MapboxGLAndroidSDK/build.gradle
+++ b/platform/android/MapboxGLAndroidSDK/build.gradle
@@ -89,10 +89,6 @@ android {
targets "mapbox-gl"
- if (defaultPublishConfig.equalsIgnoreCase("debug")) {
- targets "example-custom-layer"
- }
-
if (project.hasProperty("mapbox.with_test")) {
targets "mbgl-test"
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle
index 190c279e03..827f568540 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle
+++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle
@@ -17,6 +17,71 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
+ defaultPublishConfig project.hasProperty("mapbox.buildtype") ? project.getProperty("mapbox.buildtype") : "debug"
+
+ // We sometimes want to invoke Gradle without building a native dependency, e.g. when we just want
+ // to invoke the Java tests. When we explicitly specify an ABI of 'none', no native dependencies are
+ // added. When another ABI is specified explicitly, we're just going to build that ABI. In all other
+ // cases, all ABIs are built.
+ //
+ // When invoking from the command line or to override the device default, set `-Pmapbox.abis=...` to
+ // only build the desired architectures.
+ //
+ // When building from Android Studio, gradle.properties sets `android.buildOnlyTargetAbi=true` so that
+ // only the architecture for the device you're running on gets built.
+ def abi = 'all'
+ if (!project.hasProperty('android.injected.invoked.from.ide') || project.hasProperty("mapbox.abis")) {
+ // Errors when the user invokes Gradle from the command line and didn't set mapbox.abis
+ abi = project.getProperty("mapbox.abis")
+ }
+
+ if (abi != 'none') {
+ externalNativeBuild {
+ cmake {
+ path "../../../CMakeLists.txt"
+ version "3.10.2"
+ }
+ }
+ }
+
+ // Allow determining the C++ STL we're using when building Mapbox GL.
+ def stl = 'c++_static'
+ if (project.hasProperty("mapbox.stl")) {
+ stl = project.getProperty("mapbox.stl")
+ }
+
+ defaultConfig {
+ if (abi != 'none') {
+ externalNativeBuild {
+ cmake {
+ arguments "-DANDROID_TOOLCHAIN=clang"
+ arguments "-DANDROID_STL=" + stl
+ arguments "-DANDROID_CPP_FEATURES=exceptions"
+ arguments "-DMBGL_PLATFORM=android"
+ arguments "-DMASON_PLATFORM=android"
+ arguments "-DNodeJS_EXECUTABLE=" + node
+ arguments "-Dnpm_EXECUTABLE=" + npm
+
+ // Enable ccache if the user has installed it.
+ if (ccache?.trim()) {
+ arguments "-DANDROID_CCACHE=" + ccache
+ }
+
+ cFlags "-Qunused-arguments"
+ cppFlags "-Qunused-arguments"
+
+ targets "example-custom-layer"
+
+ if (abi != 'all') {
+ abiFilters abi.split(' ')
+ } else {
+ abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
+ }
+ }
+ }
+ }
+ }
+
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'