Skip to content

Commit

Permalink
Ensure precommit runs as part of check (#59476)
Browse files Browse the repository at this point in the history
Precommit is setup to run as a dependency of the check task, but
unfortunately this wiring was only happening when the java plugin (but
not java-base plugin) was applied. This commit moves the wiring to occur
whenever the check task exists, which is with the lifecycle-base plugin.
  • Loading branch information
rjernst committed Jul 17, 2020
1 parent 514b2f3 commit e963918
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ public void apply(Project project) {
t.setDescription("Runs all non-test checks");
});

project.getPluginManager().withPlugin("java", p -> {
project.getTasks().named(LifecycleBasePlugin.CHECK_TASK_NAME).configure(t -> t.dependsOn(precommit));
project.getTasks().withType(Test.class).configureEach(t -> t.mustRunAfter(precommit));
});
project.getPluginManager()
.withPlugin(
"lifecycle-base",
p -> project.getTasks().named(LifecycleBasePlugin.CHECK_TASK_NAME).configure(t -> t.dependsOn(precommit))
);
project.getPluginManager()
.withPlugin("java", p -> project.getTasks().withType(Test.class).configureEach(t -> t.mustRunAfter(precommit)));
}
}
}

0 comments on commit e963918

Please sign in to comment.