Fixed missing options for tasks

This commit is contained in:
Marcin Grzejszczak
2018-06-25 13:21:48 +02:00
parent 2a4cf036c6
commit 909f212713
4 changed files with 29 additions and 11 deletions

View File

@@ -142,7 +142,7 @@ You will see a help screen looking like more or less like this
----
Here you can find the list of tasks in order
[updatePoms,build,commit,deploy,docs,snapshots,push,closeMilestone,createTemplates,updateSagan,updateGuides,updateDocumentation]
[release,releaseVerbose,metaRelease,postRelease,updatePoms,build,commit,deploy,docs,snapshots,push,closeMilestone,updateSagan,createTemplates,updateGuides,updateDocumentation]
Option Description
@@ -154,12 +154,13 @@ Option Description
-b, --build [String] Build the project
-c, --commit [String] Commit, tag and push the tag
-d, --deploy [String] Deploy the artifacts
-f, --full-release [Boolean] Do you want to do the full release
(default: false)
-f, --full-release [Boolean] Do you want to do the full release of a
single project? (default: false)
-g, --updateSagan [String] Updating Sagan with release info
-h, --help [String]
-i, --interactive <Boolean> Do you want to set the properties from
the command line (default: true)
the command line of a single project?
(default: true)
-m, --closeMilestone [String] Close the milestone at Github
-o, --docs [String] Publish the docs
-p, --push [String] Push the commits
@@ -172,10 +173,14 @@ Option Description
-s, --snapshots [String] Go back to snapshots and bump
originalVersion by patch
-t, --createTemplates [String] Create email / blog / tweet etc. templates
--task-names, --tn <String> Starts all release task for the given
task names
-u, --updatePoms [String] Update poms with versions from Spring
Cloud Release
--ud, --updateDocumentation [String] Updating documentation repository
--ug, --updateGuides [String] Updating Spring Guides
-x, --meta-release <Boolean> Do you want to do the meta release?
(default: false)
Examples of usage:

View File

@@ -43,6 +43,10 @@ class OptionsParser implements Parser {
.acceptsAll(Arrays.asList("a", "start-from"),
"Starts all release task starting from the given task. Requires passing the task name (either one letter or the full name)")
.withRequiredArg().ofType(String.class);
ArgumentAcceptingOptionSpec<String> taskNamesOpt = parser
.acceptsAll(Arrays.asList("tn", "task-names"),
"Starts all release task for the given task names")
.withRequiredArg().ofType(String.class);
ArgumentAcceptingOptionSpec<String> rangeOpt = parser.acceptsAll(Arrays.asList("r", "range"),
"Runs release tasks from the given range. Requires passing the task names with a hyphen. The first task is inclusive, the second inclusive. E.g. 's-m' would mean running 'snapshot', 'push' and 'milestone' tasks")
.withRequiredArg().ofType(String.class);
@@ -56,8 +60,16 @@ class OptionsParser implements Parser {
Boolean metaRelease = options.valueOf(metaReleaseOpt);
Boolean interactive = options.valueOf(interactiveOpt);
Boolean fullRelease = options.has(fullReleaseOpt);
List<String> taskNames = Tasks.NON_COMPOSITE_TASKS.stream()
.filter(task -> options.has(task.name)).map(task -> task.name)
List<String> providedTaskNames = Arrays
.asList(options.valueOf(taskNamesOpt).split(","));
List<String> allTaskNames = Tasks.NON_COMPOSITE_TASKS.stream()
.map(task -> task.name)
.collect(Collectors.toList());
if (providedTaskNames.isEmpty()) {
providedTaskNames.addAll(allTaskNames);
}
List<String> taskNames = allTaskNames.stream()
.filter(providedTaskNames::contains)
.collect(Collectors.toList());
String startFrom = options.valueOf(startFromOpt);
String range = options.valueOf(rangeOpt);

View File

@@ -101,16 +101,16 @@ class Tasks {
"FULL RELEASE",
"Perform a full release of this project without interruptions",
args -> DEFAULT_TASKS_PER_PROJECT.forEach(task -> task.execute(args)));
static Task POST_RELEASE = Tasks.task("post-release", "pr",
static Task POST_RELEASE = Tasks.task("postRelease", "pr",
"POST RELEASE TASKS",
"Perform post release tasks for this release without interruptions",
args -> DEFAULT_TASKS_PER_RELEASE.forEach(task -> task.execute(args)),
TaskType.POST_RELEASE);
static Task RELEASE_VERBOSE = Tasks.task("release-verbose", "r",
static Task RELEASE_VERBOSE = Tasks.task("releaseVerbose", "r",
"FULL VERBOSE RELEASE",
"Perform a full release of this project in interactive mode (you'll be asked about skipping steps)",
args -> DEFAULT_TASKS_PER_PROJECT.forEach(task -> task.execute(args)));
static Task META_RELEASE = Tasks.task("meta-release", "x",
static Task META_RELEASE = Tasks.task("metaRelease", "x",
"META RELEASE",
"Perform a meta release of projects",
args -> DEFAULT_TASKS_PER_PROJECT.forEach(task -> {
@@ -121,7 +121,8 @@ class Tasks {
static final List<Task> COMPOSITE_TASKS = Stream.of(
RELEASE,
RELEASE_VERBOSE,
META_RELEASE
META_RELEASE,
POST_RELEASE
).collect(Collectors.toList());
static final List<Task> ALL_TASKS_PER_PROJECT = Stream.of(

View File

@@ -517,7 +517,7 @@ public class AcceptanceTests {
Releaser releaser = defaultReleaser(expectedVersion, projectName, properties);
return new SpringReleaser(releaser, properties, new OptionsProcessor(releaser, properties) {
@Override String chosenOption() {
return "12";
return "13";
}
@Override void postReleaseOptions(Options options, Args defaultArgs) {