matrei opened a new pull request, #16383: URL: https://github.com/apache/grails-core/pull/16383
## Summary The Forge build's `RockerTask` (`grails-forge/buildSrc`) generates Java sources from `*.rocker.raw` templates into `build/generated-src/rocker/<sourceSet>`, but it never clears that directory. When a template is deleted or renamed, the source generated from it stays behind and keeps being compiled into `grails-forge-core`. It gets worse with the build cache. The task is `@CacheableTask`, so a run that leaves a stale file behind stores that output in the local build cache. After `./gradlew clean`, Gradle restores the stale output from the cache and the old class is back. It only shows up in local builds after a template has been removed or renamed. CI builds from a clean checkout, so CI is not affected. ## Changes - `RockerTask` deletes its output directory before generating sources, so the output always matches the current templates. It uses the injected `FileSystemOperations` service, which keeps the task compatible with the configuration cache. ## Testing `buildSrc` has no test setup, so I checked this manually on `grails-forge-core` with `--no-build-cache`: - Before the fix, adding a `staleProbe.rocker.raw` template, running `generateRockerTemplateSource`, deleting the template and running the task again left `staleProbe.java` in the output. - After the fix, the same steps leave no `staleProbe.java`. The first run also removed sources left over from templates deleted on another branch. - `./gradlew test` in `grails-forge` passes (forge-core, forge-api, forge-cli, test-core), and so does `codeStyle` for forge-core and forge-cli. -- 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]
