jamesfredley opened a new issue, #16711: URL: https://github.com/apache/grails-core/issues/16711
## Summary #16702 re-enabled the Gradle build cache for `GroovyPageForkCompileTask` (`@CacheableTask`) without tracking `GRAILS_ENV`. The forked GSP compiler inherits that variable, and it selects the environment block compiled into the page. A clean build can therefore restore pages compiled for a different environment. ## What goes wrong `Environment` resolves `GRAILS_ENV` when `grails.env` is not set as a system property. `CodeGenConfig` merges the configuration block for that environment. `GroovyPageParser` then emits the expression codec from that configuration into the compiled page. The task fingerprints the configuration files and the page sources. It does not declare the effective Grails environment as an `@Input`, and it does not pass the environment to the compiler explicitly. Two clean builds with the same sources and the same `application.yml`, one with `GRAILS_ENV=development` and one with `GRAILS_ENV=production`, can share a cache key. Example: `application.yml` sets the expression codec to `none` under development and `html` under production. A development build populates the cache. A later clean production build restores those classes. The production artifact keeps the development codec, so expressions that production expected to HTML-escape are not escaped. Before this merge, caching was disabled, so a clean build could not reuse another environment's pages. ## Introduced by - https://github.com/apache/grails-core/pull/16702 - Merge commit `93fa901ed0955f78cf04ed46534b0dca52539f87` on `8.0.x` - `grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/views/gsp/GroovyPageForkCompileTask.groovy` line 74 ## Fix Keep `@CacheableTask` off until the fork's effective Grails environment is an explicit task input and is passed to the compiler. Otherwise-identical clean builds under development and production must produce separate cache entries and the codec constant each environment configured. -- 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]
