FEST: in-repo flattener bundles slim.json; release builds auto-refresh when stale
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>
This commit is contained in:
parent
9b5817fcef
commit
293ca212ec
6 changed files with 260 additions and 15 deletions
|
|
@ -71,6 +71,24 @@ android {
|
|||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue