Skip to content

refactor: return lazy Provider from DependencyUtil.resolveArtifacts#381

Open
timothyfroehlich wants to merge 1 commit intomainfrom
refactor-lazy-provider
Open

refactor: return lazy Provider from DependencyUtil.resolveArtifacts#381
timothyfroehlich wants to merge 1 commit intomainfrom
refactor-lazy-provider

Conversation

@timothyfroehlich
Copy link
Member

Refactors artifact resolution to return a lazy Provider<Map<String, ArtifactFiles>> instead of an eager Map.

This addresses technical debt identified in PR #365 by moving away from project.provider wrapping and ensuring task inputs are correctly wired through the Lazy Configuration API.

@timothyfroehlich timothyfroehlich self-assigned this Mar 10, 2026
@timothyfroehlich timothyfroehlich force-pushed the refactor-lazy-provider branch 2 times, most recently from e7f310d to dff5638 Compare March 11, 2026 19:27
Refactors artifact resolution to return a lazy Provider<Map<String, ArtifactFiles>> instead of an eager Map.

- Introduced private performResolution helper to reduce indentation while maintaining laziness.
- Scoped baseDir calculation within task registration for better readability.
- Updated DependencyResolutionTest to handle the new Provider return type.
*/
static Map<String, ArtifactFiles> resolveArtifacts(Project project, Configuration runtimeConfiguration) {
static Provider<Map<String, ArtifactFiles>> resolveArtifacts(Project project, Configuration runtimeConfiguration) {
return project.provider { performResolution(project, runtimeConfiguration) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not need to do this. The idea is that we should take runtimeConfiguration and use that to create a lazy FileCollection without wrapping it in project.provider.

Right now we are doing eager work and instead it should be lazy. Happy to discuss over GVC if that's helpful.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll be good for me to figure this out on my own. I think my Gradle skills have atrophied a bit and I need to catch up with Gradle 9+ and AGP 9+ anyways.

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.

2 participants