Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement Hilt dependency validation as a task #4651

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

Reimplement Hilt dependency validation as a task

The Hilt Gradle Plugin validates that if applied Hilt's runtime and processor dependencies are also applied such that aggregated metadata is properly generated and not missed at the root. The validation was done during configuration time by inspecting dependencies but such strategy is not compatible with project isolation.

This commit changes the validation strategy to be done in a task that will be wired as a dependency to other common build tasks by being a 'source generating' task that doesn't actually generate any new sources. There is no Android Gradle Plugin API to hook into the compile or assemble tasks which is why addGeneratedSourceDirectory() is used.

Also add an Hilt Gradle Plugin option to disable the validation for project authors who which to disable it because it might not work well for their setup.

Fixes #4423

RELNOTES=Fix a Gradle project isolation issue in the Hilt Gradle Plugin.

@copybara-service copybara-service bot force-pushed the test_739201752 branch 4 times, most recently from 4e0dd23 to 8c74037 Compare March 26, 2025 14:43
The Hilt Gradle Plugin validates that if applied Hilt's runtime and processor dependencies are also applied such that aggregated metadata is properly generated and not missed at the root. The validation was done during configuration time by inspecting dependencies but such strategy is not compatible with project isolation.

This commit changes the validation strategy to be done in a task that will be wired as a dependency to other common build tasks by being a 'source generating' task that doesn't actually generate any new sources. There is no Android Gradle Plugin API to hook into the compile or assemble tasks which is why `addGeneratedSourceDirectory()` is used.

Also add an Hilt Gradle Plugin option to disable the validation for project authors who which to disable it because it might not work well for their setup.

Fixes #4423

RELNOTES=Fix a Gradle project isolation issue in the Hilt Gradle Plugin.
PiperOrigin-RevId: 739201752
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.

HiltGradlePlugin is not Gradle project isolation safe
1 participant