Skip to content

Commit

Permalink
Add a 'rewriteDiscover' task that depends on all tasks of type Rewrit…
Browse files Browse the repository at this point in the history
…eDiscover, for parity with the thematically similar 'rewriteFix' and 'rewriteWarn' tasks
  • Loading branch information
sambsnyd committed Jan 8, 2021
1 parent 8bb1c43 commit 22f85ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,20 @@ public void apply(Project project) {
Task checkTask = tasks.getByName("check");
checkTask.dependsOn(rewriteWarnAll);

Task rewriteDiscoverAll = tasks.create("rewriteDiscover", taskClosure(task -> {
task.setGroup("rewrite");
task.setDescription("Lists all available recipes and their visitors available to each SourceSet");
}));

sourceSets.all(sourceSet -> {
String rewriteFixTaskName = "rewriteFix" + sourceSet.getName().substring(0, 1).toUpperCase() + sourceSet.getName().substring(1);

RewriteFixTask rewriteFix = tasks.create(rewriteFixTaskName, RewriteFixTask.class, sourceSet, extension);
rewriteFixAll.configure(taskClosure(it -> it.dependsOn(rewriteFix)));

String rewriteDiscoverTaskName = "rewriteDiscover" + sourceSet.getName().substring(0, 1).toUpperCase() + sourceSet.getName().substring(1);
tasks.create(rewriteDiscoverTaskName, RewriteDiscoverTask.class, sourceSet, extension);
RewriteDiscoverTask discoverTask = tasks.create(rewriteDiscoverTaskName, RewriteDiscoverTask.class, sourceSet, extension);
rewriteDiscoverAll.dependsOn(discoverTask);

String compileTaskName = sourceSet.getCompileTaskName("java");
Task compileTask = tasks.getByName(compileTaskName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void run() {
" by:");
logVisitorsThatMadeChanges(change);
}
getLog().warn("Run 'mvn rewrite:fix' to apply the fixes. Afterwards, review and commit the changes.");
getLog().warn("Run 'gradle rewriteFix' to apply the fixes. Afterwards, review and commit the changes.");
}
}
}

0 comments on commit 22f85ca

Please sign in to comment.