From 847826528a515e170988ecc0b4142fa525884540 Mon Sep 17 00:00:00 2001 From: James Nugent Date: Tue, 20 May 2025 08:51:39 +0300 Subject: [PATCH 1/5] Fix usage of junitXml.destination -> outputLocation This fixes two Gradle deprecation warnings related to the output location of JUnit XML reports, as documented in [1]. [1]: https://docs.gradle.org/8.13/dsl/org.gradle.api.reporting.Report.html#org.gradle.api.reporting.Report:destination --- build.gradle | 2 +- gradle/testing.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 9ff9dffa39..3ea7a4f376 100644 --- a/build.gradle +++ b/build.gradle @@ -100,7 +100,7 @@ allprojects { // Configure JUnit tests tasks.withType(Test) { - reports.junitXml.destination = project.file("${->project.buildDir}/test-results") + reports.junitXml.outputLocation = project.file("${->project.buildDir}/test-results") } // Configure JAR generation diff --git a/gradle/testing.gradle b/gradle/testing.gradle index 48080a6acb..26562211f1 100644 --- a/gradle/testing.gradle +++ b/gradle/testing.gradle @@ -40,7 +40,7 @@ task destructiveTest(type: Test) { maxParallelForks = 1 } reports { - junitXml.destination = file("${buildDir}/test-results/destructive") + junitXml.outputLocation = file("${buildDir}/test-results/destructive") } } From 9b7e6019bef0a45d2e2a7ac0f73fe8b1b7d223fe Mon Sep 17 00:00:00 2001 From: James Nugent Date: Tue, 20 May 2025 08:54:19 +0300 Subject: [PATCH 2/5] Always use operator for Gradle variable assignment This fixes usages of variable assignment via both space assigment and propertyName(value) per the deprecation warnings for Gradle 8, as documented in [1]. Instead, we adopt the recommended property = value syntax. [1]: https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#groovy_space_assignment_syntax --- fdb-relational-cli/fdb-relational-cli.gradle | 2 +- fdb-relational-jdbc/fdb-relational-jdbc.gradle | 2 +- yaml-tests/yaml-tests.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fdb-relational-cli/fdb-relational-cli.gradle b/fdb-relational-cli/fdb-relational-cli.gradle index 0aef3da15c..42eab4d48e 100644 --- a/fdb-relational-cli/fdb-relational-cli.gradle +++ b/fdb-relational-cli/fdb-relational-cli.gradle @@ -74,7 +74,7 @@ dependencies { } jar { - duplicatesStrategy "exclude" + duplicatesStrategy = "exclude" manifest { attributes( 'Main-Class': 'com.apple.foundationdb.relational.cli.sqlline.RelationalSQLLine', diff --git a/fdb-relational-jdbc/fdb-relational-jdbc.gradle b/fdb-relational-jdbc/fdb-relational-jdbc.gradle index d2096bae7f..3754f6ec51 100644 --- a/fdb-relational-jdbc/fdb-relational-jdbc.gradle +++ b/fdb-relational-jdbc/fdb-relational-jdbc.gradle @@ -52,7 +52,7 @@ serviceLoader { } jar { - duplicatesStrategy "exclude" + duplicatesStrategy = "exclude" } // Task to build a fat jar, one w/ all dependencies; good for handing out as the 'jdbc' jar. diff --git a/yaml-tests/yaml-tests.gradle b/yaml-tests/yaml-tests.gradle index 037478fec9..28716a85a1 100644 --- a/yaml-tests/yaml-tests.gradle +++ b/yaml-tests/yaml-tests.gradle @@ -33,7 +33,7 @@ project.tasks.named("processTestResources") { } tasks.named("sourcesJar") { - duplicatesStrategy('include') + duplicatesStrategy = 'include' // classifier('sources') from sourceSets.main.allSource } From 72ba6f7396cb2bc543ff5b1fcebc27a10f2eaa62 Mon Sep 17 00:00:00 2001 From: James Nugent Date: Tue, 20 May 2025 09:00:27 +0300 Subject: [PATCH 3/5] Fix deprecated use of Gradle java conventions This wraps deprcated usages of Java plugin conventions to use a plugin block, as documented in [1]. [1]: https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#java_convention_deprecation --- build.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 3ea7a4f376..14ca04793a 100644 --- a/build.gradle +++ b/build.gradle @@ -182,8 +182,10 @@ allprojects { subprojects { apply from: rootProject.file('gradle/testing.gradle') - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } def publishBuild = Boolean.parseBoolean(findProperty('publishBuild') ?: 'false') def autoServiceVersion = publishBuild ? libs.versions.autoService.asProvider().get() : libs.versions.autoService.development.get() From 9625eb4e9cc8646f0008537f7b09bf2245b8b61f Mon Sep 17 00:00:00 2001 From: James Nugent Date: Tue, 20 May 2025 09:15:43 +0300 Subject: [PATCH 4/5] Fix uses of Gradle application plugin conventions This commit fixes the deprecated usages of Gradle Application plugin conventions, by wrapping usage in plugin blocks as described in [1]. It also replaces usage of mainClassName with mainClass, a change necessitated by the Gradle 7 -> 8 migrations [2], but still supported via plugin conventions. [1]: https://docs.gradle.org/8.13/userguide/upgrading_version_8.html#application_convention_deprecation [2]: https://docs.gradle.org/current/userguide/upgrading_version_7.html#javaapplication_api_cleanup --- examples/examples.gradle | 6 ++++-- fdb-relational-server/fdb-relational-server.gradle | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/examples.gradle b/examples/examples.gradle index 0864e221e4..91e4310e93 100644 --- a/examples/examples.gradle +++ b/examples/examples.gradle @@ -30,5 +30,7 @@ dependencies { runtimeOnly(libs.log4j.core) // library } -mainClassName = 'com.apple.foundationdb.record.sample.Main' -applicationDefaultJvmArgs = ["-Dlog4j.configurationFile=${projectDir}/src/main/resources/log4j2.properties"] +application { + mainClass = 'com.apple.foundationdb.record.sample.Main' + applicationDefaultJvmArgs = ["-Dlog4j.configurationFile=${projectDir}/src/main/resources/log4j2.properties"] +} diff --git a/fdb-relational-server/fdb-relational-server.gradle b/fdb-relational-server/fdb-relational-server.gradle index 88816f84b8..93006e99ae 100644 --- a/fdb-relational-server/fdb-relational-server.gradle +++ b/fdb-relational-server/fdb-relational-server.gradle @@ -56,7 +56,9 @@ jar { // Task to build a fat jar, one w/ all dependencies shadowJar { - mainClassName = mainServerClass + application { + mainClass = mainServerClass + } mergeServiceFiles() } From 052252a26ba86a6593b6b82eaf58a71984b45f85 Mon Sep 17 00:00:00 2001 From: James Nugent Date: Tue, 20 May 2025 09:20:28 +0300 Subject: [PATCH 5/5] Stop using Gradle Task.project at execution time Per [1], usine of Task.project during task action execution is deprecated, and instead values should be captured during configuration. This commit replaces usage of Task.project and Task.rootProject by capturing variables during configuration as documented. [1]: https://docs.gradle.org/8.13/userguide/upgrading_version_7.html#task_project --- build.gradle | 11 +++++++---- fdb-relational-api/fdb-relational-api.gradle | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 14ca04793a..88af72a5f9 100644 --- a/build.gradle +++ b/build.gradle @@ -103,16 +103,19 @@ allprojects { reports.junitXml.outputLocation = project.file("${->project.buildDir}/test-results") } + def projectName = it.name + def projectVersion = it.version + // Configure JAR generation tasks.jar.configure { description = "Produces a Jar with the main classes in .out/." manifest { attributes "Built-JDK": System.getProperty("java.version"), - "Specification-Title": project.name, - "Specification-Version": "${-> project.version}", + "Specification-Title": projectName, + "Specification-Version": "${-> projectVersion}", "Specification-Vendor": "Apple Inc.", - "Implementation-Title": project.name, - "Implementation-Version": "${-> project.version}", + "Implementation-Title": projectName, + "Implementation-Version": "${-> projectVersion}", "Implementation-Vendor": "Apple Inc." } doFirst { diff --git a/fdb-relational-api/fdb-relational-api.gradle b/fdb-relational-api/fdb-relational-api.gradle index a694cfa7c8..7521bd69d0 100644 --- a/fdb-relational-api/fdb-relational-api.gradle +++ b/fdb-relational-api/fdb-relational-api.gradle @@ -30,16 +30,19 @@ task createVersionPropertiesFile() { // Write a file of version and build info for the java processes to read // from their classpaths. def versionsFile = new File(projectDir, "src/gen/main/resources/version.properties") + def projectVersion = project.version + def rootProjectName = rootProject.name def gitDetails = versionDetails() + outputs.file versionsFile doLast { println "Writing ${versionsFile}" versionsFile.text = """# Generated by fdb-relational-api build. # Returned by RelationalDatabaseMetaData#getDatabaseProductName() -name=${rootProject.name} +name=${rootProjectName} # Returned by RelationalDatabaseMetaData#getDatabaseProductVersion() # and by RelationalDatabaseMetaData#getDriverVersion() -version=${project.version} +version=${projectVersion} gitHash=${gitDetails.gitHashFull} branch=${gitDetails.branchName} # Returned as RelationalDatabaseMetaData#getUrl()