Refactor command handling, enhance tests, and improve discovery logic (#4878)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-03-22 00:42:27 -05:00 committed by GitHub
parent d136b162a4
commit c38bfc64de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
76 changed files with 2220 additions and 1277 deletions

View file

@ -17,9 +17,9 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.provider.Property
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.dependencies
import org.koin.compiler.plugin.KoinGradleExtension
import org.meshtastic.buildlogic.libs
import org.meshtastic.buildlogic.plugin
@ -28,28 +28,14 @@ class KoinConventionPlugin : Plugin<Project> {
with(target) {
apply(plugin = libs.plugin("koin-compiler").get().pluginId)
// Configure Koin Compiler Plugin (0.4.0+)
extensions.configure<Any>("koinCompiler") {
val extension = this
val clazz = extension.javaClass
try {
// Meshtastic heavily utilizes dependency inversion across KMP modules. Koin 0.4.0's A1
// per-module safety checks strictly enforce that all dependencies must be explicitly
// provided or included locally. This breaks decoupled Clean Architecture designs.
// We disable A1 compile safety globally to properly rely on Koin's A3 full-graph
// validation which perfectly handles inverted dependencies at the composition root.
try {
clazz.getMethod("setCompileSafety", Boolean::class.java).invoke(extension, false)
} catch (e: Exception) {
val prop = clazz.getMethod("getCompileSafety").invoke(extension)
if (prop is Property<*>) {
@Suppress("UNCHECKED_CAST")
(prop as Property<Boolean>).set(false)
}
}
} catch (e: Exception) {
// Ignore gracefully if Koin DSL changes in the future
}
// Configure Koin K2 Compiler Plugin (0.4.0+)
extensions.configure(KoinGradleExtension::class.java) {
// Meshtastic heavily utilizes dependency inversion across KMP modules. Koin's A1
// per-module safety checks strictly enforce that all dependencies must be explicitly
// provided or included locally. This breaks decoupled Clean Architecture designs.
// We disable compile safety globally to properly rely on Koin's A3 full-graph
// validation which perfectly handles inverted dependencies at the composition root.
compileSafety.set(false)
}
val koinAnnotations = libs.findLibrary("koin-annotations").get()

View file

@ -90,6 +90,21 @@ internal fun Project.configureKotlinMultiplatform() {
}
}
// Disable iOS native test link & run tasks.
// iOS targets exist only for compile-time validation; linking test
// executables is extremely slow and causes `./gradlew test` to hang.
tasks.configureEach {
val taskName = name.lowercase()
if (taskName.contains("iosarm64") || taskName.contains("iossimulatorarm64")) {
if (taskName.startsWith("link") && taskName.contains("test") ||
taskName == "iosarm64test" || taskName == "iossimulatorarm64test" ||
taskName.endsWith("testbinaries")
) {
enabled = false
}
}
}
configureMokkery()
configureKotlin<KotlinMultiplatformExtension>()
}