Skip to content

Commit 9b5062e

Browse files
committed
Merge branch '2.7.x' into 3.0.x
2 parents 09e67cd + b83e7b4 commit 9b5062e

File tree

15 files changed

+43
-55
lines changed

15 files changed

+43
-55
lines changed

Diff for: buildSrc/src/main/java/org/springframework/boot/build/bom/UpgradePolicy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-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.

Diff for: buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/ReleaseSchedule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 the original author or authors.
2+
* Copyright 2023-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.

Diff for: buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/StandardLibraryUpdateResolver.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,8 @@ class StandardLibraryUpdateResolver implements LibraryUpdateResolver {
5151
StandardLibraryUpdateResolver(VersionResolver versionResolver,
5252
List<BiPredicate<Library, DependencyVersion>> predicates) {
5353
this.versionResolver = versionResolver;
54-
BiPredicate<Library, DependencyVersion> predicate = null;
55-
for (BiPredicate<Library, DependencyVersion> p : predicates) {
56-
if (predicate == null) {
57-
predicate = p;
58-
}
59-
else {
60-
predicate = predicate.and(p);
61-
}
62-
}
63-
this.predicate = predicate;
54+
this.predicate = (library, dependencyVersion) -> predicates.stream()
55+
.allMatch((predicate) -> predicate.test(library, dependencyVersion));
6456
}
6557

6658
@Override

Diff for: buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/UpgradeDependencies.java

+28-32
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import javax.inject.Inject;
3535

3636
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
37+
import org.apache.maven.artifact.versioning.VersionRange;
3738
import org.gradle.api.DefaultTask;
3839
import org.gradle.api.InvalidUserDataException;
3940
import org.gradle.api.internal.tasks.userinput.UserInputHandler;
@@ -227,42 +228,37 @@ private List<Upgrade> resolveUpgrades(Milestone milestone) {
227228
}
228229

229230
protected List<BiPredicate<Library, DependencyVersion>> determineUpdatePredicates(Milestone milestone) {
230-
BiPredicate<Library, DependencyVersion> compilesWithUpgradePolicy = (library,
231-
candidate) -> this.bom.getUpgrade().getPolicy().test(candidate, library.getVersion().getVersion());
232-
BiPredicate<Library, DependencyVersion> isAnUpgrade = (library,
233-
candidate) -> library.getVersion().getVersion().isUpgrade(candidate, this.movingToSnapshots);
234-
BiPredicate<Library, DependencyVersion> isPermitted = (library, candidate) -> {
235-
for (ProhibitedVersion prohibitedVersion : library.getProhibitedVersions()) {
236-
String candidateString = candidate.toString();
237-
if (prohibitedVersion.getRange() != null
238-
&& prohibitedVersion.getRange().containsVersion(new DefaultArtifactVersion(candidateString))) {
239-
return false;
240-
}
241-
for (String startsWith : prohibitedVersion.getStartsWith()) {
242-
if (candidateString.startsWith(startsWith)) {
243-
return false;
244-
}
245-
}
246-
for (String endsWith : prohibitedVersion.getEndsWith()) {
247-
if (candidateString.endsWith(endsWith)) {
248-
return false;
249-
}
250-
}
251-
for (String contains : prohibitedVersion.getContains()) {
252-
if (candidateString.contains(contains)) {
253-
return false;
254-
}
255-
}
256-
}
257-
return true;
258-
};
259231
List<BiPredicate<Library, DependencyVersion>> updatePredicates = new ArrayList<>();
260-
updatePredicates.add(compilesWithUpgradePolicy);
261-
updatePredicates.add(isAnUpgrade);
262-
updatePredicates.add(isPermitted);
232+
updatePredicates.add(this::compilesWithUpgradePolicy);
233+
updatePredicates.add(this::isAnUpgrade);
234+
updatePredicates.add(this::isNotProhibited);
263235
return updatePredicates;
264236
}
265237

238+
private boolean compilesWithUpgradePolicy(Library library, DependencyVersion candidate) {
239+
return this.bom.getUpgrade().getPolicy().test(candidate, library.getVersion().getVersion());
240+
}
241+
242+
private boolean isAnUpgrade(Library library, DependencyVersion candidate) {
243+
return library.getVersion().getVersion().isUpgrade(candidate, this.movingToSnapshots);
244+
}
245+
246+
private boolean isNotProhibited(Library library, DependencyVersion candidate) {
247+
return !library.getProhibitedVersions()
248+
.stream()
249+
.anyMatch((prohibited) -> isProhibited(prohibited, candidate.toString()));
250+
}
251+
252+
private boolean isProhibited(ProhibitedVersion prohibited, String candidate) {
253+
boolean result = false;
254+
VersionRange range = prohibited.getRange();
255+
result = result || (range != null && range.containsVersion(new DefaultArtifactVersion(candidate)));
256+
result = result || prohibited.getStartsWith().stream().anyMatch(candidate::startsWith);
257+
result = result || prohibited.getStartsWith().stream().anyMatch(candidate::endsWith);
258+
result = result || prohibited.getStartsWith().stream().anyMatch(candidate::contains);
259+
return result;
260+
}
261+
266262
private List<Library> matchingLibraries() {
267263
List<Library> matchingLibraries = this.bom.getLibraries().stream().filter(this::eligible).toList();
268264
if (matchingLibraries.isEmpty()) {

Diff for: buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/Milestone.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-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.

Diff for: buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/AbstractDependencyVersion.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-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.

Diff for: buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/CalendarVersionDependencyVersion.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-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.

Diff for: buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/UnstructuredDependencyVersion.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-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.

Diff for: buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/ReleaseScheduleTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 the original author or authors.
2+
* Copyright 2023-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.

Diff for: buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/version/CalendarVersionDependencyVersionTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-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.

Diff for: buildSrc/src/test/java/org/springframework/boot/build/bom/bomr/version/DependencyVersionUpgradeTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023 the original author or authors.
2+
* Copyright 2023-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.

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisProperties.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-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.

Diff for: spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/NettyWebServerFactoryCustomizerTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-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.

Diff for: spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/jdbc/ExampleRepository.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-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.

Diff for: spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/socket/DomainSocket.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private FileDescriptor open(String path) {
7474
return new FileDescriptor(handle, this::close);
7575
}
7676
catch (RuntimeException ex) {
77-
this.close(handle);
77+
close(handle);
7878
throw ex;
7979
}
8080
}

0 commit comments

Comments
 (0)