Skip to content

Split :core:kotlin into api and impl - #353

Merged
fornewid merged 1 commit into
developfrom
split-core-kotlin
Oct 4, 2026
Merged

fornewid merged 1 commit into
developfrom
split-core-kotlin

Conversation

@fornewid

@fornewid fornewid commented Oct 4, 2026

Copy link
Copy Markdown
Member

Splits :core:kotlin so that Hilt stays in an impl module, which resolves the module-rules violation hilt: :core:kotlin.

  • :core:kotlin:api (plain Kotlin) holds the five qualifiers (IoDispatcher, DefaultDispatcher, MainDispatcher, MainImmediateDispatcher, ApplicationScope). The package soup.movie.common is unchanged, so no sources change. It depends only on javax.inject:javax.inject:1, a new javax-inject catalog entry that Dagger already puts on the app's classpath.
  • :core:kotlin:impl holds DispatchersModule and CoroutineScopesModule and keeps the old build file (moop.android.library + moop.android.hilt).
  • The 15 modules that declared projects.core.kotlin now declare projects.core.kotlin.api.
  • :app takes impl as runtimeOnly. Hilt's aggregating task, on by default since Dagger 2.40 (this project uses 2.57.2), still installs its modules into SingletonComponent.
  • :testing compiles against impl, because TestDispatchersModule uses @TestInstallIn(replaces = [DispatchersModule::class]).

module-rules.txt: hilt: :core:kotlin is gone, and impl: :testing -> :core:kotlin:impl is recorded as an accepted violation.

Verification

  • ./gradlew -q projects lists 53 projects, with :core:kotlin:api and :core:kotlin:impl under the :core:kotlin container.
  • All modules compile (Android debug main, unit test and androidTest, plus JVM), and so do :app:hiltJavaCompileDebug and :app:assembleDebug. The generated Hilt component contains DispatchersModule_Provides*Factory and CoroutineScopesModule_ProvidesCoroutineScopeFactory, so the runtimeOnly impl modules are installed.
  • ./gradlew dependencyGuard manifestShield proguardShieldFast moduleRules passes. The dependencyGuard, manifestShield and proguardShield baselines are unchanged.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01Upxj1FvQeDpycupKdPQHUZ

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
@fornewid
fornewid merged commit 43989b7 into develop Oct 4, 2026
1 check passed
@fornewid
fornewid deleted the split-core-kotlin branch October 4, 2026 06:14
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.

1 participant