Skip to content

fix(build): isolate ML Kit GenAI to the Google flavor (fix F-Droid rb-check)#5824

Merged
jamesarich merged 1 commit into
mainfrom
claude/reverent-cerf-e8c169
Jun 17, 2026
Merged

fix(build): isolate ML Kit GenAI to the Google flavor (fix F-Droid rb-check)#5824
jamesarich merged 1 commit into
mainfrom
claude/reverent-cerf-e8c169

Conversation

@jamesarich

Copy link
Copy Markdown
Collaborator

The F-Droid reproducible-build check (rb-check) is failing on main: the fdroidRelease APK contains proprietary Google libraries (com/google/firebase, com/google/android/gms, com/google/mlkit, com/google/android/datatransport). The root cause is that :feature:discovery declared mlkit-genai-prompt as a plain (non-flavor-scoped) androidMain dependency, and androidApp pulls :feature:discovery into both flavors — so ML Kit GenAI (and its transitive play-services/Firebase/datatransport deps) leaked into the FOSS build. This fix isolates the proprietary on-device-AI code to the Google flavor, mirroring the existing :feature:docs AI seam.

🐛 Bug Fixes

  • F-Droid fdroidRelease APK no longer contains ML Kit / Firebase / GMS / datatransport classes — rb-check Step 4 (proprietary-library dex scan) passes again.

🛠️ Refactoring & Architecture

  • Reuse the :feature:docs AI-seam pattern for discovery summaries: the on-device provider lives in the Google flavor source set and the interface is bound per-flavor via Koin.
  • Moved GeminiNanoSummaryProvider out of :feature:discovery/androidMain into androidApp/src/google/.../app/discovery/; bound via GoogleAiModule.
  • Bound the algorithmic fallback for F-Droid (FdroidAiModule) and Desktop (DesktopKoinModule).

🧩 KMP Migration Milestone

  • Moved AlgorithmicSummaryProvider from :feature:discovery/jvmMaincommonMain and registered it with @Single(binds = []), so the deterministic fallback is injectable on every platform (Android F-Droid, Desktop, iOS) and the DiscoverySummaryAiProvider interface is bound explicitly per platform/flavor (Gemini Nano on Google, algorithmic elsewhere).

🧹 Chores

  • Removed mlkit-genai-prompt from :feature:discovery; added it as a googleImplementation on androidApp (Google-flavor only).

Verification Performed

  • :androidApp:dependencies --configuration fdroidReleaseRuntimeClasspathno mlkit/firebase/play-services/gms/datatransport/genai (leak gone); googleReleaseRuntimeClasspath still resolves com.google.mlkit:genai-prompt.
  • Koin graph verified for both flavors: :androidApp:testFdroidDebugUnitTest + :androidApp:testGoogleDebugUnitTest (KoinVerificationTest passes — the new per-flavor bindings resolve).
  • :feature:discovery:allTests, :desktopApp:test, and spotlessCheck + detekt all pass.

…-check)

The :feature:discovery module declared mlkit-genai-prompt as a plain
(non-flavor-scoped) androidMain dependency, and androidApp pulls discovery
into BOTH flavors. ML Kit GenAI transitively drags in play-services,
Firebase and datatransport, so the F-Droid (FOSS) APK ended up containing
com/google/{mlkit,firebase,android.gms,android.datatransport} — failing the
reproducible-build proprietary-library dex scan (rb-check) on main.

Mirror the existing feature:docs AI seam: keep the Gemini Nano provider in
the Google flavor source set and bind the algorithmic fallback for F-Droid.

- Move GeminiNanoSummaryProvider out of :feature:discovery/androidMain into
  androidApp/src/google; bind it via GoogleAiModule. Add mlkit-genai-prompt
  as a googleImplementation on androidApp.
- Move AlgorithmicSummaryProvider jvmMain -> commonMain (@single(binds = []))
  so it is injectable on every platform; bind it for F-Droid (FdroidAiModule)
  and Desktop (DesktopKoinModule).
- Remove the mlkit-genai-prompt dependency from :feature:discovery.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the bugfix PR tag label Jun 17, 2026
@jamesarich jamesarich merged commit f2769a3 into main Jun 17, 2026
17 checks passed
@jamesarich jamesarich deleted the claude/reverent-cerf-e8c169 branch June 17, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR tag

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant