jprinet opened a new pull request, #15483:
URL: https://github.com/apache/grails-core/pull/15483

   ### Description
   
   This PR improves Gradle build cacheability by
   - Removing the non-required `base.dir` absolute path from 
`Test.systemProperties`
   - Ignoring `sbom.json` during cache key computation
   - Migrating `GroovyDoc.doFirst` block to a dedicated task [Optional as this 
breaks configuration cache compatibility]
   
   ### Details
   
   Running experiment 3 of the [automated validation 
scripts](https://github.com/gradle/develocity-build-validation-scripts/blob/main/Gradle.md)
 helped to discover 587 cacheable tasks executed in 1h 31m 58.817s of serial 
time in the second [Build 
Scan](https://ge.solutions-team.gradle.com/s/nngl4lil4cbyo/timeline?cacheability=cacheable,overlapping-outputs&outcome=success).
   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](https://ge.solutions-team.gradle.com/c/yurlk5t7wunlc/nngl4lil4cbyo/task-inputs?cacheability=cacheable,overlapping-outputs,validation-failure)
 are diverse
   
   Here are the patterns
   - `GroovyDoc`:  using `doFirst` breaks cacheability 
([doc](https://docs.gradle.org/current/userguide/common_caching_problems.html#custom_actions)),
 however, the remediation implemented breaks configuration cache compatibility 
. I believe it's still worth it given CC can't be enabled for [other 
reasons](https://github.com/apache/grails-core/blob/2c002d3ff4e485c0cb2013812c5e5791ca150367/gradle.properties#L75)
   - `GroovyCompile`, `Checkstyle`: classpath differences due to the 
`sbom.json` file
   - `GroovyCompile`: usage of `doFirst`
   - `Test`: systemProperty differences due to `base.dir` absolute path
   
   Applying the fix reduced the number of cache misses to 242 tasks in 25m 
34.176s of serial time in the [second build 
scan](https://ge.solutions-team.gradle.com/c/lvzkpkckzhlec/ayyw73alaxudk/task-inputs)
   
   ### Not covered
   
   The `doFirst` block of the `GroovyCompile` task has been kept as it is a 
[conscious 
decision](https://github.com/apache/grails-core/blob/2c002d3ff4e485c0cb2013812c5e5791ca150367/grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy#L198)
   
   A bunch of tasks having a different build classpath between the 2 executions 
are still present:
   - `FindMainClassTask`
   - `AsciidoctorTask`
   - `FetchTagsTask`
   - `GroovyPageForkCompileTask`
   - `ExtractDependenciesTask`
   - `PublishGuideTask`
   - `CreateReleaseDropDownTask`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to