Improve Gradle build cacheability#15483
Conversation
|
Thank you @jprinet for your contribution. Several of us are traveling / busy this week. We will try to get to this PR soon. |
|
@jprinet I have not dug into your findings too deep, but I do have a two questions!
|
|
Just a disclaimer, I am not familiar with the codebase and just looked for a minimal changeset to fix the cache misses 😛 To your question @jdaugherty
Related to 2., I also noticed 21 cache misses on An opportunistic fix could be to make the Fixing the |
|
@jprinet thank you, this feedback is incredible. I'm still learning develocity, how can I view the actual values of the properties? Do I need to do this locally or can I see this in develocity itself? |
Develocity does not capture the system properties values by default, but you could add them to a build scan as custom value Just FYI, this all PR is coming from the results of running the automated validation scripts on the project |
|
Thank you. Do you know if anyone has a github action to make this as part of an established build? Once we fix these, I'd like to have continuous feedback to prevent this in the future =) |
|
Thank you @clayburn I won't have time to look at this until next week, but I'll see what I can do to automate this as part of our build process too then. |
|
I moved the normalization to the SbomPlugin, 27 additional cache misses appeared compared to the previous version, but the change is way more comprehensive. I believe this solution is still better, although less optimal |
|
FYI: This is still on my list to review. At a high level, the groovy doc & sbom changes are definitely merge-able as-is. The base.dir issue I need to investigate more because I don't fully understand the impacts. We need to be able to pass that dir to the various tasks or we need to be able to set that some other way - maybe as part of a groovy AST transform. Grails depends on this for it's dev mode to determine reloading support, etc. I don't have time to debug the gradle side yet though. I need to finish the 8.0 priorities so in all likelihood, I'll have to look at this sometime later this month. |
|
The TestLens GitHub App is installed in this repository but TestLens is currently in private beta. Please contact us to finish onboarding this repository. |
|
I can remove the changes related to the |
|
Let's do that so we can get what you've done merged. I can create a follow-up ticket to track this in the mean time. |
|
I have just dropped the commit related to |
Description
This PR improves Gradle build cacheability by
base.dirabsolute path fromTest.systemPropertiessbom.jsonduring cache key computationGroovyDoc.doFirstblock to a dedicated task [Optional as this breaks configuration cache compatibility]Details
Running experiment 3 of the automated validation scripts helped to discover 587 cacheable tasks executed in 1h 31m 58.817s of serial time in the second Build Scan.
In ideal situations, no cacheable task should run in the second build of an experiment, as they should all come from the cache.
The cache misses reasons illustrated in this build scan comparison are diverse
Here are the patterns
GroovyDoc: usingdoFirstbreaks cacheability (doc), however, the remediation implemented breaks configuration cache compatibility . I believe it's still worth it given CC can't be enabled for other reasonsGroovyCompile,Checkstyle: classpath differences due to thesbom.jsonfileGroovyCompile: usage ofdoFirstTest: systemProperty differences due tobase.dirabsolute pathApplying the fix reduced the number of cache misses to 242 tasks in 25m 34.176s of serial time in the second build scan
Not covered
The
doFirstblock of theGroovyCompiletask has been kept as it is a conscious decisionA bunch of tasks having a different build classpath between the 2 executions are still present:
FindMainClassTaskAsciidoctorTaskFetchTagsTaskGroovyPageForkCompileTaskExtractDependenciesTaskPublishGuideTaskCreateReleaseDropDownTask