Skip to content

Conversation

@jamesfredley
Copy link
Contributor

@jamesfredley jamesfredley commented Jun 26, 2025

@jamesfredley jamesfredley self-assigned this Jun 26, 2025
@jamesfredley jamesfredley moved this to In Progress in Apache Grails Jun 26, 2025
@jamesfredley jamesfredley added this to the grails:7.0.0-RC1 milestone Jun 26, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the buildSrc Gradle script to pull the Grails version from the root gradle.properties file instead of hardcoding via VersionInfo.

  • Loads gradle.properties into project.ext.gradleProperties
  • Switches the grails-gradle-bom platform dependency to interpolate gradleProperties.grailsVersion
Comments suppressed due to low confidence (1)

grails-forge-core/src/main/java/org/grails/forge/feature/build/gradle/templates/buildSrcBuildGradle.rocker.raw:35

  • Gradle automatically loads gradle.properties into project properties, so you can drop the manual file read block and use project.property('grailsVersion') directly for cleaner and more idiomatic code.
file('../gradle.properties').withInputStream {

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

@jdaugherty jdaugherty left a comment

Choose a reason for hiding this comment

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

There are downsides to importing properties... for us it did not matter, but for end grails applications it means they can't set properties via environment variables. Shouldn't projects make this decision theirselves?

# Conflicts:
#	grails-forge-core/src/main/java/org/grails/forge/feature/build/gradle/templates/buildSrcBuildGradle.rocker.raw
@jamesfredley
Copy link
Contributor Author

@jdaugherty I updated this to a goldilocks setup which supports buildSrc/gradle.properties, environment variables and /gradle.properties with /gradle.properties only applied when the variable does not exist in the others.

Having a single location defining versions is a HUGE win and this enables it for users that want to use buildSrc. I also think this should be the default in Gradle, but that is another conversation.

@jamesfredley jamesfredley changed the title Use $grailsVersion from gradle.properties Load the root gradle.properties only for properties not already set in buildSrc Jun 26, 2025
@jdaugherty
Copy link
Contributor

jdaugherty commented Jun 26, 2025

@jdaugherty I updated this to a goldilocks setup which supports buildSrc/gradle.properties, environment variables and /gradle.properties with /gradle.properties only applied when the variable does not exist in the others.

Having a single location defining versions is a HUGE win and this enables it for users that want to use buildSrc. I also think this should be the default in Gradle, but that is another conversation.

I had no idea the environment variables work for properties in buildSrc. That even makes this problem even more confusing because the gradle.properties do not. It seems gradle/gradle#1001 indicated that buildSrc should be treated like a child build and there is also a separate gradle ticket covering this scenario for child builds: gradle/gradle#2534 So I guess this is still an upstream todo?

Your change appears to work for both variables & gradle.properties, so I'm ok with this.

Copy link
Contributor

@jdaugherty jdaugherty left a comment

Choose a reason for hiding this comment

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

Let's at least reference the upstream gradle issue so people know why we made this change?

@jamesfredley jamesfredley merged commit ed3e155 into 7.0.x Jun 26, 2025
6 of 9 checks passed
@jamesfredley jamesfredley deleted the use-gradle-properties-versions branch June 26, 2025 16:03
@github-project-automation github-project-automation bot moved this from In Progress to Done in Apache Grails Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants