Amends decision #8: the producer now lives in tools/fest_flatten.py (stdlib Python, streaming iterparse over the 115 MB M30 XML) instead of an out-of-repo server job. It pulls fest251.zip from dmp.no, flattens 8934 active human-use brand entries (name/strength/unit/form/ATC + modal package size from pakningsinfo), and writes the asset checked in at app/src/main/assets/fest/slim.json — so autocomplete works offline out of the box. preReleaseBuild depends on refreshFestData: fast-exits under 30 days, keeps the old file on download failure (offline release builds never break). FestRepository: downloaded cache wins over the bundled asset. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
116 lines
3.9 KiB
Kotlin
116 lines
3.9 KiB
Kotlin
import java.util.Properties
|
|
|
|
plugins {
|
|
alias(libs.plugins.android.application)
|
|
// AGP 9 has built-in Kotlin (org.jetbrains.kotlin.android is gone); only the
|
|
// compiler sub-plugins are applied separately, pinned to AGP's bundled KGP version.
|
|
alias(libs.plugins.kotlin.compose)
|
|
alias(libs.plugins.kotlin.serialization)
|
|
alias(libs.plugins.ksp)
|
|
}
|
|
|
|
ksp {
|
|
// Commit exported schemas: migration baseline for a DB that is a medical record.
|
|
arg("room.schemaLocation", "$projectDir/schemas")
|
|
}
|
|
|
|
// Release signing from gitignored keystore.properties (keystore lives in
|
|
// ~/.keystores). Absent file → unsigned release, so CI/fresh clones still build.
|
|
val keystoreProps = Properties().apply {
|
|
val f = rootProject.file("keystore.properties")
|
|
if (f.exists()) f.inputStream().use(::load)
|
|
}
|
|
|
|
android {
|
|
namespace = "no.naiv.meddetsamme"
|
|
// compileSdk 37: required by current AndroidX (core 1.19 / compose BOM 2026.05).
|
|
// targetSdk stays 35 (brief) — compile-against vs runtime-behavior are separate knobs.
|
|
compileSdk = 37
|
|
|
|
defaultConfig {
|
|
applicationId = "no.naiv.meddetsamme"
|
|
minSdk = 26
|
|
targetSdk = 35
|
|
versionCode = 1
|
|
versionName = "0.1.0"
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
signingConfigs {
|
|
if (keystoreProps.isNotEmpty()) {
|
|
create("release") {
|
|
storeFile = file(keystoreProps.getProperty("storeFile"))
|
|
storePassword = keystoreProps.getProperty("storePassword")
|
|
keyAlias = keystoreProps.getProperty("keyAlias")
|
|
keyPassword = keystoreProps.getProperty("keyPassword")
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
isMinifyEnabled = false
|
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
|
|
if (keystoreProps.isNotEmpty()) {
|
|
signingConfig = signingConfigs.getByName("release")
|
|
}
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
// Built-in Kotlin derives jvmTarget from targetCompatibility — one knob, not two.
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
buildFeatures {
|
|
compose = true
|
|
}
|
|
|
|
// MigrationTestHelper reads the exported schema JSONs as androidTest assets.
|
|
sourceSets.getByName("androidTest").assets.srcDir("$projectDir/schemas")
|
|
}
|
|
|
|
// Release builds refresh the bundled FEST dataset when it's >30 days old.
|
|
// The script fast-exits when fresh and keeps the old file on download failure,
|
|
// so offline/CI release builds never break on this.
|
|
val refreshFestData by tasks.registering(Exec::class) {
|
|
group = "fest"
|
|
description = "Regenerate app/src/main/assets/fest/slim.json from DMP's M30 extract if stale"
|
|
workingDir = rootProject.projectDir
|
|
commandLine(
|
|
"python3", "tools/fest_flatten.py",
|
|
"--out", "app/src/main/assets/fest/slim.json",
|
|
"--max-age-days", "30",
|
|
)
|
|
}
|
|
|
|
tasks.matching { it.name == "preReleaseBuild" }.configureEach {
|
|
dependsOn(refreshFestData)
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.kotlinx.coroutines.android)
|
|
implementation(libs.androidx.core.ktx)
|
|
implementation(libs.androidx.activity.compose)
|
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
|
|
|
implementation(platform(libs.compose.bom))
|
|
implementation(libs.compose.ui)
|
|
implementation(libs.compose.material3)
|
|
implementation(libs.compose.ui.tooling.preview)
|
|
debugImplementation(libs.compose.ui.tooling)
|
|
|
|
implementation(libs.room.runtime)
|
|
ksp(libs.room.compiler)
|
|
|
|
implementation(libs.work.runtime)
|
|
implementation(libs.okhttp)
|
|
implementation(libs.kotlinx.serialization.json)
|
|
implementation(libs.kage)
|
|
|
|
testImplementation(libs.junit)
|
|
androidTestImplementation(libs.androidx.test.junit)
|
|
androidTestImplementation(libs.androidx.test.runner)
|
|
androidTestImplementation(libs.room.testing)
|
|
}
|