release / go (push) Successful in 1m50s
release / web (push) Successful in 1m16s
release / govulncheck (push) Successful in 17s
release / android (push) Failing after 1m5s
release / integration (push) Successful in 2m36s
release / Build signed APK (push) Failing after 1m13s
release / Build + push container image (push) Skipped
ci-android:37 (CI-runner PR #17) carries Android SDK 37. That lets the app compile against 37 and take the libraries that require it: - compose-bom 2026.11.01 - androidx.hilt 1.4.0 - navigation 2.10.2 - lifecycle 2.11.1 - core-ktx 1.19.1 - mediarouter 1.9.0 - coil 3.6.3 - OkHttp 5.5.1 targetSdk stays 36, so runtime behaviour on phones is unchanged. ktlint-gradle 14.2 runs ktlint 1.5, which turns on rules that 1.0 left experimental, so the sources are reformatted to them. Ignoring whitespace that is about 4.7k lines across 312 files, and none of it changes behaviour. android/.editorconfig keeps ktlint's default style but exempts @Composable functions from the lowercase function-naming rule, which Compose's own convention breaks. A few spots ktlint 1.5 cannot fix by itself were rewritten: - EOL comments moved above the KDoc they followed; - DeliveryPlan's file-level doc became plain comments; - three /* name = */ argument labels on Java calls became trailing comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
274 lines
10 KiB
Kotlin
274 lines
10 KiB
Kotlin
plugins {
|
|
alias(libs.plugins.android.application)
|
|
// kotlin-android NOT applied: AGP 9 enables built-in Kotlin by default,
|
|
// and KSP 2.3.x supports it. serialization + compose-compiler are
|
|
// language-level Kotlin compiler plugins and still need explicit
|
|
// application.
|
|
alias(libs.plugins.kotlin.serialization)
|
|
alias(libs.plugins.compose.compiler)
|
|
alias(libs.plugins.ksp)
|
|
alias(libs.plugins.androidx.room)
|
|
alias(libs.plugins.hilt)
|
|
alias(libs.plugins.ktlint)
|
|
alias(libs.plugins.detekt)
|
|
}
|
|
|
|
android {
|
|
namespace = "com.fabledsword.minstrel"
|
|
compileSdk = 37
|
|
|
|
defaultConfig {
|
|
applicationId = "com.fabledsword.minstrel"
|
|
minSdk = 26
|
|
targetSdk = 36
|
|
// versionName / versionCode are released-build values injected by CI.
|
|
// Local / debug builds fall back to "dev" so the About card reads
|
|
// honestly.
|
|
//
|
|
// versionName is "YYYY.MM.DD.HHMM" from the COMMIT's timestamp, so
|
|
// every lane building this source reports the same string and the
|
|
// channel is the only thing that differs between them.
|
|
//
|
|
// versionCode is minutes since 2020-01-01 at BUILD time. It is the
|
|
// value the platform decides installs by, so it must be monotonic by
|
|
// construction. Not a commit count: that runs ahead on `dev`, so a dev
|
|
// build would outrank the `main` release meant to replace it and
|
|
// Android would refuse the install as a downgrade.
|
|
val versionNameOverride =
|
|
(project.findProperty("MINSTREL_VERSION_NAME") as String?)?.takeIf { it.isNotBlank() }
|
|
val versionCodeOverride =
|
|
(project.findProperty("MINSTREL_VERSION_CODE") as String?)?.toIntOrNull()
|
|
versionCode = versionCodeOverride ?: 1
|
|
versionName = versionNameOverride ?: "dev"
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
vectorDrawables { useSupportLibrary = true }
|
|
}
|
|
|
|
// Room schema export is handled by the androidx.room Gradle plugin via
|
|
// the room {} block below — replaces the legacy
|
|
// `ksp { arg("room.schemaLocation", ...) }` pattern in Room 2.7+.
|
|
|
|
signingConfigs {
|
|
create("release") {
|
|
val keystorePath: String? = System.getenv("ANDROID_KEYSTORE_PATH")
|
|
if (!keystorePath.isNullOrEmpty()) {
|
|
storeFile = file(keystorePath)
|
|
storePassword = System.getenv("ANDROID_STORE_PASSWORD")
|
|
keyAlias = System.getenv("ANDROID_KEY_ALIAS")
|
|
keyPassword = System.getenv("ANDROID_KEY_PASSWORD")
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
isMinifyEnabled = false
|
|
proguardFiles(
|
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
"proguard-rules.pro",
|
|
)
|
|
// Signed with the release key or not at all. Falling back to the
|
|
// debug key would turn a missing secret into a published APK that no
|
|
// install could ever update. An unsigned build installs nowhere, so
|
|
// the gap shows at once.
|
|
signingConfig =
|
|
if (System.getenv("ANDROID_KEYSTORE_PATH").isNullOrEmpty()) {
|
|
null
|
|
} else {
|
|
signingConfigs.getByName("release")
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
buildFeatures {
|
|
compose = true
|
|
buildConfig = true
|
|
}
|
|
|
|
packaging {
|
|
resources.excludes +=
|
|
setOf(
|
|
"/META-INF/{AL2.0,LGPL2.1}",
|
|
"META-INF/LICENSE.md",
|
|
"META-INF/LICENSE-notice.md",
|
|
)
|
|
}
|
|
}
|
|
|
|
// The app's error messages are the web app's: web/src/lib/styles holds the
|
|
// copy for each server error code (error-copy.json) and the codes whose
|
|
// server message is appended (error-detail-codes.json). Both are copied in as
|
|
// Java resources, which ErrorCopy reads, so the two clients say the same thing
|
|
// and a new code is added once.
|
|
abstract class CopySharedCopyTask : DefaultTask() {
|
|
@get:InputFiles
|
|
@get:PathSensitive(PathSensitivity.NAME_ONLY)
|
|
abstract val sources: ConfigurableFileCollection
|
|
|
|
@get:OutputDirectory
|
|
abstract val outputDir: DirectoryProperty
|
|
|
|
@TaskAction
|
|
fun copy() {
|
|
val out = outputDir.get().asFile
|
|
out.deleteRecursively()
|
|
out.mkdirs()
|
|
sources.forEach { it.copyTo(File(out, it.name), overwrite = true) }
|
|
}
|
|
}
|
|
|
|
val copySharedCopy =
|
|
tasks.register<CopySharedCopyTask>("copySharedCopy") {
|
|
sources.from(
|
|
rootProject.file("../web/src/lib/styles/error-copy.json"),
|
|
rootProject.file("../web/src/lib/styles/error-detail-codes.json"),
|
|
)
|
|
}
|
|
|
|
androidComponents {
|
|
onVariants { variant ->
|
|
variant.sources.resources?.addGeneratedSourceDirectory(copySharedCopy, CopySharedCopyTask::outputDir)
|
|
}
|
|
}
|
|
|
|
// Kotlin 2.x: `kotlinOptions { ... }` inside `android { }` is gone; the
|
|
// modern shape is the top-level `kotlin { compilerOptions { ... } }` block,
|
|
// which works whether Kotlin comes from AGP 9's built-in path or an
|
|
// explicit plugin alias.
|
|
kotlin {
|
|
compilerOptions {
|
|
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
|
|
// Opt into the future Kotlin behavior: annotations on
|
|
// constructor parameters apply to both the param AND the
|
|
// generated property/field. Without this flag, Kotlin 2.x
|
|
// emits a deprecation warning at every @Inject /
|
|
// @ApplicationContext / @ApplicationScope constructor-
|
|
// parameter use. Setting it now matches what becomes the
|
|
// default in Kotlin 2.3 (KT-73255).
|
|
freeCompilerArgs.add("-Xannotation-default-target=param-property")
|
|
}
|
|
}
|
|
|
|
// Room schema export — generated JSON dumps live under android/app/schemas/
|
|
// for migration-test fixtures. Replaces the legacy
|
|
// `ksp { arg("room.schemaLocation", ...) }` arg-passing.
|
|
room {
|
|
schemaDirectory("$projectDir/schemas")
|
|
}
|
|
|
|
detekt {
|
|
toolVersion = libs.versions.detekt.get()
|
|
config.setFrom(files("$rootDir/config/detekt.yml"))
|
|
buildUponDefaultConfig = true
|
|
parallel = true
|
|
// `autoCorrect` was dropped in detekt 2.0's DSL options list.
|
|
}
|
|
|
|
// detekt 2.0 moved its task types to the `dev.detekt.gradle` package and
|
|
// flipped `jvmTarget` to the Property API. Pin to 17 to match our actual
|
|
// bytecode target (compileOptions.targetCompatibility +
|
|
// kotlin.compilerOptions.jvmTarget).
|
|
tasks.withType<dev.detekt.gradle.Detekt>().configureEach {
|
|
jvmTarget.set("17")
|
|
}
|
|
tasks.withType<dev.detekt.gradle.DetektCreateBaselineTask>().configureEach {
|
|
jvmTarget.set("17")
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.lifecycle.runtime.compose)
|
|
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
|
implementation(libs.androidx.lifecycle.process)
|
|
implementation(libs.androidx.activity.compose)
|
|
implementation(libs.androidx.nav.compose)
|
|
implementation(libs.androidx.hilt.nav.compose)
|
|
implementation(libs.androidx.hilt.work)
|
|
ksp(libs.androidx.hilt.compiler)
|
|
implementation(libs.androidx.work.runtime.ktx)
|
|
|
|
implementation(platform(libs.compose.bom))
|
|
implementation(libs.compose.ui)
|
|
implementation(libs.compose.ui.graphics)
|
|
implementation(libs.compose.material3)
|
|
debugImplementation(libs.compose.ui.tooling)
|
|
implementation(libs.compose.ui.tooling.preview)
|
|
|
|
implementation(libs.hilt.android)
|
|
ksp(libs.hilt.compiler)
|
|
|
|
implementation(libs.room.runtime)
|
|
implementation(libs.room.ktx)
|
|
ksp(libs.room.compiler)
|
|
|
|
implementation(libs.retrofit)
|
|
implementation(libs.retrofit.kotlinx.serialization.converter)
|
|
implementation(libs.okhttp)
|
|
implementation(libs.okhttp.logging)
|
|
implementation(libs.okhttp.sse)
|
|
implementation(libs.kotlinx.serialization.json)
|
|
implementation(libs.kotlinx.coroutines.android)
|
|
implementation(libs.kotlinx.datetime)
|
|
|
|
implementation(libs.media3.exoplayer)
|
|
implementation(libs.media3.session)
|
|
implementation(libs.media3.datasource.okhttp)
|
|
implementation(libs.mediarouter)
|
|
|
|
implementation(libs.coil.compose)
|
|
implementation(libs.coil.network.okhttp)
|
|
implementation(libs.androidx.palette)
|
|
implementation(libs.icons.lucide)
|
|
|
|
implementation(libs.timber)
|
|
|
|
testImplementation(libs.junit.jupiter)
|
|
testImplementation(libs.turbine)
|
|
testImplementation(libs.mockk)
|
|
testImplementation(libs.kotlinx.coroutines.test)
|
|
testImplementation(libs.okhttp.mockwebserver)
|
|
// HeldCertificate: a test-only CA, so the server probe can be driven over real TLS.
|
|
testImplementation(libs.okhttp.tls)
|
|
// kxml2 — provides an org.xmlpull.v1 impl on the JVM unit-test
|
|
// classpath. Android's stock XmlPullParserFactory resolves to the
|
|
// android.jar Stub on JVM tests; kxml2 is picked up via service-
|
|
// provider lookup and makes XmlPullParserFactory.newInstance() work
|
|
// unconditionally so DeviceDescriptionTest runs in CI.
|
|
testImplementation(libs.kxml2)
|
|
// kotlin.test for assertEquals/assertNull/etc. — version managed by
|
|
// the applied Kotlin plugin so no explicit version pin needed.
|
|
testImplementation(kotlin("test"))
|
|
// Gradle 9 no longer auto-injects the JUnit Platform launcher; must
|
|
// be declared explicitly on the runtime classpath for useJUnitPlatform()
|
|
// to discover tests.
|
|
testRuntimeOnly(libs.junit.platform.launcher)
|
|
|
|
androidTestImplementation(platform(libs.compose.bom))
|
|
androidTestImplementation(libs.compose.ui.test)
|
|
// androidTest dep parity with the unit-test side; needed once we have
|
|
// instrumented tests that consume the same APIs.
|
|
androidTestImplementation(kotlin("test"))
|
|
androidTestImplementation(libs.kotlinx.coroutines.test)
|
|
debugImplementation(libs.compose.ui.test.manifest)
|
|
}
|
|
|
|
tasks.withType<Test> {
|
|
useJUnitPlatform()
|
|
// Print the assertion message + full stack trace for failures. The
|
|
// default console output gives only "AssertionError at Foo.kt:12", and
|
|
// for a failure inside a `runTest { }` lambda even that line collapses
|
|
// to the test function's own line (the assertion frames live in the
|
|
// suspend-lambda class, which Gradle filters out) — leaving nothing to
|
|
// debug from when the HTML report isn't reachable, as in CI.
|
|
testLogging {
|
|
events("failed")
|
|
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
|
|
showStackTraces = true
|
|
}
|
|
}
|