- Added a new Room Gradle Plugin artifact with id androidx.room that configures schema inputs and outputs for Room compilation
- Added a room { schemaDirectory(...) } DSL to configure the base schema location for the Room Gradle Plugin
- The Room Gradle Plugin outputs schema files into flavored folders so that generated schemas are correctly configured for reproducible and cacheable builds
- RoomDatabase.QueryCallback is now defined as a functional interface to allow SAM conversion usages
- Resolved an issue when instantiating the database in Robolectric after the migration of Room sources from Java to Kotlin
From Room
Room Gradle Plugin This new release contains a new artifact for the Room Gradle Plugin with id androidx.room, which solves various existing issues in Room regarding having inputs and outputs of schemas via Gradle annotation processor options. The Room Gradle Plugin configures the project such that generated schemas that are consumed for auto-migrations and are output of the compile tasks are correctly configured to have reproducible and cacheable builds. The plugin offers a DSL to configure the base schema location: room { schemaDirectory("$projectDir/schemas/") } The plugin will then configure the Room compiler and the various compile tasks and its backends (javac, KAPT, KSP) to output schema files into flavored folders, i.e. schemas/flavorOneDebug/com.package.MyDatabase/1.json. As usual these files are checks-in into the repository to be used for validation and auto-migrations. Upon migrating to using the plugin instead of the annotation processor options the existing schema files must be copied to the generated flavor directories created by the plugin, this is a one-time migration operation that must be done manually. The schema documentation in developers.android.com will be updated in the future once feedback is addressed and the plugin reaches stable, so please give it a try. API Changes RoomDatabase.QueryCallback has been defined as a functional interface to allow SAM conversion usages. ( Iab8ea, b/281008549) Bug Fixes Resolving issue arising when instantiating the database in Robolectric after the migration of Room sources from Java to Kotlin. ( Ic053c, b/274924903)