2025-06-07 10:43:50 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2025 Meshtastic LLC
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2025-06-25 18:23:18 +00:00
|
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
2025-06-07 10:43:50 +00:00
|
|
|
import java.io.FileInputStream
|
|
|
|
import java.util.Properties
|
|
|
|
|
2022-10-04 03:12:39 +00:00
|
|
|
plugins {
|
2025-02-25 00:42:37 +00:00
|
|
|
alias(libs.plugins.android.application)
|
|
|
|
alias(libs.plugins.kotlin.android)
|
|
|
|
alias(libs.plugins.compose)
|
|
|
|
alias(libs.plugins.kotlin.parcelize)
|
|
|
|
alias(libs.plugins.kotlin.serialization)
|
|
|
|
alias(libs.plugins.hilt)
|
|
|
|
alias(libs.plugins.protobuf)
|
|
|
|
alias(libs.plugins.devtools.ksp)
|
|
|
|
alias(libs.plugins.detekt)
|
2022-10-04 03:12:39 +00:00
|
|
|
}
|
2020-09-24 02:47:45 +00:00
|
|
|
|
2025-06-07 10:43:50 +00:00
|
|
|
val keystorePropertiesFile = rootProject.file("keystore.properties")
|
|
|
|
val keystoreProperties = Properties()
|
2021-12-09 17:53:33 +00:00
|
|
|
if (keystorePropertiesFile.exists()) {
|
2025-06-07 10:43:50 +00:00
|
|
|
FileInputStream(keystorePropertiesFile).use { keystoreProperties.load(it) }
|
2021-12-09 17:53:33 +00:00
|
|
|
}
|
|
|
|
|
2020-01-20 23:53:22 +00:00
|
|
|
android {
|
2025-06-07 10:43:50 +00:00
|
|
|
namespace = "com.geeksville.mesh"
|
2023-08-27 09:38:36 +00:00
|
|
|
|
2020-07-20 19:07:55 +00:00
|
|
|
signingConfigs {
|
2025-06-07 10:43:50 +00:00
|
|
|
create("release") {
|
|
|
|
keyAlias = keystoreProperties["keyAlias"] as String?
|
|
|
|
keyPassword = keystoreProperties["keyPassword"] as String?
|
|
|
|
storeFile = keystoreProperties["storeFile"]?.let { file(it) }
|
|
|
|
storePassword = keystoreProperties["storePassword"] as String?
|
2020-07-20 19:07:55 +00:00
|
|
|
}
|
2021-12-09 17:53:33 +00:00
|
|
|
}
|
2025-06-07 10:43:50 +00:00
|
|
|
compileSdk = Configs.COMPILE_SDK
|
2020-01-20 23:53:22 +00:00
|
|
|
defaultConfig {
|
2025-06-07 10:43:50 +00:00
|
|
|
applicationId = Configs.APPLICATION_ID
|
|
|
|
minSdk = Configs.MIN_SDK_VERSION
|
|
|
|
targetSdk = Configs.TARGET_SDK
|
|
|
|
versionCode =
|
|
|
|
Configs.VERSION_CODE // format is Mmmss (where M is 1+the numeric major number)
|
|
|
|
versionName = Configs.VERSION_NAME
|
|
|
|
testInstrumentationRunner = "com.geeksville.mesh.TestRunner"
|
2025-06-04 00:58:21 +00:00
|
|
|
buildConfigField("String", "MIN_FW_VERSION", "\"${Configs.MIN_FW_VERSION}\"")
|
|
|
|
buildConfigField("String", "ABS_MIN_FW_VERSION", "\"${Configs.ABS_MIN_FW_VERSION}\"")
|
2021-01-30 06:44:55 +00:00
|
|
|
// per https://developer.android.com/studio/write/vector-asset-studio
|
|
|
|
vectorDrawables.useSupportLibrary = true
|
2020-01-20 23:53:22 +00:00
|
|
|
}
|
2025-06-07 10:43:50 +00:00
|
|
|
flavorDimensions.add("default")
|
2023-01-19 14:24:42 +00:00
|
|
|
productFlavors {
|
2025-06-07 10:43:50 +00:00
|
|
|
create("fdroid") {
|
|
|
|
dimension = "default"
|
2024-02-12 21:24:32 +00:00
|
|
|
dependenciesInfo {
|
|
|
|
includeInApk = false
|
|
|
|
}
|
2023-01-19 14:24:42 +00:00
|
|
|
}
|
2025-06-07 10:43:50 +00:00
|
|
|
create("google") {
|
|
|
|
dimension = "default"
|
2025-06-25 23:16:55 +00:00
|
|
|
// Enable Firebase Crashlytics for Google Play builds
|
|
|
|
apply(plugin = libs.plugins.google.services.get().pluginId)
|
|
|
|
apply(plugin = libs.plugins.firebase.crashlytics.get().pluginId)
|
2023-01-19 14:24:42 +00:00
|
|
|
}
|
|
|
|
}
|
2020-01-20 23:53:22 +00:00
|
|
|
buildTypes {
|
2025-06-07 10:43:50 +00:00
|
|
|
named("release") {
|
|
|
|
if (keystoreProperties["storeFile"] != null) {
|
|
|
|
signingConfig = signingConfigs.named("release").get()
|
2021-12-09 17:53:33 +00:00
|
|
|
}
|
2025-06-07 10:43:50 +00:00
|
|
|
isMinifyEnabled = true
|
|
|
|
isShrinkResources = true
|
|
|
|
proguardFiles(
|
|
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
|
|
"proguard-rules.pro"
|
|
|
|
)
|
2020-01-20 23:53:22 +00:00
|
|
|
}
|
2025-06-07 10:43:50 +00:00
|
|
|
named("debug") {
|
|
|
|
isPseudoLocalesEnabled = true
|
2020-04-11 00:25:55 +00:00
|
|
|
}
|
2020-01-20 23:53:22 +00:00
|
|
|
}
|
2020-04-11 17:21:26 +00:00
|
|
|
defaultConfig {
|
|
|
|
// We have to list all translated languages here, because some of our libs have bogus languages that google play
|
|
|
|
// doesn't like and we need to strip them (gr)
|
2025-06-07 10:43:50 +00:00
|
|
|
androidResources.localeFilters += listOf(
|
|
|
|
"bg", "ca", "cs", "de",
|
|
|
|
"el", "en", "es", "et",
|
|
|
|
"fi", "fr", "fr-rHT", "ga",
|
|
|
|
"gl", "hr", "hu", "is",
|
|
|
|
"it", "iw", "ja", "ko",
|
|
|
|
"lt", "nl", "nb", "pl",
|
|
|
|
"pt", "pt-rBR", "ro",
|
|
|
|
"ru", "sk", "sl", "sq",
|
|
|
|
"sr", "sv", "tr", "zh-rCN",
|
|
|
|
"zh-rTW", "uk"
|
|
|
|
)
|
2020-04-11 20:20:30 +00:00
|
|
|
|
|
|
|
ndk {
|
2025-06-07 10:43:50 +00:00
|
|
|
abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
|
2020-04-11 20:20:30 +00:00
|
|
|
}
|
2020-04-11 17:21:26 +00:00
|
|
|
}
|
2023-10-08 22:06:13 +00:00
|
|
|
bundle {
|
|
|
|
language {
|
2025-06-07 10:43:50 +00:00
|
|
|
enableSplit = false
|
2023-10-08 22:06:13 +00:00
|
|
|
}
|
|
|
|
}
|
2020-01-22 03:16:03 +00:00
|
|
|
buildFeatures {
|
2025-06-07 10:43:50 +00:00
|
|
|
viewBinding = true
|
|
|
|
compose = true
|
|
|
|
aidl = true
|
|
|
|
buildConfig = true
|
2022-11-02 18:34:56 +00:00
|
|
|
}
|
2025-06-25 23:16:55 +00:00
|
|
|
// Configure the build-logic plugins to target JDK 21
|
2023-07-27 09:08:30 +00:00
|
|
|
// This matches the JDK used to build the project, and is not related to what is running on device.
|
2020-01-22 03:16:03 +00:00
|
|
|
compileOptions {
|
2025-06-07 10:43:50 +00:00
|
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
|
|
targetCompatibility = JavaVersion.VERSION_21
|
2020-01-22 03:16:03 +00:00
|
|
|
}
|
2022-02-01 01:01:33 +00:00
|
|
|
lint {
|
2025-06-07 10:43:50 +00:00
|
|
|
abortOnError = false
|
|
|
|
disable.add("MissingTranslation")
|
2020-02-10 15:40:45 +00:00
|
|
|
}
|
2024-08-04 14:40:33 +00:00
|
|
|
sourceSets {
|
|
|
|
// Adds exported schema location as test app assets.
|
2025-06-07 10:43:50 +00:00
|
|
|
named("androidTest") { assets.srcDirs(files("$projectDir/schemas")) }
|
2024-08-04 14:40:33 +00:00
|
|
|
}
|
2020-01-20 23:53:22 +00:00
|
|
|
}
|
|
|
|
|
2025-06-25 18:23:18 +00:00
|
|
|
kotlin {
|
|
|
|
compilerOptions {
|
2025-06-25 23:16:55 +00:00
|
|
|
jvmToolchain {
|
|
|
|
JvmTarget.JVM_21
|
|
|
|
}
|
2025-06-25 18:23:18 +00:00
|
|
|
freeCompilerArgs.addAll(
|
|
|
|
"-opt-in=kotlin.RequiresOptIn",
|
|
|
|
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
|
|
|
"-Xcontext-receivers",
|
|
|
|
"-Xannotation-default-target=param-property"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-23 02:32:21 +00:00
|
|
|
// per protobuf-gradle-plugin docs, this is recommended for android
|
|
|
|
protobuf {
|
|
|
|
protoc {
|
2025-06-07 10:43:50 +00:00
|
|
|
artifact = libs.protobuf.protoc.get().toString()
|
2020-01-23 02:32:21 +00:00
|
|
|
}
|
|
|
|
generateProtoTasks {
|
2025-06-07 10:43:50 +00:00
|
|
|
all().forEach { task ->
|
2020-01-23 02:32:21 +00:00
|
|
|
task.builtins {
|
2025-06-07 10:43:50 +00:00
|
|
|
create("java") {}
|
|
|
|
create("kotlin") {}
|
2020-01-23 02:32:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-10 20:19:23 +00:00
|
|
|
// workaround for https://github.com/google/ksp/issues/1590
|
|
|
|
androidComponents {
|
2025-06-07 10:43:50 +00:00
|
|
|
onVariants(selector().all()) { variant ->
|
|
|
|
project.afterEvaluate {
|
|
|
|
val capName = variant.name.replaceFirstChar { it.uppercase() }
|
2025-04-19 07:33:27 +00:00
|
|
|
tasks.named("ksp${capName}Kotlin") {
|
|
|
|
dependsOn("generate${capName}Proto")
|
2024-01-10 20:19:23 +00:00
|
|
|
}
|
|
|
|
}
|
2025-06-07 10:43:50 +00:00
|
|
|
}
|
2024-01-10 20:19:23 +00:00
|
|
|
}
|
|
|
|
|
2020-01-20 23:53:22 +00:00
|
|
|
dependencies {
|
2025-06-07 10:43:50 +00:00
|
|
|
implementation(project(":network"))
|
|
|
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
2025-02-25 00:42:37 +00:00
|
|
|
|
|
|
|
// Bundles
|
|
|
|
implementation(libs.bundles.androidx)
|
|
|
|
implementation(libs.bundles.ui)
|
|
|
|
debugImplementation(libs.bundles.ui.tooling)
|
2025-06-13 02:34:01 +00:00
|
|
|
implementation(libs.bundles.adaptive)
|
2025-02-25 00:42:37 +00:00
|
|
|
implementation(libs.bundles.lifecycle)
|
|
|
|
implementation(libs.bundles.navigation)
|
|
|
|
implementation(libs.bundles.coroutines)
|
|
|
|
implementation(libs.bundles.datastore)
|
|
|
|
implementation(libs.bundles.room)
|
|
|
|
implementation(libs.bundles.hilt)
|
|
|
|
implementation(libs.bundles.protobuf)
|
2025-04-27 00:37:49 +00:00
|
|
|
implementation(libs.bundles.coil)
|
2025-05-22 13:30:08 +00:00
|
|
|
|
2025-06-07 10:43:50 +00:00
|
|
|
// OSM
|
2025-02-25 00:42:37 +00:00
|
|
|
implementation(libs.bundles.osm)
|
2025-06-07 10:43:50 +00:00
|
|
|
implementation(libs.osmdroid.geopackage) { exclude(group = "com.j256.ormlite") }
|
2025-02-25 00:42:37 +00:00
|
|
|
|
2025-06-07 10:43:50 +00:00
|
|
|
// ZXing
|
|
|
|
implementation(libs.zxing.android.embedded) { isTransitive = false }
|
|
|
|
implementation(libs.zxing.core)
|
2025-02-25 00:42:37 +00:00
|
|
|
|
2025-06-07 10:43:50 +00:00
|
|
|
// Individual dependencies
|
2025-02-25 00:42:37 +00:00
|
|
|
implementation(libs.appintro)
|
2025-06-07 10:43:50 +00:00
|
|
|
"googleImplementation"(libs.awesome.app.rating)
|
2025-02-25 00:42:37 +00:00
|
|
|
implementation(libs.core.splashscreen)
|
|
|
|
implementation(libs.emoji2.emojipicker)
|
|
|
|
implementation(libs.kotlinx.collections.immutable)
|
|
|
|
implementation(libs.kotlinx.serialization.json)
|
|
|
|
implementation(libs.org.eclipse.paho.client.mqttv3)
|
|
|
|
implementation(libs.streamsupport.minifuture)
|
|
|
|
implementation(libs.usb.serial.android)
|
|
|
|
implementation(libs.work.runtime.ktx)
|
|
|
|
implementation(libs.core.location.altitude)
|
|
|
|
|
2025-06-07 10:43:50 +00:00
|
|
|
// Compose BOM
|
2025-02-25 00:42:37 +00:00
|
|
|
implementation(platform(libs.compose.bom))
|
|
|
|
androidTestImplementation(platform(libs.compose.bom))
|
|
|
|
|
2025-06-07 10:43:50 +00:00
|
|
|
// Firebase BOM
|
|
|
|
"googleImplementation"(platform(libs.firebase.bom))
|
|
|
|
"googleImplementation"(libs.bundles.firebase)
|
2025-02-25 00:42:37 +00:00
|
|
|
|
2025-06-07 10:43:50 +00:00
|
|
|
// ksp
|
2025-02-25 00:42:37 +00:00
|
|
|
ksp(libs.room.compiler)
|
|
|
|
ksp(libs.hilt.compiler)
|
|
|
|
kspAndroidTest(libs.hilt.compiler)
|
|
|
|
|
2025-06-07 10:43:50 +00:00
|
|
|
// Testing
|
2025-02-25 00:42:37 +00:00
|
|
|
testImplementation(libs.bundles.testing)
|
|
|
|
debugImplementation(libs.bundles.testing.android.manifest)
|
|
|
|
androidTestImplementation(libs.bundles.testing.android)
|
|
|
|
androidTestImplementation(libs.bundles.testing.hilt)
|
|
|
|
androidTestImplementation(libs.bundles.testing.navigation)
|
|
|
|
androidTestImplementation(libs.bundles.testing.room)
|
|
|
|
|
|
|
|
detektPlugins(libs.detekt.formatting)
|
2020-01-20 23:53:22 +00:00
|
|
|
}
|
2022-02-08 21:50:21 +00:00
|
|
|
|
2023-09-05 09:21:08 +00:00
|
|
|
ksp {
|
|
|
|
// arg("room.generateKotlin", "true")
|
|
|
|
arg("room.schemaLocation", "$projectDir/schemas")
|
2022-04-08 22:37:53 +00:00
|
|
|
}
|
2022-08-10 16:12:49 +00:00
|
|
|
|
|
|
|
repositories {
|
2025-06-07 10:43:50 +00:00
|
|
|
maven { url = uri("https://jitpack.io") }
|
2022-08-16 23:07:39 +00:00
|
|
|
}
|
2024-07-03 02:01:51 +00:00
|
|
|
|
|
|
|
detekt {
|
|
|
|
config.setFrom("../config/detekt/detekt.yml")
|
|
|
|
baseline = file("../config/detekt/detekt-baseline.xml")
|
2024-09-21 01:05:51 +00:00
|
|
|
}
|