Remove unused dependencies in :app (#3365)

This commit is contained in:
Phil Oliver 2025-10-06 22:14:25 -04:00 committed by GitHub
parent ff9d621978
commit 4d7ad96a09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 66 additions and 230 deletions

View file

@ -27,7 +27,6 @@ plugins {
alias(libs.plugins.meshtastic.android.application.compose)
alias(libs.plugins.meshtastic.hilt)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.meshtastic.kotlinx.serialization)
alias(libs.plugins.devtools.ksp)
alias(libs.plugins.secrets)
alias(libs.plugins.dokka)
@ -202,29 +201,51 @@ dependencies {
implementation(projects.feature.node)
implementation(projects.feature.settings)
// Bundles
implementation(libs.bundles.markdown)
implementation(libs.bundles.coroutines)
implementation(libs.bundles.datastore)
implementation(libs.bundles.coil)
// ZXing
implementation(libs.androidx.compose.material3.adaptive)
implementation(libs.androidx.compose.material3.navigationSuite)
implementation(libs.material)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.iconsExtended)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.compose.runtime.livedata)
implementation(libs.androidx.compose.ui.text)
implementation(libs.lifecycle.livedata.ktx)
implementation(libs.lifecycle.process)
implementation(libs.lifecycle.viewmodel.compose)
implementation(libs.lifecycle.runtime.compose)
implementation(libs.markdown.renderer)
implementation(libs.markdown.renderer.android)
implementation(libs.markdown.renderer.m3)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.coil)
implementation(libs.coil.network.okhttp)
implementation(libs.coil.svg)
implementation(libs.hilt.lifecycle.viewmodel.compose)
implementation(libs.zxing.android.embedded) { isTransitive = false }
implementation(libs.zxing.core)
// Individual dependencies (flavor-specific ones removed)
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)
implementation(libs.accompanist.permissions)
implementation(libs.timber)
debugImplementation(libs.androidx.compose.ui.testManifest)
googleImplementation(libs.location.services)
fdroidImplementation(libs.osmdroid.android)
fdroidImplementation(libs.osmdroid.geopackage) { exclude(group = "com.j256.ormlite") }
androidTestImplementation(libs.androidx.compose.ui.test)
androidTestImplementation(libs.androidx.test.runner)
testImplementation(libs.ext.junit)
testImplementation(libs.junit)
dokkaPlugin(libs.dokka.android.documentation.plugin)
}

View file

@ -82,14 +82,6 @@ gradlePlugin {
id = libs.plugins.meshtastic.android.lint.get().pluginId
implementationClass = "AndroidLintConventionPlugin"
}
register("androidFirebase") {
id = libs.plugins.meshtastic.android.application.firebase.get().pluginId
implementationClass = "AndroidApplicationFirebaseConventionPlugin"
}
register("androidDatadog") {
id = libs.plugins.meshtastic.android.application.datadog.get().pluginId
implementationClass = "AndroidApplicationDatadogConventionPlugin"
}
register("androidLibraryCompose") {
id = libs.plugins.meshtastic.android.library.compose.get().pluginId
implementationClass = "AndroidLibraryComposeConventionPlugin"

View file

@ -64,12 +64,6 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
buildFeatures {
buildConfig = true
}
dependencies {
"testImplementation"(libs.findBundle("testing").get())
"androidTestImplementation"(libs.findBundle("testing.android").get())
}
}
}
}

View file

@ -1,42 +0,0 @@
/*
* 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/>.
*/
import com.android.build.api.dsl.ApplicationExtension
import com.geeksville.mesh.buildlogic.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
/**
* Convention plugin to apply and configure Datadog for Android applications.
* This plugin should only be applied to variants that require Datadog integration (e.g., 'google' flavor).
*/
class AndroidApplicationDatadogConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
extensions.configure<ApplicationExtension> {
apply(plugin = libs.findPlugin("datadog").get().get().pluginId)
dependencies {
"googleImplementation"(libs.findBundle("datadog").get())
}
}
}
}
}

View file

