Skip to content

Commit 076a384

Browse files
committed
Merge branch '2.2.x'
Closes gh-21112
2 parents d5b9441 + 29dc236 commit 076a384

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/LayerResolver.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717
package org.springframework.boot.gradle.tasks.bundling;
1818

1919
import java.io.File;
20+
import java.util.Arrays;
21+
import java.util.Collections;
22+
import java.util.HashSet;
2023
import java.util.LinkedHashMap;
2124
import java.util.Map;
25+
import java.util.Set;
2226

2327
import org.gradle.api.artifacts.ArtifactCollection;
2428
import org.gradle.api.artifacts.Configuration;
@@ -92,14 +96,19 @@ private Library asLibrary(FileCopyDetails details) {
9296
*/
9397
private static class ResolvedDependencies {
9498

99+
private static final Set<String> DEPRECATED_FOR_RESOLUTION_CONFIGURATIONS = Collections
100+
.unmodifiableSet(new HashSet<>(Arrays.asList("archives", "compile", "compileOnly", "default", "runtime",
101+
"testCompile", "testCompileOnly", "testRuntime")));
102+
95103
private final Map<Configuration, ResolvedConfigurationDependencies> configurationDependencies = new LinkedHashMap<>();
96104

97105
ResolvedDependencies(Iterable<Configuration> configurations) {
98106
configurations.forEach(this::processConfiguration);
99107
}
100108

101109
private void processConfiguration(Configuration configuration) {
102-
if (configuration.isCanBeResolved()) {
110+
if (configuration.isCanBeResolved()
111+
&& !DEPRECATED_FOR_RESOLUTION_CONFIGURATIONS.contains(configuration.getName())) {
103112
this.configurationDependencies.put(configuration,
104113
new ResolvedConfigurationDependencies(configuration.getIncoming().getArtifacts()));
105114
}

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/docs/PublishingDocumentationTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ class PublishingDocumentationTests {
3939

4040
@TestTemplate
4141
void mavenUpload() throws IOException {
42-
assertThat(this.gradleBuild.script("src/docs/gradle/publishing/maven").build("deployerRepository").getOutput())
43-
.contains("https://repo.example.com");
42+
assertThat(this.gradleBuild.expectDeprecationWarningsWithAtLeastVersion("5.6")
43+
.script("src/docs/gradle/publishing/maven").build("deployerRepository").getOutput())
44+
.contains("https://repo.example.com");
4445
}
4546

4647
@TestTemplate

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/testkit/GradleBuild.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void before() throws IOException {
8989
}
9090

9191
void after() {
92-
GradleBuild.this.script = null;
92+
this.script = null;
9393
FileSystemUtils.deleteRecursively(this.projectDir);
9494
}
9595

@@ -127,8 +127,8 @@ public GradleBuild expectDeprecationWarningsWithAtLeastVersion(String gradleVers
127127
public BuildResult build(String... arguments) {
128128
try {
129129
BuildResult result = prepareRunner(arguments).build();
130-
if (this.gradleVersion != null && this.expectDeprecationWarnings != null
131-
&& this.expectDeprecationWarnings.compareTo(GradleVersion.version(this.gradleVersion)) > 0) {
130+
if (this.expectDeprecationWarnings == null || (this.gradleVersion != null
131+
&& this.expectDeprecationWarnings.compareTo(GradleVersion.version(this.gradleVersion)) > 0)) {
132132
assertThat(result.getOutput()).doesNotContain("Deprecated").doesNotContain("deprecated");
133133
}
134134
return result;
@@ -167,6 +167,8 @@ public GradleRunner prepareRunner(String... arguments) throws IOException {
167167
allArguments.add("-PbootVersion=" + getBootVersion());
168168
allArguments.add("--stacktrace");
169169
allArguments.addAll(Arrays.asList(arguments));
170+
allArguments.add("--warning-mode");
171+
allArguments.add("all");
170172
return gradleRunner.withArguments(allArguments);
171173
}
172174

0 commit comments

Comments
 (0)