Add C++ Unit Tests for Android (#2563)

This commit is contained in:
Bart Louwers
2024-07-04 01:16:29 +03:00
committed by GitHub
parent 61c3b280ba
commit 5d5bd84d95
14 changed files with 117 additions and 50 deletions

View File

@@ -3,18 +3,21 @@ apply plugin: 'com.android.application'
android {
namespace "android.app"
compileSdkVersion 33
buildFeatures {
prefab true
}
defaultConfig {
applicationId = 'com.mapbox.mapboxsdk.maps.test_runner'
applicationId = 'org.maplibre.cpp_test_runner'
minSdkVersion 28
targetSdkVersion 33
compileSdk 34
def abi = 'all'
if (project.hasProperty('mapbox.abis')) {
abi = project.getProperty('mapbox.abis')
if (project.hasProperty('maplibre.abis')) {
abi = project.getProperty('maplibre.abis')
}
ndk {
if (abi != 'all') {
if (abi != 'all' && abi != 'none') {
abiFilters abi.split(' ')
} else {
abiFilters 'armeabi-v7a', 'x86', 'arm64-v8a', 'x86_64'
@@ -22,6 +25,7 @@ android {
}
externalNativeBuild {
cmake {
arguments "-DMLN_LEGACY_RENDERER=OFF", "-DMLN_DRAWABLE_RENDERER=ON"
arguments '-DANDROID_CCACHE=ccache'
arguments '-DANDROID_STL=c++_static'
targets 'mbgl-test-runner'
@@ -34,7 +38,7 @@ android {
}
externalNativeBuild {
cmake {
version '3.10.2'
version "3.18.1+"
path '../../../CMakeLists.txt'
}
}
@@ -51,4 +55,5 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test:rules:1.5.0'
implementation 'io.github.vvb2060.ndk:curl:8.8.0'
}

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mapbox.mapboxsdk.maps.test_runner"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
@@ -15,6 +14,7 @@
android:hasCode="true">
<activity android:name="android.app.NativeActivity"
android:exported="true"
android:label="@string/app_name"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait">

View File

@@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.1'
classpath 'com.android.tools.build:gradle:8.4.1'
}
}
@@ -18,4 +18,4 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}
}

View File

@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true

View File

@@ -1,2 +1,4 @@
rootProject.name = "androidCppUnitTests"
include ':app'