fix(build): isolate ML Kit GenAI to the Google flavor (fix F-Droid rb-check)#5824
Merged
Conversation
…-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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The F-Droid reproducible-build check (
rb-check) is failing onmain: thefdroidReleaseAPK contains proprietary Google libraries (com/google/firebase,com/google/android/gms,com/google/mlkit,com/google/android/datatransport). The root cause is that:feature:discoverydeclaredmlkit-genai-promptas a plain (non-flavor-scoped)androidMaindependency, andandroidApppulls:feature:discoveryinto 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:docsAI seam.🐛 Bug Fixes
fdroidReleaseAPK no longer contains ML Kit / Firebase / GMS / datatransport classes —rb-checkStep 4 (proprietary-library dex scan) passes again.🛠️ Refactoring & Architecture
:feature:docsAI-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.GeminiNanoSummaryProviderout of:feature:discovery/androidMainintoandroidApp/src/google/.../app/discovery/; bound viaGoogleAiModule.FdroidAiModule) and Desktop (DesktopKoinModule).🧩 KMP Migration Milestone
AlgorithmicSummaryProviderfrom:feature:discovery/jvmMain→commonMainand registered it with@Single(binds = []), so the deterministic fallback is injectable on every platform (Android F-Droid, Desktop, iOS) and theDiscoverySummaryAiProviderinterface is bound explicitly per platform/flavor (Gemini Nano on Google, algorithmic elsewhere).🧹 Chores
mlkit-genai-promptfrom:feature:discovery; added it as agoogleImplementationonandroidApp(Google-flavor only).Verification Performed
:androidApp:dependencies --configuration fdroidReleaseRuntimeClasspath→ nomlkit/firebase/play-services/gms/datatransport/genai(leak gone);googleReleaseRuntimeClasspathstill resolvescom.google.mlkit:genai-prompt.:androidApp:testFdroidDebugUnitTest+:androidApp:testGoogleDebugUnitTest(KoinVerificationTestpasses — the new per-flavor bindings resolve).:feature:discovery:allTests,:desktopApp:test, andspotlessCheck+detektall pass.