Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

artifactsReport granular cache inputs#1219

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
seregamorph wants to merge1 commit intoautonomousapps:main
base:main
Choose a base branch
Loading
fromseregamorph:artifacts-report-granular

Conversation

seregamorph
Copy link
Contributor

@seregamorphseregamorph commentedJul 8, 2024
edited
Loading

Problem statement

artifactsReportX tasks (ArtifactsReportTask) declare too "sensitive" file task inputs (absolute file path + full file contents). But the task output does not depend on file content itself, only on resolved dependency tree. As a result, the caching hit rate for these tasks is quite low.

Proposed solution

The problematic task input:

/** * This is the "official" input for wiring task dependencies correctly, but is otherwise * unused. This needs to use [InputFiles] and [PathSensitivity.ABSOLUTE] because the path to the * jars really does matter here. Using [Classpath] is an error, as it looks only at content and * not name or path, and we really do need to know the actual path to the artifact, even if its * contents haven't changed.*/@PathSensitive(PathSensitivity.ABSOLUTE)@InputFilesfungetClasspathArtifactFiles():FileCollection= artifacts.artifactFiles

should be replaced with absolute file paths only:

@InputfungetClasspathArtifactFilePaths():Set<String>= artifacts.artifactFiles.mapToSet { it.path }

From the debugger, sample file inputs (Set ofString values):

0 = "/Users/morph/Projects/demo-gradle-included-issue/module-contracts/build/libs/module-contracts.jar"1 = "/Users/morph/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.14.0/1ed471194b02f2c6cb734a0cd6f6f107c673afae/commons-lang3-3.14.0.jar"

FYI: sampleartifactsReportMain task output looks like:

[  {"coordinates": {"type":"included_build","identifier":"isolated-build-1:module-contracts","resolvedProject": {"identifier":":module-contracts","gradleVariantIdentification": {"capabilities": ["isolated-build-1:module-contracts"          ],"attributes": {}        },"buildPath":":"      },"gradleVariantIdentification": {"capabilities": ["isolated-build-1:module-contracts"        ],"attributes": {}      }    },"file":"/Users/morph/Projects/demo-gradle-included-issue/module-contracts/build/libs/module-contracts.jar"  },

as you can see - does not depend on jar content, only on dependency resolution.

Testing

The functional test is not attached. Let me know WDYT about this change and if there is a green light, I can try to provide a test. The problem here is that the test should assert the caching result. It is possible, but requires extended test setup.

@seregamorphseregamorph marked this pull request as draftJuly 8, 2024 18:37
@seregamorph
Copy link
ContributorAuthor

The builds fails on functionalTests, but only for android. It seems that file iteration has side effect. I need some time to investigate it, but still curious about the idea in general.

@seregamorphseregamorphforce-pushed theartifacts-report-granular branch from6408f39 to30d66beCompareJanuary 10, 2025 16:50
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@seregamorph

[8]ページ先頭

©2009-2025 Movatter.jp