Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class BuildSettings {
}
BASE_DIR = System.getProperty(APP_BASE_DIR) ? new File(System.getProperty(APP_BASE_DIR)) : (IOUtils.findApplicationDirectoryFile() ?: new File('.'))
GRAILS_APP_DIR_PRESENT = new File(BASE_DIR, 'grails-app').exists() || new File(BASE_DIR, 'Application.groovy').exists()
TARGET_DIR = new File(BASE_DIR, 'build')
TARGET_DIR = System.getProperty(PROJECT_TARGET_DIR) ? new File(BASE_DIR, System.getProperty(PROJECT_TARGET_DIR)) : new File(BASE_DIR, 'build')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the use case for having this set? The reason we removed PROJECT_TARGET_DIR is because it wasn't used. You can easily inject this via gradle, and BuildSettings is really a left over artifact from the original grails build system. We are trying to remove this functionality over time since it's specific to dev mode and gradle is the better place for that logic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a breaking change too. Going back to 3/29/24 in the logs, this never overrode TARGET_DIR.

Copy link
Contributor Author

@codeconsole codeconsole Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you set a buildDir via gradle in anything other than build, bootRun fails.

./gradlew bootRun --project-prop buildDir=build-7.0.0-RC2 

@jdaugherty how is it breaking? if it is not set, it reverts to the way it was previously.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a breaking change b/c it didn't previously behave like this. We're introducing a function here and I still am not clear why we need to support this. Why do we need to support a custom build directory? We're trying to remove BuildSettings.groovy completely in the longer run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdaugherty because you shouldn't hard code build. It is not a guaranteed directory name and customizable by gradle. This doesn't have to go in 7.0.0. This is just trying to fix java.io.FileNotFoundException: /grails-demo/build/.grailspid (No such file or directory) which is caused because build directory is not automatically created.

RESOURCES_DIR = !GRAILS_APP_DIR_PRESENT ? null : (System.getProperty(PROJECT_RESOURCES_DIR) ? new File(System.getProperty(PROJECT_RESOURCES_DIR)) : new File(TARGET_DIR, 'resources/main'))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ class GrailsGradlePlugin extends GroovyPlugin {
@CompileStatic
protected String configureGrailsBuildSettings(Project project) {
System.setProperty(BuildSettings.APP_BASE_DIR, project.projectDir.absolutePath)
System.setProperty(BuildSettings.PROJECT_TARGET_DIR, project.layout.buildDirectory.get().asFile.name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going back to April 2024, this never appears to have been set previously. Why set it now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this is needed because configureForkSettings copies any grails property and sets it on javaexec / test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdaugherty the build dir should be customizable and not hard coded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't allowed that to be set since the retirement of the original grails build configuration. What's the use case for this? I'm not saying we shouldn't allow this, but for 7.0.0 it's a feature, not a bug. My concern is scope for 7.0.0 release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdaugherty the reason I am calling it a bug is because it results in an exception java.io.FileNotFoundException: /grails-demo/build/.grailspid (No such file or directory)
If it works, let's put it in 7.0.1

}

@CompileDynamic
Expand Down
Loading