Skip to content

Migrate Dependency injection intro and manual DI snippets - #1170

Open
djubinville wants to merge 1 commit into
android:mainfrom
djubinville:djubinville/di-intro-manual-snippets
Open

djubinville wants to merge 1 commit into
android:mainfrom
djubinville:djubinville/di-intro-manual-snippets

Conversation

@djubinville

Copy link
Copy Markdown
Contributor

Code snippets are for:

List of modifications:

  • Dependency-injection page: Wrapped each Car and main example (android_di_intro_car_no_di, android_di_intro_car_constructor_di, android_di_intro_car_field_di, android_di_intro_service_locator) in its own private object outside the region tags so all four snippets compile in the same file with zero visible changes from the guide page.
  • Manual page: Replaced uncompilable { ... } class bodies with { /* ... */ } in android_di_manual_repositories so the UserRepository, UserLocalDataSource, and UserRemoteDataSource declarations compile.
  • Manual page: Replaced the whole-line ellipsis placeholders inside AppContainer in android_di_manual_app_container_factory and android_di_manual_login_container with plain // [START_EXCLUDE] / // [END_EXCLUDE] blocks defining localDataSource and remoteDataSource so userRepository compiles while still rendering ... on the guide page.
  • Manual page: Added trailing full stops to natural-language comments in android_di_manual_app_container_basic, android_di_manual_my_application, android_di_manual_factory, android_di_manual_app_container_factory, and android_di_manual_login_container, and formatted indentation with Spotless.

Snippets not migrated:

  • Dependency-injection page: Lines 72-89, 133-155, 206-227, and 307-343 because they are obsolete Java duplicates of the migrated Kotlin snippets and were removed from the guide page.

@djubinville
djubinville marked this pull request as ready for review October 13, 2026 19:38
@djubinville
djubinville requested a review from a team as a code owner October 13, 2026 19:38
@snippet-bot

snippet-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 13 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@djubinville
djubinville force-pushed the djubinville/di-intro-manual-snippets branch 2 times, most recently from 76cd11c to 2e9a3f9 Compare October 15, 2026 18:16
@djubinville

Copy link
Copy Markdown
Contributor Author

Local Build & Spotless Verification (G1, commit 2e9a3f98)

Per review item G1 (D19), here is the local ./gradlew :compose:snippets:build :compose:snippets:spotlessCheck --console=plain output on head commit 2e9a3f98 while the GitHub Actions workflows await maintainer approval:

> Task :compose:snippets:spotlessKotlin
> Task :compose:snippets:spotlessKotlinCheck
> Task :compose:snippets:spotlessCheck
> Task :compose:snippets:kspDebugKotlin
> Task :compose:snippets:compileDebugKotlin
> Task :compose:snippets:compileDebugJavaWithJavac
> Task :compose:snippets:assembleDebug
> Task :compose:snippets:testDebugUnitTest NO-SOURCE
> Task :compose:snippets:lintDebug
> Task :compose:snippets:check
> Task :compose:snippets:assembleRelease
> Task :compose:snippets:build

BUILD SUCCESSFUL in 5m 29s
118 actionable tasks: 76 executed, 27 from cache, 15 up-to-date

Could a maintainer please approve the pending Build snippets and Apply spotless GitHub Actions workflow runs for this PR?

Documented Rule Bypass (G3)

  • G3 — Rule D23 Step 3 (SKILL.md L163-164, unruled same-line { ... } body placeholder):
    • Action & Reasoning: Retained one-line { /* ... */ } for empty class bodies in android_di_manual_repositories (ManualDi.kt) so the UserRepository, UserLocalDataSource, and UserRemoteDataSource declarations compile while preserving the guide page's single-line body structure (matching main and PRs Migrate Dagger dependency injection snippets #1171 and Migrate Hilt dependency injection snippets #1172).
    • Rule Compliance Update: Update D23 in SKILL.md to codify replacing single-line { ... } class/interface body placeholders with { /* ... */ } (reported under D14) when no hidden members are required for compilation.

@djubinville
djubinville force-pushed the djubinville/di-intro-manual-snippets branch 5 times, most recently from 146c634 to 60941ce Compare October 21, 2026 17:46
@djubinville
djubinville force-pushed the djubinville/di-intro-manual-snippets branch from 60941ce to 9492bed Compare October 22, 2026 12:38

This branch has not been deployed

No deployments
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