Files
kadence/android/settings.gradle.kts

53 lines
1.7 KiB
Kotlin

pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
rootProject.name = "kadence-android"
// `core` is plain Kotlin on the JVM: the matchers, the policy clock, the outbox
// reconciliation, the Glyph frame and the formatting. No Android, no device, no SDK —
// which is the whole point. `./gradlew :core:test` runs the logic suite on a machine
// that has nothing but a JDK, so almost none of this app needs a phone to verify.
include(":core")
// `app` is the Android client and genuinely needs an SDK. Including it
// unconditionally would make every Gradle invocation fail on a machine without one,
// taking `:core:test` down with it — so it joins the build only when an SDK exists.
val androidSdk: java.io.File? = sequenceOf(
System.getenv("ANDROID_HOME"),
System.getenv("ANDROID_SDK_ROOT"),
file("local.properties")
.takeIf { it.isFile }
?.readLines()
?.firstOrNull { it.startsWith("sdk.dir=") }
?.substringAfter('=')
?.trim(),
).filterNotNull()
.filter { it.isNotBlank() }
.map { file(it) }
.firstOrNull { it.isDirectory }
val appModule = file("app/build.gradle.kts")
if (androidSdk != null && appModule.isFile) {
include(":app")
} else if (androidSdk != null) {
logger.lifecycle("SDK found, but app/ is not built out yet — :app excluded.")
} else {
logger.lifecycle(
"Android SDK not found (set ANDROID_HOME or local.properties' sdk.dir) — " +
":app is excluded from this build. :core still compiles and tests.",
)
}