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

   ## Description
   
   Fixes #16517.
   
   Since #16433, the task actions of `runCommand`, `runScript`, `console`, 
`shell` and the application command tasks, such as `configReport`, call 
`requireMainClass(…)` unqualified, from closures in `@CompileDynamic` methods. 
Groovy resolves such a call through the closure's owner, the plugin. With the 
configuration cache, Gradle serializes task actions without keeping the 
closure's owner, so the call is looked up on the task instead, and the tasks 
fail with:
   
   ```
   Could not find method requireMainClass() for arguments [...] on task 
':configReport' of type 
org.grails.gradle.plugin.commands.ApplicationContextCommandTask.
   ```
   
   The five calls are now qualified with the class name, 
`GrailsCliGradlePlugin.requireMainClass(…)`, which does not depend on the 
owner. The Javadoc of `requireMainClass` says why, so the qualification is not 
removed as redundant.
   
   ### Tests
   
   `MainClassRequiredSpec` runs each of its four tasks both without and with 
the configuration cache. The four new configuration cache cases fail without 
the change, with the error above, and pass with it.
   
   These pass with the change:
   - all tests of `grails-gradle-plugins` (`:grails-gradle-plugins:check`, 338 
tests, including `codenarcMain`)
   - `configReport` in an application with 
`org.gradle.configuration-cache=true`, both when the configuration cache entry 
is stored and when it is reused (it fails with the 8.0.0 plugins)
   


-- 
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