Refactor: Use JVM toolchain and disable Crashlytics for F-Droid (#2252)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2025-06-26 00:18:59 +00:00 committed by GitHub
parent 11edd9a8d2
commit eb81ded56a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 61 deletions

View file

@ -15,7 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.io.FileInputStream
import java.util.Properties
@ -124,12 +123,6 @@ android {
aidl = true
buildConfig = true
}
// Configure the build-logic plugins to target JDK 21
// This matches the JDK used to build the project, and is not related to what is running on device.
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
lint {
abortOnError = false
disable.add("MissingTranslation")
@ -142,9 +135,7 @@ android {
kotlin {
compilerOptions {
jvmToolchain {
JvmTarget.JVM_21
}
jvmToolchain(21)
freeCompilerArgs.addAll(
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
@ -257,3 +248,12 @@ detekt {
config.setFrom("../config/detekt/detekt.yml")
baseline = file("../config/detekt/detekt-baseline.xml")
}
tasks.configureEach {
if (
name.contains("crashlytics", ignoreCase = true) && name.contains("fdroid", ignoreCase = true)
) {
project.logger.lifecycle("Disabling Crashlytics task for F-Droid: $name")
enabled = false
}
}

View file

@ -15,42 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
/*
* 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/>.
*/
/*
* 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/>.
*/
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
@ -84,19 +48,13 @@ android {
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
buildFeatures {
aidl = true
}
}
kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_21
}
jvmToolchain(21)
}
// per protobuf-gradle-plugin docs, this is recommended for android

View file

@ -15,7 +15,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
alias(libs.plugins.android.library)
@ -36,10 +35,6 @@ android {
}
namespace = "com.geeksville.mesh.network"
compileOptions {
sourceCompatibility(JavaVersion.VERSION_21)
targetCompatibility(JavaVersion.VERSION_21)
}
flavorDimensions += "default"
productFlavors {
@ -53,9 +48,7 @@ android {
}
kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
}
jvmToolchain(21)
}
dependencies {

View file

@ -17,3 +17,17 @@
include(":app", ":network", ":mesh_service_example")
rootProject.name = "Meshtastic Android"
plugins {
id("org.gradle.toolchains.foojay-resolver") version "1.0.0"
}
toolchainManagement {
jvm {
javaRepositories {
repository("foojay") {
resolverClass.set(org.gradle.toolchains.foojay.FoojayToolchainResolver::class.java)
}
}
}
}