Propagate `gradle.properties` to `buildSrc`

Update `buildSrc` so that properties frok the root `gradle.properties`
file are available.

See gh-42333
This commit is contained in:
Phillip Webb 2024-09-23 21:55:56 -07:00
parent 2aea7caf36
commit 23ddad1ebd
4 changed files with 21 additions and 23 deletions

View File

@ -13,18 +13,7 @@ repositories {
sourceCompatibility = 17
targetCompatibility = 17
def versions = [:]
new File(projectDir.parentFile, "gradle.properties").withInputStream {
def properties = new Properties()
properties.load(it)
["assertj", "commonsCodec", "hamcrest", "jackson", "junitJupiter",
"kotlin", "maven"].each {
versions[it] = properties[it + "Version"]
}
}
versions["springFramework"] = "6.0.12"
ext.set("versions", versions)
if (versions.springFramework.contains("-")) {
if ("${springFrameworkVersion}".contains("-")) {
repositories {
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/snapshot" }
@ -32,32 +21,32 @@ if (versions.springFramework.contains("-")) {
}
checkstyle {
toolVersion = "10.12.4"
toolVersion = "{checkstyleToolVersion}"
}
dependencies {
checkstyle("com.puppycrawl.tools:checkstyle:${checkstyle.toolVersion}")
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:${javaFormatVersion}")
implementation(platform("org.springframework:spring-framework-bom:${versions.springFramework}"))
implementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
implementation(platform("org.springframework:spring-framework-bom:${springFrameworkVersion}"))
implementation("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}")
implementation("com.gradle:develocity-gradle-plugin:3.17.2")
implementation("com.tngtech.archunit:archunit:1.3.0")
implementation("commons-codec:commons-codec:${versions.commonsCodec}")
implementation("commons-codec:commons-codec:${commonsCodecVersion}")
implementation("de.undercouch.download:de.undercouch.download.gradle.plugin:5.5.0")
implementation("io.spring.javaformat:spring-javaformat-gradle-plugin:${javaFormatVersion}")
implementation("org.apache.maven:maven-embedder:${versions.maven}")
implementation("org.apache.maven:maven-embedder:${mavenVersion}")
implementation("org.asciidoctor:asciidoctor-gradle-jvm:4.0.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}")
implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${versions.kotlin}")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:${kotlinVersion}")
implementation("org.springframework:spring-context")
implementation("org.springframework:spring-core")
implementation("org.springframework:spring-web")
implementation("io.spring.nohttp:nohttp-gradle:0.0.11")
testImplementation("org.assertj:assertj-core:${versions.assertj}")
testImplementation("org.hamcrest:hamcrest:${versions.hamcrest}")
testImplementation("org.junit.jupiter:junit-jupiter:${versions.junitJupiter}")
testImplementation("org.assertj:assertj-core:${assertjVersion}")
testImplementation("org.hamcrest:hamcrest:${hamcrestVersion}")
testImplementation("org.junit.jupiter:junit-jupiter:${junitJupiterVersion}")
testImplementation("org.springframework:spring-test")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")

View File

@ -1 +0,0 @@
javaFormatVersion=0.0.43

View File

@ -4,3 +4,11 @@ pluginManagement {
gradlePluginPortal()
}
}
gradle.rootProject((project) -> {
new File(rootDir.parentFile, "gradle.properties").withInputStream {
def properties = new Properties()
properties.load(it)
properties.forEach(project.ext::set)
}
});

View File

@ -6,10 +6,12 @@ org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
assertjVersion=3.24.2
checkstyleToolVersion=10.12.4
commonsCodecVersion=1.16.1
commonsCompressVersion=1.21
hamcrestVersion=2.2
jacksonVersion=2.15.4
javaFormatVersion=0.0.43
junitJupiterVersion=5.10.3
kotlinVersion=1.9.25
mavenVersion=3.9.4