|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|