@ -1,51 +0,0 @@
/*
* 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/>.
*/
import com.android.build.api.dsl.ApplicationExtension
import com.geeksville.mesh.buildlogic.libs
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.exclude
class AndroidApplicationFirebaseConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
apply(plugin = libs.findPlugin("firebase-crashlytics").get().get().pluginId)
apply(plugin = libs.findPlugin("google-services").get().get().pluginId)
extensions.configure<ApplicationExtension> {
dependencies {
val bom = libs.findLibrary("firebase-bom").get()
"googleImplementation"(platform(bom))
"googleImplementation"(libs.findBundle("firebase").get()) {
// Exclusion of protobuf / protolite dependencies is necessary as we depend
// on different versions than those included.
exclude(group = "com.google.protobuf", module = "protobuf-java")
exclude(group = "com.google.protobuf", module = "protobuf-kotlin")
exclude(group = "com.google.protobuf", module = "protobuf-javalite")
exclude(
group = "com.google.firebase",
module = "protolite-well-known-types"
)
}
}
}
}
}
}

View file

@ -31,29 +31,6 @@ class AndroidApplicationFlavorsConventionPlugin : Plugin<Project> {
with(target) {
extensions.configure<ApplicationExtension> {
configureFlavors(this)
productFlavors {
all {
if (name == MeshtasticFlavor.google.name) {
apply(plugin = "meshtastic.android.application.firebase")
apply(plugin = "meshtastic.android.application.datadog")
dependencies {
// Google specific dependencies
"googleImplementation"(libs.findBundle("maps-compose").get())
"googleImplementation"(libs.findLibrary("awesome-app-rating").get())
}
} else if (name == MeshtasticFlavor.fdroid.name) {
dependencies {
// F-Droid specific dependencies
"fdroidImplementation"(libs.findBundle("osm").get())
"fdroidImplementation"(
libs.findLibrary("osmdroid-geopackage").get()
) {
exclude(group = "com.j256.ormlite")
}
}
}
}
}
}
}
}

View file

@ -28,7 +28,7 @@ class HiltConventionPlugin : Plugin<Project> {
dependencies {
"ksp"(libs.findLibrary("hilt.compiler").get())
"implementation"(libs.findBundle("hilt").get())
"implementation"(libs.findLibrary("hilt-android").get())
"androidTestImplementation"(libs.findBundle("testing.hilt").get())
}

View file

@ -35,25 +35,16 @@ internal fun Project.configureAndroidCompose(
compose = true
}
//needed for navigation3
pluginManager.apply(libs.findPlugin("meshtastic-kotlinx-serialization").get().get().pluginId)
dependencies {
val bom = libs.findLibrary("androidx-compose-bom").get()
"implementation"(platform(bom))
"androidTestImplementation"(platform(bom))
"implementation"(libs.findBundle("ui").get())
"implementation"(libs.findBundle("adaptive").get())
"implementation"(libs.findBundle("lifecycle").get())
"implementation"(libs.findBundle("navigation").get())
"androidTestImplementation"(libs.findBundle("testing.navigation").get())
"implementation"(libs.findBundle("navigation3").get())
"implementation"(libs.findBundle("ui-tooling").get())
"implementation"(libs.findLibrary("androidx-compose-ui-tooling-preview").get())
"implementation"(libs.findLibrary("androidx-compose-runtime").get())
"implementation"(libs.findLibrary("androidx-compose-runtime-tracing").get())
"debugImplementation"(libs.findLibrary("androidx-compose-ui-tooling").get())
"debugImplementation"(libs.findLibrary("androidx-compose-ui-testManifest").get())
}
}

View file

@ -90,4 +90,18 @@ dependencies {
kover(projects.feature.map)
kover(projects.feature.node)
kover(projects.feature.settings)
}
dependencyAnalysis {
structure {
ignoreKtx(true)
}
issues {
all {
onUnusedDependencies {
exclude("androidx.compose.ui:ui-test-manifest")
}
}
}
}

View file

