diff --git a/build.gradle.kts b/build.gradle.kts index e84c295..b7a400c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,6 +12,7 @@ plugins { alias(libs.plugins.kotlin.android).apply(false) alias(libs.plugins.kotlin.multiplatform).apply(false) alias(libs.plugins.kotlinter).apply(false) + alias(libs.plugins.room).apply(false) } apply(from = "buildscripts/githooks.gradle") diff --git a/buildscripts/setup.gradle b/buildscripts/setup.gradle index 9baa924..2471a90 100644 --- a/buildscripts/setup.gradle +++ b/buildscripts/setup.gradle @@ -97,6 +97,23 @@ def tasksToExclude = [ "generateResourceAccessors", "generateServiceApolloSources", "prepareComposeResourcesTask", + "extractDeepLinksDebug", + "generateDebug", + "generateRelease", + "compileDebug", + "compileRelease", + "checkDebug", + "checkRelease", + "processDebug", + "processRelease", + "packageDebug", + "packageRelease", + "parseDebug", + "parseRelease", + "mergeDebug", + "mergeRelease", + "mapDebug", + "mapRelease", ] project('shared').tasks.named { taskName -> diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7c112cf..f8eaf6c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,6 +24,7 @@ leakCanary = "2.14" material = "1.13.0" material3Adaptive = "1.2.0" minSdk = "23" +room = "2.8.4" sqldelight = "2.2.1" testParameterInjector = "1.20" @@ -33,6 +34,9 @@ androidx-activity-compose = { module = "androidx.activity:activity-compose", ver androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastore" } androidx-lifecycle-viewmodel = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-viewmodel", version.ref = "androidxLifecycle" } androidx-lifecycle-runtime-compose = { group = "org.jetbrains.androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidxLifecycle" } +androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" } +androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } +androidx-room-runtime-android = { module = "androidx.room:room-runtime-android", version.ref = "room" } androidx-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" } androidx-test-junit = { module = "androidx.test.ext:junit", version.ref = "androidxTest" } apollo-runtime = { module = "com.apollographql.apollo:apollo-runtime", version.ref = "apollo" } @@ -75,4 +79,5 @@ kotlin-compose = { id = "org.jetbrains.compose", version.ref = "kmpCompose" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlinter = { id = "org.jmailen.kotlinter", version.ref = "kotlinter" } -parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } \ No newline at end of file +parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } +room = { id = "androidx.room", version.ref = "room" } \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 95839c8..f23aa14 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -9,9 +9,11 @@ plugins { alias(libs.plugins.apollo.graphql) alias(libs.plugins.cash.sqldelight) alias(libs.plugins.compose.compiler) + alias(libs.plugins.google.devtools.ksp) alias(libs.plugins.kotlin.compose) alias(libs.plugins.kotlin.multiplatform) alias(libs.plugins.kotlinx.serialization) + alias(libs.plugins.room) } kotlin { @@ -36,6 +38,10 @@ kotlin { jvm("desktop") sourceSets { + androidMain.dependencies { + implementation(libs.androidx.room.runtime.android) + } + commonMain.dependencies { implementation(compose.runtime) implementation(compose.foundation) @@ -46,6 +52,7 @@ kotlin { implementation(libs.androidx.datastore.preferences) implementation(libs.androidx.lifecycle.viewmodel) implementation(libs.androidx.lifecycle.runtime.compose) + implementation(libs.androidx.room.runtime) implementation(libs.apollo.runtime) implementation(libs.cash.sqldelight.coroutines) implementation(libs.cash.sqldelight.runtime) @@ -119,6 +126,19 @@ android { namespace = "template.shared" } +dependencies { + // KSP configuration for Room code generation + add("kspCommonMainMetadata", libs.androidx.room.compiler) + add("kspAndroid", libs.androidx.room.compiler) + add("kspIosX64", libs.androidx.room.compiler) + add("kspIosArm64", libs.androidx.room.compiler) + add("kspIosSimulatorArm64", libs.androidx.room.compiler) +} + +room { + schemaDirectory("$projectDir/schemas") +} + sqldelight { databases { create("AppDatabase") {