Skip to content

Commit 324a790

Browse files
committed
MINOR: Simplify Gradle upgrade
Today, we have to change multiple files when upgrading Gradle: - gradle/dependencies.gradle - gradle/wrapper/gradle-wrapper.properties - gradlew By using $gradle.gradleVersion, the next Gradle upgrade PR would only require a version change in gradle-wrapper.properties. Signed-off-by: Federico Valeri <[email protected]>
1 parent c9fcad7 commit 324a790

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ plugins {
4444
}
4545

4646
ext {
47-
gradleVersion = versions.gradle
4847
minClientJavaVersion = 11
4948
minNonClientJavaVersion = 17
5049
modulesNeedingJava11 = [":clients", ":generator", ":streams", ":streams:test-utils", ":streams-scala", ":test-common:test-common-util"]
@@ -251,7 +250,6 @@ static def projectToJUnitXmlPath(project) {
251250
return projectNames.join("/")
252251
}
253252

254-
255253
apply from: file('wrapper.gradle')
256254

257255
if (repo != null) {
@@ -296,7 +294,7 @@ if (repo != null) {
296294
} else {
297295
rat.enabled = false
298296
}
299-
println("Starting build with version $version (commit id ${commitId == null ? "null" : commitId.take(8)}) using Gradle $gradleVersion, Java ${JavaVersion.current()} and Scala ${versions.scala}")
297+
println("Starting build with version $version (commit id ${commitId == null ? "null" : commitId.take(8)}) using Gradle $gradle.gradleVersion, Java ${JavaVersion.current()} and Scala ${versions.scala}")
300298
println("Build properties: ignoreFailures=$userIgnoreFailures, maxParallelForks=$maxTestForks, maxScalacThreads=$maxScalacThreads, maxTestRetries=$userMaxTestRetries")
301299

302300
subprojects {

gradle/dependencies.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ versions += [
5959
checkstyle: project.hasProperty('checkstyleVersion') ? checkstyleVersion : "10.20.2",
6060
commonsValidator: "1.9.0",
6161
classgraph: "4.8.173",
62-
gradle: "8.14",
6362
grgit: "4.1.1",
6463
httpclient: "4.5.14",
6564
jackson: "2.16.2",

wrapper.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,20 @@
2323
// and not the version installed on the machine running the task.
2424
// Read more about the wrapper here: https://docs.gradle.org/current/userguide/gradle_wrapper.html
2525
wrapper {
26-
gradleVersion = project.gradleVersion
2726
distributionType = Wrapper.DistributionType.ALL
2827
}
2928

3029
// Custom task to inject support for downloading the gradle wrapper jar if it doesn't exist.
3130
// This allows us to avoid checking in the jar to our repository.
3231
// Additionally adds a license header to the wrapper while editing the file contents.
33-
task bootstrapWrapper() {
32+
tasks.register('bootstrapWrapper') {
3433
// In the doLast block so this runs when the task is called and not during project configuration.
3534
doLast {
3635
def wrapperBasePath = "\$APP_HOME/gradle/wrapper"
3736
def wrapperJarPath = wrapperBasePath + "/gradle-wrapper.jar"
3837

3938
// Add a trailing zero to the version if needed.
40-
def fullVersion = project.gradleVersion.count(".") == 1 ? "${project.gradleVersion}.0" : versions.gradle
39+
def fullVersion = $gradle.gradleVersion.count(".") == 1 ? "$gradle.gradleVersion.0" : versions.gradle
4140
// Leverages the wrapper jar checked into the gradle project on github because the jar isn't
4241
// available elsewhere. Using raw.githubusercontent.com instead of github.com because
4342
// github.com servers deprecated TLSv1/TLSv1.1 support some time ago, so older versions

0 commit comments

Comments
 (0)