Split :core:kotlin into api and impl - #353
Merged
Merged
Conversation
Move the dispatcher and scope qualifiers into a plain-Kotlin :core:kotlin:api module and the Hilt modules into :core:kotlin:impl, so Hilt stays in an impl module. Consumers use the api. :app takes impl as runtimeOnly, and Hilt's aggregating task still installs its modules. :testing compiles against impl for TestDispatchersModule's replaces. In module-rules.txt, "hilt: :core:kotlin" is gone and the accepted "impl: :testing -> :core:kotlin:impl" is recorded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Upxj1FvQeDpycupKdPQHUZ
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.
Splits
:core:kotlinso that Hilt stays in an impl module, which resolves the module-rules violationhilt: :core:kotlin.:core:kotlin:api(plain Kotlin) holds the five qualifiers (IoDispatcher,DefaultDispatcher,MainDispatcher,MainImmediateDispatcher,ApplicationScope). The packagesoup.movie.commonis unchanged, so no sources change. It depends only onjavax.inject:javax.inject:1, a newjavax-injectcatalog entry that Dagger already puts on the app's classpath.:core:kotlin:implholdsDispatchersModuleandCoroutineScopesModuleand keeps the old build file (moop.android.library+moop.android.hilt).projects.core.kotlinnow declareprojects.core.kotlin.api.:apptakes impl asruntimeOnly. Hilt's aggregating task, on by default since Dagger 2.40 (this project uses 2.57.2), still installs its modules intoSingletonComponent.:testingcompiles against impl, becauseTestDispatchersModuleuses@TestInstallIn(replaces = [DispatchersModule::class]).module-rules.txt:hilt: :core:kotlinis gone, andimpl: :testing -> :core:kotlin:implis recorded as an accepted violation.Verification
./gradlew -q projectslists 53 projects, with:core:kotlin:apiand:core:kotlin:implunder the:core:kotlincontainer.:app:hiltJavaCompileDebugand:app:assembleDebug. The generated Hilt component containsDispatchersModule_Provides*FactoryandCoroutineScopesModule_ProvidesCoroutineScopeFactory, so theruntimeOnlyimpl modules are installed../gradlew dependencyGuard manifestShield proguardShieldFast moduleRulespasses. The dependencyGuard, manifestShield and proguardShield baselines are unchanged.π€ Generated with Claude Code
https://claude.ai/code/session_01Upxj1FvQeDpycupKdPQHUZ