@ -26,6 +26,8 @@ dependencies {
implementation(project(":core:model"))
implementation(libs.timber)
implementation(libs.appcompat)
implementation(libs.hilt.lifecycle.viewmodel.compose)
implementation(libs.navigation.compose)
implementation(libs.lifecycle.process)
googleImplementation(platform(libs.firebase.bom))
googleImplementation(libs.bundles.firebase) {

View file

@ -33,5 +33,8 @@ dependencies {
implementation(libs.bundles.coroutines)
implementation(libs.bundles.markdown)
implementation(libs.bundles.ui)
implementation(libs.emoji2.emojipicker)
implementation(libs.hilt.lifecycle.viewmodel.compose)
}

View file

@ -19,11 +19,16 @@ plugins {
alias(libs.plugins.kover)
alias(libs.plugins.meshtastic.android.library)
alias(libs.plugins.meshtastic.android.library.compose)
alias(libs.plugins.meshtastic.kotlinx.serialization)
}
android { namespace = "org.meshtastic.feature.intro" }
dependencies {
implementation(projects.core.strings)
implementation(libs.bundles.ui)
implementation(libs.accompanist.permissions)
implementation(libs.navigation3.runtime)
implementation(libs.navigation3.ui)
}

View file

@ -40,9 +40,11 @@ dependencies {
implementation(libs.bundles.coroutines)
implementation(libs.bundles.lifecycle)
implementation(libs.bundles.osm)
implementation(libs.bundles.ui)
googleImplementation(libs.bundles.maps.compose)
implementation(libs.accompanist.permissions)
implementation(libs.annotation)
implementation(libs.hilt.lifecycle.viewmodel.compose)
implementation(libs.timber)
}

View file

@ -34,5 +34,6 @@ dependencies {
implementation(projects.core.strings)
implementation(projects.core.ui)
implementation(libs.bundles.ui)
implementation(libs.timber)
}

View file

@ -37,7 +37,10 @@ dependencies {
implementation(projects.core.strings)
implementation(projects.core.ui)
implementation(libs.bundles.ui)
implementation(libs.accompanist.permissions)
implementation(libs.hilt.lifecycle.viewmodel.compose)
implementation(libs.kotlinx.collections.immutable)
implementation(libs.timber)
implementation(libs.zxing.android.embedded)

View file

@ -51,7 +51,7 @@ core-splashscreen = { module = "androidx.core:core-splashscreen", version = "1.0
datastore = { module = "androidx.datastore:datastore", version.ref = "datastore" }
datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastore" }
emoji2-emojipicker = { module = "androidx.emoji2:emoji2-emojipicker", version = "1.6.0" }
hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version = "1.3.0" }
hilt-lifecycle-viewmodel-compose = { module = "androidx.hilt:hilt-lifecycle-viewmodel-compose", version = "1.3.0" }
lifecycle-common-java8 = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref = "lifecycle" }
lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycle" }
lifecycle-process = { module = "androidx.lifecycle:lifecycle-process", version.ref = "lifecycle" }
@ -126,6 +126,7 @@ ktorfit = { module = "de.jensklingenberg.ktorfit:ktorfit-lib", version.ref = "kt
okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version = "5.1.0" }
# Testing
androidx-test-runner = { module = "androidx.test:runner", version = "1.7.0" }
espresso-core = { module = "androidx.test.espresso:espresso-core", version = "3.7.0" }
ext-junit = { module = "androidx.test.ext:junit", version = "1.3.0" }
junit = { module = "junit:junit", version = "4.13.2" }
@ -191,9 +192,6 @@ room = ["room-runtime", "room-ktx"]
# Coroutines
coroutines = ["kotlinx-coroutines-android", "kotlinx-coroutines-guava"]
# Dependency Injection
hilt = ["hilt-android", "hilt-navigation-compose"]
# Google
firebase = ["firebase-analytics", "firebase-crashlytics"]
maps-compose = ["location-services", "maps-compose", "maps-compose-utils", "maps-compose-widgets"]
@ -257,8 +255,6 @@ spotless = { id = "com.diffplug.spotless", version = "8.0.0" }
# Meshtastic
meshtastic-android-application = { id = "meshtastic.android.application" }
meshtastic-android-application-compose = { id = "meshtastic.android.application.compose" }
meshtastic-android-application-datadog = { id = "meshtastic.android.application.datadog" }
meshtastic-android-application-firebase = { id = "meshtastic.android.application.firebase" }
meshtastic-android-application-flavors = { id = "meshtastic.android.application.flavors" }
meshtastic-android-library = { id = "meshtastic.android.library" }
meshtastic-android-library-compose = { id = "meshtastic.android.library.compose" }

View file

@ -1,39 +0,0 @@
/*
* 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/>.
*/
package com.meshtastic.android.meshserviceexample
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
Assert.assertEquals("com.meshtastic.android.meshserviceexample", appContext.packageName)
}
}

View file

@ -1,33 +0,0 @@
/*
* 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/>.
*/
package com.meshtastic.android.meshserviceexample
import org.junit.Assert
import org.junit.Test
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
Assert.assertEquals(4, (2 + 2).toLong())
}
}