Skip to content

Commit 6669ab1

Browse files
committed
Merge pull request #31416 from GVictorG7
* pr/31416: Polish "Replace deprecated method getBuildDir()" Replace deprecated method getBuildDir() Closes gh-31416
2 parents 3b50f99 + d05ac09 commit 6669ab1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -131,8 +131,9 @@ private Configuration getRuntimeClassPath(Project project) {
131131
}
132132

133133
private File getOutputFile(String baseLineVersion, Project project) {
134-
Path outDir = Paths.get(project.getRootProject().getBuildDir().getAbsolutePath(),
135-
"reports", "api-diff",
134+
String buildDirectoryPath = project.getRootProject()
135+
.getLayout().getBuildDirectory().getAsFile().get().getAbsolutePath();
136+
Path outDir = Paths.get(buildDirectoryPath, "reports", "api-diff",
136137
baseLineVersion + "_to_" + project.getRootProject().getVersion());
137138
return project.file(outDir.resolve(project.getName() + ".html").toString());
138139
}

settings.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ rootProject.children.each {project ->
4747
settings.gradle.projectsLoaded {
4848
gradleEnterprise {
4949
buildScan {
50-
File buildDir = settings.gradle.rootProject.getBuildDir()
50+
File buildDir = settings.gradle.rootProject
51+
.getLayout().getBuildDirectory().getAsFile().get()
5152
buildDir.mkdirs()
5253
new File(buildDir, "build-scan-uri.txt").text = "(build scan not generated)"
5354
buildScanPublished { scan ->

0 commit comments

Comments
 (0)