160 lines
4.3 KiB
Groovy
160 lines
4.3 KiB
Groovy
import org.jetbrains.dokka.gradle.DokkaTask
|
|
|
|
plugins {
|
|
alias libs.plugins.kotlinter
|
|
alias libs.plugins.dokka
|
|
}
|
|
|
|
apply plugin: 'com.android.library'
|
|
apply plugin: "com.jaredsburrows.license"
|
|
apply plugin: 'kotlin-android'
|
|
apply from: "${rootDir}/gradle/native-build.gradle"
|
|
|
|
dependencies {
|
|
lintChecks project(":MapLibreAndroidLint")
|
|
api libs.maplibreJavaGeoJSON
|
|
api libs.maplibreGestures
|
|
|
|
implementation libs.maplibreJavaTurf
|
|
implementation libs.supportAnnotations
|
|
implementation libs.supportFragmentV4
|
|
implementation libs.okhttp3
|
|
implementation libs.timber
|
|
implementation libs.interpolator
|
|
|
|
testImplementation libs.junit
|
|
testImplementation libs.mockito
|
|
testImplementation libs.mockk
|
|
testImplementation libs.robolectric
|
|
testImplementation libs.commonsIO
|
|
testImplementation libs.assertjcore
|
|
|
|
androidTestImplementation libs.testRunner
|
|
androidTestImplementation libs.testRules
|
|
}
|
|
|
|
tasks.withType(DokkaTask.class) {
|
|
moduleName.set("MapLibre Native Android")
|
|
|
|
dokkaSourceSets {
|
|
configureEach {
|
|
includes.from("Module.md")
|
|
}
|
|
}
|
|
}
|
|
|
|
android {
|
|
defaultConfig {
|
|
compileSdk 34
|
|
minSdkVersion 21
|
|
targetSdkVersion 33
|
|
buildConfigField "String", "GIT_REVISION_SHORT", String.format("\"%s\"", getGitRevision())
|
|
buildConfigField "String", "GIT_REVISION", String.format("\"%s\"", getGitRevision(false))
|
|
buildConfigField "String", "MAPLIBRE_VERSION_STRING", String.format("\"MapLibre Native/%s\"", project.VERSION_NAME)
|
|
consumerProguardFiles 'proguard-rules.pro'
|
|
|
|
externalNativeBuild {
|
|
cmake {
|
|
arguments "-DMLN_LEGACY_RENDERER=ON", "-DMLN_DRAWABLE_RENDERER=OFF"
|
|
}
|
|
}
|
|
}
|
|
|
|
flavorDimensions += "renderer"
|
|
productFlavors {
|
|
create("legacy") {
|
|
dimension = "renderer"
|
|
externalNativeBuild {
|
|
cmake {
|
|
arguments "-DMLN_LEGACY_RENDERER=ON", "-DMLN_DRAWABLE_RENDERER=OFF"
|
|
}
|
|
}
|
|
}
|
|
create("drawable") {
|
|
dimension = "renderer"
|
|
externalNativeBuild {
|
|
cmake {
|
|
arguments "-DMLN_LEGACY_RENDERER=OFF", "-DMLN_DRAWABLE_RENDERER=ON"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// build native libraries
|
|
List nativeTargets = ["maplibre"]
|
|
if (project.hasProperty("mapbox.with_test")) {
|
|
nativeTargets.add("mbgl-test")
|
|
}
|
|
if (project.hasProperty("mapbox.with_benchmark")) {
|
|
nativeTargets.add("mbgl-benchmark")
|
|
}
|
|
nativeBuild(nativeTargets)
|
|
|
|
// avoid naming conflicts, force usage of prefix
|
|
resourcePrefix 'maplibre_'
|
|
|
|
sourceSets {
|
|
// limit amount of exposed library resources
|
|
main.res.srcDirs += 'src/main/res-public'
|
|
}
|
|
|
|
|
|
testOptions {
|
|
unitTests {
|
|
returnDefaultValues true
|
|
|
|
// Roboelectric 4.0 required config
|
|
// http://robolectric.org/migrating/#migrating-to-40
|
|
includeAndroidResources = true
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
testCoverageEnabled false
|
|
jniDebuggable true
|
|
debuggable true
|
|
}
|
|
}
|
|
namespace 'org.maplibre.android'
|
|
lint {
|
|
checkAllWarnings true
|
|
disable 'MissingTranslation', 'TypographyQuotes', 'ObsoleteLintCustomCheck', 'MissingPermission', 'WrongThreadInterprocedural'
|
|
warningsAsErrors false
|
|
}
|
|
|
|
buildFeatures {
|
|
buildConfig true
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain(17)
|
|
}
|
|
|
|
licenseReport {
|
|
generateHtmlReport = false
|
|
generateJsonReport = true
|
|
copyHtmlReportToAssets = false
|
|
copyJsonReportToAssets = false
|
|
}
|
|
|
|
def static getGitRevision(shortRev = true) {
|
|
def cmd = shortRev ? "git rev-parse --short HEAD" : "git rev-parse HEAD"
|
|
def proc = cmd.execute()
|
|
def ref = proc.text.trim()
|
|
return ref
|
|
}
|
|
|
|
configurations {
|
|
all*.exclude group: 'commons-logging', module: 'commons-logging'
|
|
all*.exclude group: 'commons-collections', module: 'commons-collections'
|
|
}
|
|
|
|
apply from: "${rootDir}/gradle/gradle-checkstyle.gradle"
|
|
apply from: "${rootDir}/gradle/gradle-dependencies-graph.gradle"
|
|
apply from: "${rootDir}/gradle/android-nitpick.gradle"
|
|
apply from: "${rootDir}/gradle/gradle-publish.gradle"
|
|
// intentionally disabled
|
|
// apply from: "${rootDir}/gradle/jacoco-report.gradle"
|