// :core:fakes — scenario-driven fakes of every repository interface of SPEC §14.2.4. Only for tests, screenshot tests // and debug previews (the architecture check rejects it in release configurations). Computed values come from :domain. // M7x add their scenarios under src/main/kotlin/se/hagstedt/kvitt/fakes// and nowhere else (SPEC §11.3). plugins { id("kvitt.android.library") } dependencies { api(project(":core:model")) implementation(project(":domain")) testImplementation(libs.kotlinx.coroutines.test) } // The keyword table of the category suggestion (UX-3, SPEC §9.11 CS-6) is bundled as the Java resource // se/hagstedt/kvitt/fakes/category-keywords.csv, copied from contracts/category-keywords.csv at build time (never // hand-copied). A missing table fails the build: the task's input file must exist. abstract class CopyCategoryKeywords : DefaultTask() { @get:InputFile @get:PathSensitive(PathSensitivity.NONE) abstract val table: RegularFileProperty @get:Input abstract val resourcePath: Property @get:OutputDirectory abstract val outputDir: DirectoryProperty @TaskAction fun copy() { val source = table.get().asFile if (!source.isFile) throw GradleException("missing ${source.path}") val root = outputDir.get().asFile root.deleteRecursively() val target = root.resolve(resourcePath.get()) target.parentFile.mkdirs() source.copyTo(target) } } val categoryKeywordsTable = rootProject.layout.projectDirectory.file("../contracts/category-keywords.csv") val copyCategoryKeywords = tasks.register("copyCategoryKeywords") { description = "Copies contracts/category-keywords.csv into the main Java resources." table.set(categoryKeywordsTable) resourcePath.set("se/hagstedt/kvitt/fakes/category-keywords.csv") outputDir.set(layout.buildDirectory.dir("generated/category-keywords")) } androidComponents { onVariants { variant -> variant.sources.resources?.addGeneratedSourceDirectory(copyCategoryKeywords, CopyCategoryKeywords::outputDir) } }