Skip to content

Commit

Permalink
Fix for WFGP-279, Enforce that minimum stability enables the specifie…
Browse files Browse the repository at this point in the history
…d stability
  • Loading branch information
Jean Francois Denise committed Apr 3, 2024
1 parent dec6e96 commit 4bdefa3
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,27 @@ public void execute() throws MojoExecutionException, MojoFailureException {
defaultConfigStabilityLevel = Stability.fromString(stabilityLevel);
defaultPackageStabilityLevel = Stability.fromString(stabilityLevel);
}
// Check that the minimum Stability level enables the stability level
checkStabilityLevels(buildTimestabilityLevel, defaultConfigStabilityLevel, defaultPackageStabilityLevel);
artifactVersions = MavenProjectArtifactVersions.getInstance(project);
doExecute();
} catch (RuntimeException | Error | MojoExecutionException | MojoFailureException e) {
throw e;
}
}

private static void checkStabilityLevels(Stability min, Stability config, Stability pkg) throws MojoExecutionException {
min = min == null ? Stability.DEFAULT : min;
config = config == null ? Stability.DEFAULT : config;
pkg = pkg == null ? Stability.DEFAULT : pkg;
if (!min.enables(config)) {
throw new MojoExecutionException("The minimum stability " + min + " doesn't enable the config stability " + config);
}
if (!min.enables(pkg)) {
throw new MojoExecutionException("The minimum stability " + min + " doesn't enable the package stability " + pkg);
}
}

protected Map<String, FeaturePackDescription> getFpDependencies() {
return fpDependencies;
}
Expand Down

0 comments on commit 4bdefa3

Please sign in to comment.