You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2025/12/02 16:21:37 UTC
(grails-core) 02/02: feedback - formatting & various clean-up
This is an automated email from the ASF dual-hosted git repository.
jdaugherty pushed a commit to branch gradle-centralization
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 2921aa25ecbffb85f99a578b71aac11cbe505d77
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Tue Dec 2 11:21:29 2025 -0500
feedback - formatting & various clean-up
---
.../groovy/org/apache/grails/buildsrc/CompilePlugin.groovy | 8 +++-----
.../groovy/org/apache/grails/buildsrc/GradleUtils.groovy | 14 ++++----------
.../org/apache/grails/buildsrc/SharedPropertyPlugin.groovy | 10 ++++++----
grails-dependencies/assets/build.gradle | 1 -
grails-dependencies/starter-web/build.gradle | 1 -
grails-dependencies/test/build.gradle | 1 -
grails-forge/buildSrc/build.gradle | 2 +-
7 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy
index 028f4b19b3..c9286b5d50 100644
--- a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy
+++ b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/CompilePlugin.groovy
@@ -28,7 +28,6 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.plugins.JavaPluginExtension
-import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.bundling.AbstractArchiveTask
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.compile.GroovyCompile
@@ -66,7 +65,6 @@ class CompilePlugin implements Plugin<Project> {
private static void configureJars(Project project) {
project.extensions.configure(JavaPluginExtension) {
- // Explicit `it` is required here
it.withJavadocJar()
it.withSourcesJar()
}
@@ -93,20 +91,20 @@ class CompilePlugin implements Plugin<Project> {
project.tasks.withType(JavaCompile).configureEach {
// Preserve method parameter names in Groovy/Java classes for IDE parameter hints & bean reflection metadata.
it.options.compilerArgs.add('-parameters')
- it.options.encoding = StandardCharsets.UTF_8.name()
// encoding needs to be the same since it's different across platforms
+ it.options.encoding = StandardCharsets.UTF_8.name()
it.options.fork = true
it.options.forkOptions.jvmArgs = ['-Xms128M', '-Xmx2G']
}
project.plugins.withId('groovy') {
project.tasks.withType(GroovyCompile).configureEach {
- it.groovyOptions.encoding = StandardCharsets.UTF_8.name()
// encoding needs to be the same since it's different across platforms
+ it.groovyOptions.encoding = StandardCharsets.UTF_8.name()
// Preserve method parameter names in Groovy/Java classes for IDE parameter hints & bean reflection metadata.
it.groovyOptions.parameters = true
- it.options.encoding = StandardCharsets.UTF_8.name()
// encoding needs to be the same since it's different across platforms
+ it.options.encoding = StandardCharsets.UTF_8.name()
it.options.fork = true
it.options.forkOptions.jvmArgs = ['-Xms128M', '-Xmx2G']
}
diff --git a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GradleUtils.groovy b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GradleUtils.groovy
index e7b5855341..84bed197f1 100644
--- a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GradleUtils.groovy
+++ b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GradleUtils.groovy
@@ -27,20 +27,14 @@ import org.gradle.api.file.Directory
class GradleUtils {
static Directory findRootGrailsCoreDir(Project project) {
- def rootLayout = project.layout
-
// .github / .git related directories are purged from source releases, so use the .asf.yaml as an indicator of
// the parent directory
- findAsfRoot(rootLayout.projectDirectory)
+ findAsfRootDir(project.layout.projectDirectory)
}
- static Directory findAsfRoot(Directory currentDirectory) {
+ static Directory findAsfRootDir(Directory currentDirectory) {
def asfFile = currentDirectory.file('.asf.yaml').asFile
- if (asfFile.exists()) {
- return currentDirectory
- }
-
- findAsfRoot(currentDirectory.dir('../'))
+ asfFile.exists() ? currentDirectory : findAsfRootDir(currentDirectory.dir('../'))
}
static <T> T lookupProperty(Project project, String name, T defaultValue = null) {
@@ -64,7 +58,7 @@ class GradleUtils {
return property
}
- def ext = project.extensions.getExtraProperties()
+ def ext = project.extensions.extraProperties
if (ext.has(name)) {
return ext.get(name)
}
diff --git a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/SharedPropertyPlugin.groovy b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/SharedPropertyPlugin.groovy
index b7df637ce7..07441ddd46 100644
--- a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/SharedPropertyPlugin.groovy
+++ b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/SharedPropertyPlugin.groovy
@@ -38,10 +38,12 @@ class SharedPropertyPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
- def ext = project.extensions.getExtraProperties()
-
- def rootGrailsCoreDir = findRootGrailsCoreDir(project)
- populateParentProperties(project.layout.projectDirectory, rootGrailsCoreDir, ext, project)
+ populateParentProperties(
+ project.layout.projectDirectory,
+ findRootGrailsCoreDir(project),
+ project.extensions.extraProperties,
+ project
+ )
}
void populateParentProperties(Directory projectDirectory, Directory rootDirectory, ExtraPropertiesExtension ext, Project project) {
diff --git a/grails-dependencies/assets/build.gradle b/grails-dependencies/assets/build.gradle
index 3bae5f9843..807a8ddd07 100644
--- a/grails-dependencies/assets/build.gradle
+++ b/grails-dependencies/assets/build.gradle
@@ -54,7 +54,6 @@ dependencies {
}
}
-// these must be after the above applies because they opt out of the defaults created in those files
tasks.named('javadocJar').configure {
it.enabled = false
}
diff --git a/grails-dependencies/starter-web/build.gradle b/grails-dependencies/starter-web/build.gradle
index 6814803266..85ce1a055c 100644
--- a/grails-dependencies/starter-web/build.gradle
+++ b/grails-dependencies/starter-web/build.gradle
@@ -78,7 +78,6 @@ dependencies {
}
}
-// these must be after the above applies because they opt out of the defaults created in those files
tasks.named('javadocJar').configure {
it.enabled = false
}
diff --git a/grails-dependencies/test/build.gradle b/grails-dependencies/test/build.gradle
index 60a37c4648..9b4ee0dbe8 100644
--- a/grails-dependencies/test/build.gradle
+++ b/grails-dependencies/test/build.gradle
@@ -56,7 +56,6 @@ dependencies {
}
}
-// these must be after the above applies because they opt out of the defaults created in those files
tasks.named('javadocJar').configure {
it.enabled = false
}
diff --git a/grails-forge/buildSrc/build.gradle b/grails-forge/buildSrc/build.gradle
index bc21a4d90c..99ee5dd169 100644
--- a/grails-forge/buildSrc/build.gradle
+++ b/grails-forge/buildSrc/build.gradle
@@ -76,7 +76,7 @@ dependencies {
implementation "org.antlr:antlr4-runtime:$antlr4Version"
implementation "org.apache.ant:ant:$antVersion"
implementation "org.apache.grails.gradle:grails-gradle-common:$projectVersion"
- implementation "org.cyclonedx.bom:org.cyclonedx.bom.gradle.plugin:${gradleCycloneDxPluginVersion}"
+ implementation "org.cyclonedx.bom:org.cyclonedx.bom.gradle.plugin:$gradleCycloneDxPluginVersion"
}
gradlePlugin {