mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '3.0.x' into 3.1.x
This commit is contained in:
commit
78eb8f90d1
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2023 the original author or authors.
|
* Copyright 2023-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -51,16 +51,8 @@ class StandardLibraryUpdateResolver implements LibraryUpdateResolver {
|
|||||||
StandardLibraryUpdateResolver(VersionResolver versionResolver,
|
StandardLibraryUpdateResolver(VersionResolver versionResolver,
|
||||||
List<BiPredicate<Library, DependencyVersion>> predicates) {
|
List<BiPredicate<Library, DependencyVersion>> predicates) {
|
||||||
this.versionResolver = versionResolver;
|
this.versionResolver = versionResolver;
|
||||||
BiPredicate<Library, DependencyVersion> predicate = null;
|
this.predicate = (library, dependencyVersion) -> predicates.stream()
|
||||||
for (BiPredicate<Library, DependencyVersion> p : predicates) {
|
.allMatch((predicate) -> predicate.test(library, dependencyVersion));
|
||||||
if (predicate == null) {
|
|
||||||
predicate = p;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
predicate = predicate.and(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.predicate = predicate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,6 +34,7 @@ import java.util.regex.Pattern;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
|
import org.apache.maven.artifact.versioning.VersionRange;
|
||||||
import org.gradle.api.DefaultTask;
|
import org.gradle.api.DefaultTask;
|
||||||
import org.gradle.api.InvalidUserDataException;
|
import org.gradle.api.InvalidUserDataException;
|
||||||
import org.gradle.api.internal.tasks.userinput.UserInputHandler;
|
import org.gradle.api.internal.tasks.userinput.UserInputHandler;
|
||||||
@ -227,42 +228,37 @@ public abstract class UpgradeDependencies extends DefaultTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected List<BiPredicate<Library, DependencyVersion>> determineUpdatePredicates(Milestone milestone) {
|
protected List<BiPredicate<Library, DependencyVersion>> determineUpdatePredicates(Milestone milestone) {
|
||||||
BiPredicate<Library, DependencyVersion> compilesWithUpgradePolicy = (library,
|
|
||||||
candidate) -> this.bom.getUpgrade().getPolicy().test(candidate, library.getVersion().getVersion());
|
|
||||||
BiPredicate<Library, DependencyVersion> isAnUpgrade = (library,
|
|
||||||
candidate) -> library.getVersion().getVersion().isUpgrade(candidate, this.movingToSnapshots);
|
|
||||||
BiPredicate<Library, DependencyVersion> isPermitted = (library, candidate) -> {
|
|
||||||
for (ProhibitedVersion prohibitedVersion : library.getProhibitedVersions()) {
|
|
||||||
String candidateString = candidate.toString();
|
|
||||||
if (prohibitedVersion.getRange() != null
|
|
||||||
&& prohibitedVersion.getRange().containsVersion(new DefaultArtifactVersion(candidateString))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (String startsWith : prohibitedVersion.getStartsWith()) {
|
|
||||||
if (candidateString.startsWith(startsWith)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (String endsWith : prohibitedVersion.getEndsWith()) {
|
|
||||||
if (candidateString.endsWith(endsWith)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (String contains : prohibitedVersion.getContains()) {
|
|
||||||
if (candidateString.contains(contains)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
List<BiPredicate<Library, DependencyVersion>> updatePredicates = new ArrayList<>();
|
List<BiPredicate<Library, DependencyVersion>> updatePredicates = new ArrayList<>();
|
||||||
updatePredicates.add(compilesWithUpgradePolicy);
|
updatePredicates.add(this::compilesWithUpgradePolicy);
|
||||||
updatePredicates.add(isAnUpgrade);
|
updatePredicates.add(this::isAnUpgrade);
|
||||||
updatePredicates.add(isPermitted);
|
updatePredicates.add(this::isNotProhibited);
|
||||||
return updatePredicates;
|
return updatePredicates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean compilesWithUpgradePolicy(Library library, DependencyVersion candidate) {
|
||||||
|
return this.bom.getUpgrade().getPolicy().test(candidate, library.getVersion().getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAnUpgrade(Library library, DependencyVersion candidate) {
|
||||||
|
return library.getVersion().getVersion().isUpgrade(candidate, this.movingToSnapshots);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isNotProhibited(Library library, DependencyVersion candidate) {
|
||||||
|
return !library.getProhibitedVersions()
|
||||||
|
.stream()
|
||||||
|
.anyMatch((prohibited) -> isProhibited(prohibited, candidate.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isProhibited(ProhibitedVersion prohibited, String candidate) {
|
||||||
|
boolean result = false;
|
||||||
|
VersionRange range = prohibited.getRange();
|
||||||
|
result = result || (range != null && range.containsVersion(new DefaultArtifactVersion(candidate)));
|
||||||
|
result = result || prohibited.getStartsWith().stream().anyMatch(candidate::startsWith);
|
||||||
|
result = result || prohibited.getStartsWith().stream().anyMatch(candidate::endsWith);
|
||||||
|
result = result || prohibited.getStartsWith().stream().anyMatch(candidate::contains);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private List<Library> matchingLibraries() {
|
private List<Library> matchingLibraries() {
|
||||||
List<Library> matchingLibraries = this.bom.getLibraries().stream().filter(this::eligible).toList();
|
List<Library> matchingLibraries = this.bom.getLibraries().stream().filter(this::eligible).toList();
|
||||||
if (matchingLibraries.isEmpty()) {
|
if (matchingLibraries.isEmpty()) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2020 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2023 the original author or authors.
|
* Copyright 2023-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2023 the original author or authors.
|
* Copyright 2023-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -227,10 +227,12 @@ public class BraveAutoConfiguration {
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private Factory createThrowAwayFactory() {
|
private Factory createThrowAwayFactory() {
|
||||||
return new Factory() {
|
return new Factory() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
|
public <K> Propagation<K> create(KeyFactory<K> keyFactory) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2022 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2012-2021 the original author or authors.
|
* Copyright 2012-2023 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -74,7 +74,7 @@ public abstract class DomainSocket extends AbstractSocket {
|
|||||||
return new FileDescriptor(handle, this::close);
|
return new FileDescriptor(handle, this::close);
|
||||||
}
|
}
|
||||||
catch (RuntimeException ex) {
|
catch (RuntimeException ex) {
|
||||||
this.close(handle);
|
close(handle);
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user