Skip to content

Commit

Permalink
Configure Room with Gradle plugin (#1475)
Browse files Browse the repository at this point in the history
* Migrate to Room Gradle plugin

> The plugin configures the project such that generated schemas (which are
> an output of the compile tasks and are consumed for auto-migrations) are
> correctly configured to have reproducible and cacheable builds.

https://developer.android.com/jetpack/androidx/releases/room#gradle-plugin

* Remove explicit configuration of room.incremental property

Incremental annotation processing is enabled by default:
https://developer.android.com/jetpack/androidx/releases/room#compiler-options

---------

Co-authored-by: Maxr1998 <[email protected]>
  • Loading branch information
3flex and Maxr1998 authored Jan 26, 2025
1 parent 06ffdfe commit a0b1bdf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
alias(libs.plugins.kotlin.ksp)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.androidx.room)
alias(libs.plugins.detekt)
alias(libs.plugins.android.junit5)
}
Expand Down Expand Up @@ -99,11 +100,9 @@ android {
abortOnError = false
sarifReport = true
}
}

ksp {
arg("room.schemaLocation", "$projectDir/schemas")
arg("room.incremental", "true")
room {
schemaDirectory("$projectDir/schemas")
}
}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-ksp = { id = "com.google.devtools.ksp", version.ref = "kotlin-ksp" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
androidx-room = { id = "androidx.room", version.ref = "androidx-room" }
android-junit5 = { id = "de.mannodermaus.android-junit5", version.ref = "android-junit5" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }

Expand Down

0 comments on commit a0b1bdf

Please sign in to comment.