codeconsole commented on code in PR #16398:
URL: https://github.com/apache/grails-core/pull/16398#discussion_r4102062520


##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/views/gsp/GroovyPageForkCompileTask.groovy:
##########
@@ -155,7 +179,7 @@ abstract class GroovyPageForkCompileTask extends 
AbstractCompile {
     @Override
     @PathSensitive(PathSensitivity.RELATIVE)
     FileTree getSource() {
-        return super.getSource()
+        return super.getSource().plus(generatedViews.asFileTree)

Review Comment:
   Thanks, reproduced with the extended test and fixed in b5534e36f9. `srcDir` 
is `@Internal` now: its pages are fingerprinted through `getSource()`, and the 
forked compiler already skips a directory that doesn't exist.
   
   The plugin-controller functional test now also runs `compileGroovyPages` in 
a project with no `grails-app/views`. The "scaffolds nothing" test now also 
checks that `compileGroovyPages` is still NO-SOURCE there.
   



##########
grails-doc/src/en/guide/scaffolding.adoc:
##########
@@ -59,9 +59,15 @@ With this configured, when you start your application the 
actions and views will
 
 A CRUD interface will also be generated. To access this open 
`http://localhost:8080/book` in a browser.
 
-The Gradle plugin expands scaffold templates into 
`build/generated/scaffolded-views` with `generateScaffoldedViews`. Then 
`stageGroovyPages` combines them with application views in 
`build/generated/views`, and `compileGroovyPages` compiles them so packaged 
applications and native images do not need to generate them on the first 
request. Running `compileGroovyPages` runs these prerequisite tasks 
automatically. Handwritten views in the application or supplied by a plugin 
still take precedence over generated scaffold views.
+When the application is built, the Gradle plugin's `generateScaffoldedViews` 
task expands the scaffolding templates for every domain class a controller 
scaffolds with `@Scaffold`, the application's or a plugin's, and 
`compileGroovyPages` compiles the resulting pages in the same compilation as 
the application's views. The templates are expanded by the application's own 
scaffolding library and Groovy, in a JVM on its runtime classpath, exactly as 
they would be expanded when the view is requested. That library has to match 
the Grails Gradle plugin: with a `grails-scaffolding` of another version, the 
build warns and compiles no scaffolded page, and the views are expanded on 
their first use. A packaged application then renders a scaffolded view without 
generating it on the first request, and a native image, which cannot compile a 
page at runtime, can render it at all.

Review Comment:
   Agreed, reworded in 212cdd9171 to "With a `grails-scaffolding` the Grails 
Gradle plugin cannot work with, the build warns and compiles no scaffolded 
page".
   



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