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


##########
grails-gradle/model/src/main/groovy/grails/util/BuildSettings.groovy:
##########
@@ -309,6 +310,7 @@ class BuildSettings {
     }
 
     static {
+        BUILD_RESOURCES_PATH = System.getProperty(PROJECT_RESOURCES_DIR) ?: 
'build/resources/main'

Review Comment:
   Right, that was a regression here. `RESOURCES_DIR` now joins a relative 
`grails.project.resource.dir` to `BASE_DIR` (`BuildSettings.resourcesDir`), and 
keeps an absolute one as it is. `BuildSettingsSpec` covers the three cases, and 
runs `BuildSettings` in a JVM whose working directory is next to the 
application, as you did: with the property it's 
`<app>/build-parent/build-8070/resources/main`, and without it 
`<app>/build/resources/main`. That forked case fails with the previous line.
   
   I've left `CLASSES_DIR` as it was. It has always resolved against the 
working directory, its fallback included, and the whole block is gated on 
`grails-app` being in the working directory, so with `workingDir` moved it's 
already `null` and the property is ignored.
   



##########
grails-gradle/plugins/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy:
##########
@@ -1029,6 +1030,13 @@ ${importStatements}
             // Use a CommandLineArgumentProvider so that the absolute project 
directory path
             // is normalized for build cache relocatability 
(PathSensitivity.RELATIVE).
             task.jvmArgumentProviders.add(new 
GrailsAppBaseDirProvider(project.projectDir))
+            // Where development reloading compiles a changed class and copies 
a changed message bundle, and where
+            // the application reads resources from: the build's own 
directories, wherever the build directory is, not
+            // the build/classes/groovy/main and build/resources/main 
BuildSettings falls back to
+            task.jvmArgumentProviders.add(new 
GrailsProjectOutputDirProvider(BuildSettings.PROJECT_CLASSES_DIR,

Review Comment:
   Covered here. `MainClassFinder.searchMainClass` now also takes the compile 
classpath and searches its directories that belong to the spec's own project 
first (the nearest `build.gradle` or `grails-app` above the directory is the 
spec's), before the guesses under `build/`. `IntegrationTestAstTransformation` 
passes it the compiler's classpath: the configuration's entries and the URLs of 
the class loaders it compiles against. A plugin subproject's classes directory 
on the classpath isn't searched, even one inside the application directory, so 
its own `Application` can't be picked. No property is involved, so the reused 
compiler daemon from gradle/gradle#38395 doesn't come into it.
   
   `MainClassFinderSpec` covers both. And with `enable-mvc-check` moved to 
`build-parent/build-8070` by an init script and no `build/` in the project, all 
7 `integrationTest` tests pass; without the change all 7 fail with `No baseUrl 
set`, as you saw.
   



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