Skip to content

Add Hilt testing manifest activity artifact#5220

Open
loganrosen wants to merge 1 commit into
google:masterfrom
loganrosen:loganrosen-hilt-component-activity
Open

Add Hilt testing manifest activity artifact#5220
loganrosen wants to merge 1 commit into
google:masterfrom
loganrosen:loganrosen-hilt-component-activity

Conversation

@loganrosen

Copy link
Copy Markdown

Fixes #3394.

Summary

  • Add com.google.dagger:hilt-android-testing-manifest, a small published AAR with dagger.hilt.android.testing.HiltComponentActivity and a manifest activity entry for Hilt Android tests.
  • Wire Gradle/Bazel publishing, artifact validation, release deploy, API tracking, and coalesced Javadocs.
  • Add a consumer-shaped Hilt fixture instrumentation test that launches the activity from the manifest artifact and verifies ActivityComponent access.

Validation

  • :hilt-android-testing-manifest:assembleDebug
  • :hilt-android-testing-manifest:apiCheck
  • :hilt-android-testing-manifest:publishToMavenLocal
  • bazelisk build --noshow_progress //hilt-android-testing-manifest:artifact
  • bazelisk build --noshow_progress //:user-docs
  • Hilt simple fixture :app:assembleFreeDebug, :app:assembleFreeDebugAndroidTest, :app:assembleProDebug, :app:assembleProDebugAndroidTest
  • :app:connectedFreeDebugAndroidTest filtered to dagger.hilt.android.simple.HiltComponentActivityTest
  • Scratch Now in Android replacement trial with focused Robolectric tests against the new artifact

Adds a small published Android AAR containing a Hilt-enabled ComponentActivity and manifest entry for tests that launch activities through ActivityScenario or Compose rules.

Also wires Gradle/Bazel publishing, artifact validation, coalesced Javadocs, and a consumer-shaped Hilt fixture instrumentation test.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2b0862cb-279b-4d8c-9ab0-53f462a5037c
@loganrosen

Copy link
Copy Markdown
Author

@Chang-Eric would you be the right person to review this, or could you redirect me to the current Hilt Android reviewer? This implements the convenience Hilt test activity discussed in #3394.

@bcorso

bcorso commented Jul 23, 2026

Copy link
Copy Markdown

@loganrosen I can review this.

One high-level question here -- is it required/preferred for this to be a separate artifact rather than putting it in the existing hilt-android-testing artifact?

@loganrosen

loganrosen commented Jul 24, 2026

Copy link
Copy Markdown
Author

@bcorso thanks, I appreciate it.

I don't think a separate artifact is strictly required, but I chose it to keep the dependency shape narrow. The activity's manifest entry has to be merged into the target app/debug APK, so consumers need this on debugImplementation or equivalent. Their normal androidTestImplementation("hilt-android-testing") dependency would not contribute the activity declaration to the app manifest.

If we put this in hilt-android-testing, consumers could add that artifact to debugImplementation, but that would also pull the full Hilt testing API/dependency surface into the app variant just to get one manifest activity. For example, hilt-android-testing currently exposes test-facing deps like JUnit and AndroidX Test Core as API deps.

The separate artifact is meant to mirror the AndroidX ui-test-manifest pattern: app/debug gets only the reusable activity + manifest entry, while tests keep using hilt-android-testing for HiltAndroidRule, @HiltAndroidTest, etc. That said, I'm happy to fold it into hilt-android-testing if you prefer that API shape.

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.

[Hilt] FR: Create a HiltComponentActivity artifact

2 participants