From 35103b0cd1a431684b1247dc6e964cf8aa6586c1 Mon Sep 17 00:00:00 2001 From: Victor Georgescu Date: Wed, 11 Oct 2023 23:58:32 +0300 Subject: [PATCH 1/2] Replace deprecated method getBuildDir() See gh-31416 --- .../main/java/org/springframework/build/api/ApiDiffPlugin.java | 3 ++- settings.gradle | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java b/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java index eee0137049..010cb3823f 100644 --- a/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java +++ b/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java @@ -131,7 +131,8 @@ public class ApiDiffPlugin implements Plugin { } private File getOutputFile(String baseLineVersion, Project project) { - Path outDir = Paths.get(project.getRootProject().getBuildDir().getAbsolutePath(), + Path outDir = Paths.get(project.getRootProject() + .getLayout().getBuildDirectory().getAsFile().get().getAbsolutePath(), "reports", "api-diff", baseLineVersion + "_to_" + project.getRootProject().getVersion()); return project.file(outDir.resolve(project.getName() + ".html").toString()); diff --git a/settings.gradle b/settings.gradle index db9424fc99..764fc441d9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -47,7 +47,7 @@ rootProject.children.each {project -> settings.gradle.projectsLoaded { gradleEnterprise { buildScan { - File buildDir = settings.gradle.rootProject.getBuildDir() + File buildDir = settings.gradle.rootProject.getLayout().getBuildDirectory().getAsFile().get() buildDir.mkdirs() new File(buildDir, "build-scan-uri.txt").text = "(build scan not generated)" buildScanPublished { scan -> From d05ac097dd482106ae1d76133622ad78b91502cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Thu, 12 Oct 2023 16:14:23 +0200 Subject: [PATCH 2/2] Polish "Replace deprecated method getBuildDir()" See gh-31416 --- .../java/org/springframework/build/api/ApiDiffPlugin.java | 8 ++++---- settings.gradle | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java b/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java index 010cb3823f..4946191282 100644 --- a/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java +++ b/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -131,9 +131,9 @@ public class ApiDiffPlugin implements Plugin { } private File getOutputFile(String baseLineVersion, Project project) { - Path outDir = Paths.get(project.getRootProject() - .getLayout().getBuildDirectory().getAsFile().get().getAbsolutePath(), - "reports", "api-diff", + String buildDirectoryPath = project.getRootProject() + .getLayout().getBuildDirectory().getAsFile().get().getAbsolutePath(); + Path outDir = Paths.get(buildDirectoryPath, "reports", "api-diff", baseLineVersion + "_to_" + project.getRootProject().getVersion()); return project.file(outDir.resolve(project.getName() + ".html").toString()); } diff --git a/settings.gradle b/settings.gradle index 764fc441d9..fac8d089de 100644 --- a/settings.gradle +++ b/settings.gradle @@ -47,7 +47,8 @@ rootProject.children.each {project -> settings.gradle.projectsLoaded { gradleEnterprise { buildScan { - File buildDir = settings.gradle.rootProject.getLayout().getBuildDirectory().getAsFile().get() + File buildDir = settings.gradle.rootProject + .getLayout().getBuildDirectory().getAsFile().get() buildDir.mkdirs() new File(buildDir, "build-scan-uri.txt").text = "(build scan not generated)" buildScanPublished { scan ->