Files
Klottr/app/build.gradle.kts
Fabian Norlin 56752ab1f4 feat(shared): add DM lookupByIdentifier/getDetailText and delegate Android DigitaltMuseum to shared Ktor client
refactor(app): switch image stream to ByteArray and delegate get_image.php to shared client
chore(app): remove OkHttp dependency after DM migration to shared
docs(shared): add thorough comments to DigitaltMuseumShared (no logic changes)
2025-09-07 10:43:41 +02:00

129 lines
4.3 KiB
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import java.time.Instant
import java.util.Properties
// import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
plugins {
id("org.jetbrains.kotlin.plugin.compose")
id("com.android.application")
kotlin("android")
id("com.google.devtools.ksp") version "2.0.21-1.0.26"
}
// === Läs local.properties utan java.util.Properties ===
val localProps: Map<String, String> = run {
val file = rootProject.file("local.properties")
if (!file.exists()) emptyMap()
else file.readLines()
.asSequence()
.map { it.trim() }
.filter { it.isNotEmpty() && !it.startsWith("#") && it.contains("=") }
.map {
val i = it.indexOf('=')
val k = it.substring(0, i).trim()
val v = it.substring(i + 1).trim()
k to v
}
.toMap()
}
val klLogDebug = localProps["KLLOG_DEBUG"]?.toBoolean() ?: false
val klLogHttpDebug = localProps["KLLOG_HTTP_DEBUG"]?.toBoolean() ?: false
fun propOrEmpty(key: String) = localProps[key] ?: ""
// ======================================================
android {
namespace = "app.klottr"
compileSdk = 35
defaultConfig {
applicationId = "app.klottr"
minSdk = 26
targetSdk = 35
versionCode = 14
versionName = "0.3.0"
// Byggtid i UTC (ISO 8601) genereras vid build-konfiguration
val buildTimeUtc = Instant.now().toString()
buildConfigField("String", "BUILD_TIME_UTC", "\"$buildTimeUtc\"")
buildConfigField("String", "APP_NAME", "\"Klottr\"")
// BuildConfig-fält (åtkomst i Kotlin via BuildConfig.X)
buildConfigField("String", "SERVER_API_BASE_URL", "\"${propOrEmpty("SERVER_API_BASE_URL")}\"")
buildConfigField("String", "SERVER_API_KEY", "\"${propOrEmpty("SERVER_API_KEY")}\"")
buildConfigField("String", "WEB_CLIENT_ID", "\"${propOrEmpty("WEB_CLIENT_ID")}\"")
// Skicka Maps‑nyckeln som manifest‑placeholder (används i AndroidManifest.xml)
manifestPlaceholders["MAPS_API_KEY"] = propOrEmpty("MAPS_API_KEY")
// Digitalt Museum
buildConfigField("String", "DM_API_KEY", "\"${propOrEmpty("DM_API_KEY")}\"")
buildConfigField("String", "DM_OWNERS", "\"${propOrEmpty("DM_OWNERS")}\"")
buildConfigField("boolean", "KLLOG_DEBUG", klLogDebug.toString())
buildConfigField("boolean", "KLLOG_HTTP_DEBUG", klLogHttpDebug.toString())
}
buildFeatures {
compose = true
buildConfig = true
}
kotlinOptions { jvmTarget = "17" }
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
dependencies {
// Compose
val composeBom = platform("androidx.compose:compose-bom:2025.01.00")
implementation(project(":shared"))
implementation(composeBom)
androidTestImplementation(composeBom)
implementation("androidx.activity:activity-compose:1.9.3")
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.material3:material3:1.3.0")
implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")
implementation("com.google.android.material:material:1.12.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.9.0")
// Google Maps (Compose + Play Services)
implementation("com.google.maps.android:maps-compose:4.4.1")
implementation("com.google.android.gms:play-services-maps:18.2.0")
// Google Sign-In
implementation("com.google.android.gms:play-services-auth:21.2.0")
// Lifecycle
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.6")
// Room
val room = "2.7.2"
implementation("androidx.room:room-runtime:$room")
ksp("androidx.room:room-compiler:$room")
implementation("androidx.room:room-ktx:$room")
// Play Services Location
implementation("com.google.android.gms:play-services-location:21.3.0")
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
// WorkManager (valfritt, ej nödvändigt här)
implementation("androidx.work:work-runtime-ktx:2.9.1")
}
androidComponents {
onVariants { v ->
println("### Klottr: variant=${v.name}, applicationId=${v.applicationId.get()}")
}
}