refactor(oss-licenses): replace eager dependency resolution with lazy ArtifactView providers#381
Draft
timothyfroehlich wants to merge 4 commits intotestappfrom
Draft
refactor(oss-licenses): replace eager dependency resolution with lazy ArtifactView providers#381timothyfroehlich wants to merge 4 commits intotestappfrom
timothyfroehlich wants to merge 4 commits intotestappfrom
Conversation
dff5638 to
d84b4a3
Compare
liutikas
reviewed
Mar 11, 2026
...nses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/DependencyUtil.groovy
Outdated
Show resolved
Hide resolved
66c7d5d to
64a11e5
Compare
64a11e5 to
b9839ad
Compare
Member
Author
|
@liutikas I did a full rewrite to get things right and managed to significantly simplify things in the process. The Licenses task now separate arguments consisting of the I did use Gemini to help me get it straight, and had it add comments to help me (or other maintainers) remember for next time. I'm running an extra --scan now to double check things, but it should be pretty clean. |
Collaborator
|
I'm out of office for a week. I'll review this when I get back |
5 tasks
… ArtifactView providers Replace the DependencyUtil helper and ArtifactFiles wrapper with lazy Provider-based artifact resolution directly in OssLicensesPlugin. This ensures dependency resolution happens at task execution time rather than during configuration, which is required for Configuration Cache compatibility and avoids slowing down Android Studio sync. Key changes: - Use ArtifactView.resolvedArtifacts (returns Provider) instead of eagerly iterating configuration.incoming.artifacts - Split the single @nested MapProperty<String, ArtifactFiles> into two @internal MapProperty<String, File> properties (libraryFilesByGav, pomFilesByGav) to avoid expensive redundant hashing of immutable Maven artifacts - Extract DependencyHandler into a local variable before entering lazy closures to avoid capturing the non-serializable Project object - Move ABSENT_ARTIFACT constant from deleted DependencyUtil to DependencyTask where it is used - Delete ArtifactFiles, DependencyUtil, and DependencyResolutionTest (coverage provided by existing EndToEnd integration tests)
Add assertion to testConfigurationCache that fails if Gradle logs "resolved during configuration time", catching any regression where artifact resolution leaks back into the configuration phase.
This was surfaced by the test app being introduced in #380
b1c72e0 to
c0f4d58
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the
DependencyUtilhelper andArtifactFileswrapper with lazy Provider-based artifact resolution directly inOssLicensesPlugin. This ensures dependency resolution happens at task execution time rather than during configuration, which is required for Configuration Cache compatibility and avoids slowing down Android Studio sync.Key changes
ArtifactView.resolvedArtifacts(returnsProvider) instead of eagerly iteratingconfiguration.incoming.artifacts@Nested MapProperty<String, ArtifactFiles>into two@Internal MapProperty<String, File>properties (libraryFilesByGav,pomFilesByGav) to avoid expensive redundant hashing of immutable Maven artifactsDependencyHandlerinto a local variable before entering lazy closures to avoid capturing the non-serializableProjectobjectABSENT_ARTIFACTconstant from deletedDependencyUtiltoDependencyTaskwhere it is usedArtifactFiles,DependencyUtil, andDependencyResolutionTest(coverage provided by existing EndToEnd integration tests)testConfigurationCachethat fails if dependencies are resolved during configuration time, catching any regressionResult