mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Merge branch '2.7.x'
Closes gh-33816
This commit is contained in:
commit
75f934c92e
@ -244,16 +244,11 @@ public class BomExtension {
|
||||
.add(new Group(groupHandler.id, groupHandler.modules, groupHandler.plugins, groupHandler.imports));
|
||||
}
|
||||
|
||||
public void prohibit(String range, Action<ProhibitedVersionHandler> action) {
|
||||
ProhibitedVersionHandler prohibitedVersionHandler = new ProhibitedVersionHandler();
|
||||
action.execute(prohibitedVersionHandler);
|
||||
try {
|
||||
this.prohibitedVersions.add(new ProhibitedVersion(VersionRange.createFromVersionSpec(range),
|
||||
prohibitedVersionHandler.reason));
|
||||
}
|
||||
catch (InvalidVersionSpecificationException ex) {
|
||||
throw new InvalidUserCodeException("Invalid version range", ex);
|
||||
}
|
||||
public void prohibit(Action<ProhibitedHandler> action) {
|
||||
ProhibitedHandler handler = new ProhibitedHandler();
|
||||
action.execute(handler);
|
||||
this.prohibitedVersions.add(
|
||||
new ProhibitedVersion(handler.versionRange, handler.endsWith, handler.contains, handler.reason));
|
||||
}
|
||||
|
||||
public void dependencyVersions(Action<DependencyVersionsHandler> action) {
|
||||
@ -273,10 +268,33 @@ public class BomExtension {
|
||||
|
||||
}
|
||||
|
||||
public static class ProhibitedVersionHandler {
|
||||
public static class ProhibitedHandler {
|
||||
|
||||
private String reason;
|
||||
|
||||
private String endsWith;
|
||||
|
||||
private String contains;
|
||||
|
||||
private VersionRange versionRange;
|
||||
|
||||
public void versionRange(String versionRange) {
|
||||
try {
|
||||
this.versionRange = VersionRange.createFromVersionSpec(versionRange);
|
||||
}
|
||||
catch (InvalidVersionSpecificationException ex) {
|
||||
throw new InvalidUserCodeException("Invalid version range", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void endsWith(String endsWith) {
|
||||
this.endsWith = endsWith;
|
||||
}
|
||||
|
||||
public void contains(String contains) {
|
||||
this.contains = contains;
|
||||
}
|
||||
|
||||
public void because(String because) {
|
||||
this.reason = because;
|
||||
}
|
||||
|
@ -104,10 +104,16 @@ public class Library {
|
||||
|
||||
private final VersionRange range;
|
||||
|
||||
private final String endsWith;
|
||||
|
||||
private final String contains;
|
||||
|
||||
private final String reason;
|
||||
|
||||
public ProhibitedVersion(VersionRange range, String reason) {
|
||||
public ProhibitedVersion(VersionRange range, String endsWith, String contains, String reason) {
|
||||
this.range = range;
|
||||
this.endsWith = endsWith;
|
||||
this.contains = contains;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@ -115,6 +121,14 @@ public class Library {
|
||||
return this.range;
|
||||
}
|
||||
|
||||
public String getEndsWith() {
|
||||
return this.endsWith;
|
||||
}
|
||||
|
||||
public String getContains() {
|
||||
return this.contains;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return this.reason;
|
||||
}
|
||||
|
@ -170,10 +170,18 @@ public final class InteractiveUpgradeResolver implements UpgradeResolver {
|
||||
return true;
|
||||
}
|
||||
for (ProhibitedVersion prohibitedVersion : prohibitedVersions) {
|
||||
if (prohibitedVersion.getRange()
|
||||
if (prohibitedVersion.getRange() != null && prohibitedVersion.getRange()
|
||||
.containsVersion(new DefaultArtifactVersion(dependencyVersion.toString()))) {
|
||||
return false;
|
||||
}
|
||||
if (prohibitedVersion.getEndsWith() != null
|
||||
&& dependencyVersion.toString().endsWith(prohibitedVersion.getEndsWith())) {
|
||||
return false;
|
||||
}
|
||||
if (prohibitedVersion.getContains() != null
|
||||
&& dependencyVersion.toString().contains(prohibitedVersion.getContains())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -63,7 +63,8 @@ bom {
|
||||
}
|
||||
}
|
||||
library("JLine", "2.11") {
|
||||
prohibit("[2.12,)") {
|
||||
prohibit {
|
||||
versionRange "[2.12,)"
|
||||
because "it contains breaking changes"
|
||||
}
|
||||
group("jline") {
|
||||
|
Loading…
Reference in New Issue
Block a user