Files
kvitt/android/data/build.gradle.kts
T
jacobh2 e4e6e5d792 Android overhaul: one CopyCategoryKeywords task in build-logic instead of a copy in :data and :core:fakes
The task class and its wiring were duplicated verbatim in both build scripts; bundleCategoryKeywords(resourcePath)
registers it once per module. Resource paths and inputs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
2026-10-18 23:13:12 +02:00

60 lines
2.7 KiB
Kotlin

import se.hagstedt.kvitt.buildlogic.bundleCategoryKeywords
import se.hagstedt.kvitt.buildlogic.categoryKeywordsTable
// :data — Room database, Ktor client, token store, sync engine, WorkManager workers, the real repositories and the APK
// updater (SPEC §6.2, §14.2, §14.4). Hilt modules here provide the implementations; :app binds the :core:model
// interfaces to them.
plugins {
id("kvitt.android.library")
id("kvitt.android.hilt")
alias(libs.plugins.ksp)
alias(libs.plugins.room3)
alias(libs.plugins.kotlin.serialization)
}
room3 {
schemaDirectory("$projectDir/schemas")
}
dependencies {
implementation(project(":core:model"))
implementation(project(":domain"))
implementation(libs.androidx.room3.runtime)
ksp(libs.androidx.room3.compiler)
implementation(libs.androidx.sqlite.bundled)
implementation(libs.androidx.datastore.preferences)
implementation(libs.androidx.work.runtime.ktx)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.okhttp)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.datetime)
implementation(libs.coil)
implementation(libs.coil.network.ktor3)
testImplementation(libs.ktor.client.mock)
testImplementation(libs.androidx.work.testing)
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.robolectric)
}
// Unit tests read the shared examples (SPEC §14.3.5) and the exported Room schemas (§14.2.3) in place; both are inputs,
// so a changed contract file re-runs the tests.
val contractsExamples = rootProject.layout.projectDirectory.dir("../contracts/examples")
val roomSchemas = layout.projectDirectory.dir("schemas")
val keywordsTable = categoryKeywordsTable()
tasks.withType<Test>().configureEach {
inputs.dir(contractsExamples).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName("contractsExamples")
inputs.dir(roomSchemas).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName("roomSchemas")
systemProperty("kvitt.contracts.examples", contractsExamples.asFile.absolutePath)
systemProperty("kvitt.room.schemas", roomSchemas.asFile.absolutePath)
inputs.file(keywordsTable).withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName("categoryKeywords")
systemProperty("kvitt.contracts.keywords", keywordsTable.asFile.absolutePath)
}
// The keyword table of the category suggestion (UX-3, SPEC §9.11 CS-6), bundled as the Java resource
// se/hagstedt/kvitt/data/category-keywords.csv.
bundleCategoryKeywords("se/hagstedt/kvitt/data/category-keywords.csv")