Skip to content

Use gradle plugin for Room to prevent it stopping caching#7712

Merged
CDRussell merged 1 commit intodevelopfrom
feature/craig/fix_room_schema_definitions_avoid_absolute_paths
Feb 10, 2026
Merged

Use gradle plugin for Room to prevent it stopping caching#7712
CDRussell merged 1 commit intodevelopfrom
feature/craig/fix_room_schema_definitions_avoid_absolute_paths

Conversation

@CDRussell
Copy link
Member

@CDRussell CDRussell commented Feb 10, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/task/1213076149941930

Description

Fixes Room schema export by switching to the Room Gradle plugin. Several modules were using annotationProcessorOptions to configure the schema location, but this only works with kapt, not KSP. Since Room is compiled with KSP in these modules, schemas weren't being exported.

Additionally (the original reason I was looking at this), absolute paths were being used which breaks Gradle caching.

Changes

  • Added androidx.room Gradle plugin to affected modules
  • Replaced annotationProcessorOptions and ksp { arg(...) } with the new room { schemaDirectory(...) }

Why the JSON schema changes/creation
Because many of the DB schema files were missing, and one was wrong. They've been missing for some time.

6 databases were affected:

Database Missing Schemas
AppDatabase versions 50-60
VpnDatabase versions 33-34
RemoteMessagingDatabase version 2
SitePermissionsDatabase versions 2-5
VoiceSearchDatabase version 2
BrokenSiteDatabase incorrect v1 schema

2 databases were already working (PirDatabase, Autofill databases) because they used the correct ksp { arg(...) } syntax already.

Why this matters

  • Enables Gradle build caching (absolute paths in old config broke cache keys)
  • Schema JSON files are now correctly exported for migration testing
  • Uses the officially recommended Room configuration method

Steps to test this PR

  • Fresh install develop, do some stuff in the app then install this branch. Verify no problems in the upgrade

Note

Medium Risk
Build config changes span many modules and regenerate schema artifacts; risk is mainly in build/cache behavior and Room migration test expectations rather than runtime logic.

Overview
Migrates Room schema export configuration to the official androidx.room Gradle plugin across multiple modules (including app, vpn-store, broken-site-store, remote-messaging-store, site-permissions-store, voice-search-store, experiments-impl, pir-impl, and autofill-impl). This removes the old annotationProcessorOptions/ksp { arg("room.schemaLocation", ...) } approach, switches schema paths to project-relative ($projectDir/schemas), and adds room { schemaDirectory(...) } plus schema assets wiring for tests.

Adds/updates Room exported schema JSONs for several databases (new versions for AppDatabase, VpnDatabase, RemoteMessagingDatabase, SitePermissionsDatabase, VoiceSearchDatabase) and corrects BrokenSiteDatabase v1 schema (primary key/identity hash), enabling migration testing and improving Gradle build cache reliability.

Written by Cursor Bugbot for commit 6b0827e. Configure here.

Current setup results in absolute paths being used which will result in cache-misses as we build between different machines or git worktrees
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@CDRussell CDRussell marked this pull request as ready for review February 10, 2026 14:02
Copy link
Contributor

@landomen landomen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-ran exp3 and confirmed the issue is fixed. Also tested update from develop to this branch and it works fine 💪

@CDRussell CDRussell merged commit 009c584 into develop Feb 10, 2026
18 of 19 checks passed
@CDRussell CDRussell deleted the feature/craig/fix_room_schema_definitions_avoid_absolute_paths branch February 10, 2026 16:23
nalcalag added a commit that referenced this pull request Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants