grails / grails-gradle-plugin

Apache License 2.0
6 stars 9 forks source link

BUG 6.1.1 - compiled gsps missing from views.properties #257

Closed codeconsole closed 6 months ago

codeconsole commented 8 months ago

Previously worked in Grails 5.x and Grails 6.0.0

Broken beginning with 6.1.0

GSPs in /src/main/webapp compiled, but not included in views.properties

Demo https://github.com/codeconsole/grails6bugs

git clone https://github.com/codeconsole/grails6bugs
cd grails6bugs
./gradlew clean bootJar
# notice src/main/webapp/test/hello.gsp was correctly compiled
unzip -l build/libs/grails6bugs-0.1.jar|grep hello_gsp\.class
# notice hello.gsp is missing from views.properties
unzip -p build/libs/grails6bugs-0.1.jar BOOT-INF/classes/gsp/views.properties|grep hello_gsp

Notice /test/hello.gsp gsp is missing in /build/gsp-classes/main/gsp/views.properties

#Precompiled views for grails6bugs
#Mon Nov 20 10:23:18 CST 2023
/WEB-INF/grails-app/views/error.gsp=gsp_grails6bugserror_gsp
/WEB-INF/grails-app/views/index.gsp=gsp_grails6bugsindex_gsp
/WEB-INF/grails-app/views/layouts/main.gsp=gsp_grails6bugs_layoutsmain_gsp
/WEB-INF/grails-app/views/notFound.gsp=gsp_grails6bugsnotFound_gsp

Now verify it worked in Grails 6.0.0

git checkout fix
./gradlew clean bootJar
unzip -p build/libs/grails6bugs-0.1.jar BOOT-INF/classes/gsp/views.properties|grep hello_gsp

Notice /test/hello.gsp is now listed

#Precompiled views for grails6bugs
#Mon Nov 20 10:24:09 CST 2023
/WEB-INF/grails-app/views/error.gsp=gsp_grails6bugserror_gsp
/WEB-INF/grails-app/views/index.gsp=gsp_grails6bugsindex_gsp
/WEB-INF/grails-app/views/layouts/main.gsp=gsp_grails6bugs_layoutsmain_gsp
/test/hello.gsp=gsp_grails6bugs_testhello_gsp
/WEB-INF/grails-app/views/notFound.gsp=gsp_grails6bugsnotFound_gsp

http://localhost:8080/test/hello.gsp

codeconsole commented 8 months ago

Also notice you can fix any Grails 6.1.0 app by simply using the older version of this plugin:

https://github.com/codeconsole/grails6bugs/compare/main..fix

codeconsole commented 7 months ago

https://github.com/grails/grails-gradle-plugin/blob/95b99c5dbc7f2ed7e0b5472d2f231499807132d4/src/main/groovy/org/grails/gradle/plugin/web/gsp/GroovyPagePlugin.groovy#L53-L67

codeconsole commented 7 months ago

Problem still exists in Grails 6.1.1 https://github.com/codeconsole/grails6bugs

codeconsole commented 6 months ago

@puneetbehl @guillermocalvo How is this related to an InputChanges parameter?

guillermocalvo commented 6 months ago

How is this related to an InputChanges parameter?

@codeconsole The InputChanges parameter is used to let Gradle know that the task will handle incremental changes. But the parameter was being discarded and the action wasn't really doing things incrementally. As a result of that, some changes were overwriting the work produced by previous changes.