tilfluktsrom/app/build.gradle.kts
Ole-Morten Duesund d0460cd686 Bundle shelter data in APK and add shared versioning
- Add scripts/fetch-shelters.sh: downloads Geonorge data, converts
  UTM33N→WGS84 via PWA script, copies to both Android assets and
  PWA public dirs
- Bundle pre-processed shelters.json (556 shelters) in APK assets
  so the app works immediately on first launch with no network
- ShelterRepository.seedFromAsset(): seeds Room DB from bundled
  JSON on first launch, marks as stale so network refresh is
  attempted in the background
- MainActivity.loadData(): seeds from asset before trying network,
  always attempts background refresh when data is stale
- Add version.properties (1.1.0, versionCode=2) as single source
  of truth for versioning
- build.gradle.kts reads version from properties file and exposes
  via BuildConfig
- Bump PWA version to 1.1.0 to match

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:33:38 +01:00

83 lines
2.5 KiB
Kotlin

import java.util.Properties
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.devtools.ksp")
}
// Read version from shared version.properties
val versionProps = Properties().apply {
rootProject.file("version.properties").inputStream().use { load(it) }
}
android {
namespace = "no.naiv.tilfluktsrom"
compileSdk = 35
defaultConfig {
applicationId = "no.naiv.tilfluktsrom"
minSdk = 26
targetSdk = 35
versionCode = versionProps.getProperty("versionCode").toInt()
versionName = "${versionProps.getProperty("versionMajor")}." +
"${versionProps.getProperty("versionMinor")}." +
versionProps.getProperty("versionPatch")
// Make version available in BuildConfig
buildConfigField("String", "VERSION_DISPLAY", "\"$versionName\"")
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
buildFeatures {
viewBinding = true
buildConfig = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
}
dependencies {
// AndroidX
implementation("androidx.core:core-ktx:1.13.1")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.activity:activity-ktx:1.9.3")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.constraintlayout:constraintlayout:2.2.0")
// Room (local database for shelter cache)
implementation("androidx.room:room-runtime:2.6.1")
implementation("androidx.room:room-ktx:2.6.1")
ksp("androidx.room:room-compiler:2.6.1")
// OkHttp (HTTP client for data downloads)
implementation("com.squareup.okhttp3:okhttp:4.12.0")
// OSMDroid (offline-capable OpenStreetMap)
implementation("org.osmdroid:osmdroid-android:6.1.20")
// Google Play Services Location (precise GPS)
implementation("com.google.android.gms:play-services-location:21.3.0")
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
}