Skip to content

Commit affc1dc

Browse files
committed
Update to Gradle 9
Closes gh-1340 Signed-off-by: Josh Cummings <3627351+jzheaux@users.noreply.github.com>
1 parent fffaae4 commit affc1dc

13 files changed

Lines changed: 84 additions & 55 deletions

File tree

‎buildSrc/build.gradle‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ plugins {
55
id 'com.apollographql.apollo' version '4.3.3'
66
}
77

8-
sourceCompatibility = JavaVersion.VERSION_17
8+
java {
9+
sourceCompatibility = JavaVersion.VERSION_17
10+
}
911

1012
repositories {
1113
gradlePluginPortal()
@@ -95,7 +97,7 @@ dependencies {
9597
implementation 'net.sourceforge.htmlunit:htmlunit:2.70.0'
9698
implementation 'org.asciidoctor:asciidoctor-gradle-jvm:4.0.5'
9799
implementation 'org.hidetake:gradle-ssh-plugin:2.10.1'
98-
implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:4.34.2'
100+
implementation 'org.jfrog.buildinfo:build-info-extractor-gradle:5.2.3'
99101
implementation 'org.springframework:spring-core:6.2.15'
100102
implementation 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:7.1.0.6387'
101103

‎buildSrc/src/main/groovy/io/spring/gradle/IncludeRepoTask.groovy‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ abstract class IncludeRepoTask extends DefaultTask {
5454
* Directory where the project template should be copied.
5555
*/
5656
@OutputDirectory
57-
final File outputDirectory = project.file("$project.buildDir/$name")
57+
final File outputDirectory = project.file("${project.layout.buildDirectory.get().asFile}/$name")
5858

5959
@TaskAction
6060
void checkoutAndCopy() {

‎buildSrc/src/main/groovy/io/spring/gradle/convention/JavadocApiPlugin.groovy‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import org.gradle.api.Action
2020
import org.gradle.api.JavaVersion
2121
import org.gradle.api.Plugin
2222
import org.gradle.api.Project
23-
import org.gradle.api.plugins.JavaPluginConvention
23+
import org.gradle.api.plugins.JavaPluginExtension
2424
import org.gradle.api.tasks.SourceSet
2525
import org.gradle.api.tasks.javadoc.Javadoc
2626
import org.slf4j.Logger
@@ -67,7 +67,7 @@ public class JavadocApiPlugin implements Plugin<Project> {
6767
}
6868

6969
api.setMaxMemory("1024m");
70-
api.setDestinationDir(new File(project.getBuildDir(), "api"));
70+
api.setDestinationDir(project.layout.buildDirectory.dir("api").get().asFile);
7171

7272
project.getPluginManager().apply("io.spring.convention.javadoc-options");
7373
}
@@ -95,7 +95,7 @@ public class JavadocApiPlugin implements Plugin<Project> {
9595
public void execute(SpringModulePlugin plugin) {
9696
logger.info("Added sources for {}", project);
9797

98-
JavaPluginConvention java = project.getConvention().getPlugin(JavaPluginConvention.class);
98+
JavaPluginExtension java = project.getExtensions().getByType(JavaPluginExtension.class);
9999
SourceSet mainSourceSet = java.getSourceSets().getByName("main");
100100

101101
api.setSource(api.getSource().plus(mainSourceSet.getAllJava()));

‎buildSrc/src/main/groovy/io/spring/gradle/convention/RootProjectPlugin.groovy‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class RootProjectPlugin implements Plugin<Project> {
4141
properties {
4242
property "sonar.java.coveragePlugin", "jacoco"
4343
property "sonar.projectName", projectName
44-
property "sonar.jacoco.reportPath", "${project.buildDir.name}/jacoco.exec"
44+
property "sonar.jacoco.reportPath", "${project.layout.buildDirectory.get().asFile.name}/jacoco.exec"
4545
property "sonar.links.homepage", "https://spring.io/${projectName}"
4646
property "sonar.links.ci", "https://jenkins.spring.io/job/${projectName}/"
4747
property "sonar.links.issue", "https://github.com/spring-projects/${projectName}/issues"
@@ -50,9 +50,10 @@ class RootProjectPlugin implements Plugin<Project> {
5050
}
5151
}
5252

53-
def finalizeDeployArtifacts = project.task("finalizeDeployArtifacts")
54-
if (Utils.isRelease(project) && project.hasProperty("ossrhUsername")) {
55-
finalizeDeployArtifacts.dependsOn project.tasks.closeAndReleaseOssrhStagingRepository
53+
project.tasks.register("finalizeDeployArtifacts") { task ->
54+
if (Utils.isRelease(project) && project.hasProperty("ossrhUsername")) {
55+
task.dependsOn project.tasks.named('closeAndReleaseOssrhStagingRepository')
56+
}
5657
}
5758
}
5859

‎buildSrc/src/main/groovy/io/spring/gradle/convention/SchemaDeployPlugin.groovy‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class SchemaDeployPlugin implements Plugin<Project> {
3434
}
3535
}
3636

37-
project.task('deploySchema') {
37+
project.tasks.register('deploySchema') {
3838
dependsOn 'schemaZip'
3939
doFirst {
4040
project.ssh.run {

‎buildSrc/src/main/groovy/io/spring/gradle/convention/SpringModulePlugin.groovy‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ class SpringModulePlugin extends AbstractSpringJavaPlugin {
3535
pluginManager.apply(SpringMavenPlugin.class);
3636
pluginManager.apply("io.spring.convention.jacoco");
3737

38-
def deployArtifacts = project.task("deployArtifacts")
39-
deployArtifacts.group = 'Deploy tasks'
40-
deployArtifacts.description = "Deploys the artifacts to either Artifactory or Maven Central"
41-
if (!Utils.isRelease(project)) {
42-
deployArtifacts.dependsOn project.tasks.artifactoryPublish
38+
project.tasks.register("deployArtifacts") { task ->
39+
task.group = 'Deploy tasks'
40+
task.description = "Deploys the artifacts to either Artifactory or Maven Central"
41+
if (!Utils.isRelease(project)) {
42+
task.dependsOn project.tasks.named('artifactoryPublish')
43+
}
4344
}
4445
project.tasks.withType(Jar) {
4546
from(project.rootProject.files('LICENSE.txt')) {

‎buildSrc/src/main/groovy/io/spring/gradle/convention/TestsConfigurationPlugin.groovy‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class TestsConfigurationPlugin implements Plugin<Project> {
3939

4040
private void applyJavaProject(Project project) {
4141
project.configurations {
42-
tests.extendsFrom testRuntime, testRuntimeClasspath
42+
tests.extendsFrom testRuntimeOnly, testRuntimeClasspath
4343
}
4444

4545
project.tasks.create('testJar', Jar) {

‎buildSrc/src/main/java/s101/S101Plugin.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private void configure(JavaExec exec) {
5656
exec
5757
.workingDir(extension.getInstallationDirectory())
5858
.classpath(new File(extension.getInstallationDirectory().get(), "structure101-java-build.jar"))
59-
.args(new File(new File(project.getBuildDir(), "s101"), "config.xml"))
59+
.args(new File(new File(project.getLayout().getBuildDirectory().get().getAsFile(), "s101"), "config.xml"))
6060
.systemProperty("s101.label", computeLabel(extension).get())
6161
.doFirst((task) -> {
6262
installAndConfigureIfNeeded(project);
@@ -95,12 +95,12 @@ private void installAndConfigureIfNeeded(Project project) {
9595

9696
private void copyConfigurationToBuildDirectory(S101PluginExtension extension, Project project) {
9797
Path configurationDirectory = extension.getConfigurationDirectory().get().toPath();
98-
Path buildDirectory = project.getBuildDir().toPath();
98+
Path buildDirectory = project.getLayout().getBuildDirectory().get().getAsFile().toPath();
9999
copyDirectory(project, configurationDirectory, buildDirectory);
100100
}
101101

102102
private void copyResultsBackToConfigurationDirectory(S101PluginExtension extension, Project project) {
103-
Path buildConfigurationDirectory = project.getBuildDir().toPath().resolve("s101");
103+
Path buildConfigurationDirectory = project.getLayout().getBuildDirectory().get().getAsFile().toPath().resolve("s101");
104104
String label = extension.getLabel().get();
105105
if ("baseline".equals(label)) { // a new baseline was created
106106
copyDirectory(project, buildConfigurationDirectory.resolve("repository").resolve("snapshots"),
@@ -122,7 +122,7 @@ private void copyDirectory(Project project, Path source, Path destination) {
122122
}
123123
InputStream input;
124124
if ("project.java.hsp".equals(each.toFile().getName())) {
125-
Path relativeTo = project.getBuildDir().toPath().resolve("s101").relativize(project.getProjectDir().toPath());
125+
Path relativeTo = project.getLayout().getBuildDirectory().get().getAsFile().toPath().resolve("s101").relativize(project.getProjectDir().toPath());
126126
String value = "const(THIS_FILE)/" + relativeTo;
127127
input = replace(each, "<property name=\"relative-to\" value=\"(.*)\" />", "<property name=\"relative-to\" value=\"" + value + "\" />");
128128
} else if (each.toFile().toString().endsWith(".xml")) {

‎gradle/wrapper/gradle-wrapper.jar‎

-15.4 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)