Skip to content

Commit

Permalink
Investigation related to #1087.
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg committed Jan 12, 2022
1 parent c66f83e commit 72919ce
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ TaskProvider<RegisterDependenciesTask> findRegisterDepsTask() {
try {
return findRegisterDepsTask(RegisterDependenciesTask.TASK_NAME);
} catch (Exception e) {
System.out.println("~~~ FAILED TO REGISTER");
// in a composite build there can be multiple Spotless plugins on the classpath, and they will each try to register
// a task on the root project with the same name. That will generate casting errors, which we can catch and try again
// with an identity-specific identifier.
Expand All @@ -254,6 +255,7 @@ TaskProvider<RegisterDependenciesTask> findRegisterDepsTask() {
private TaskProvider<RegisterDependenciesTask> findRegisterDepsTask(String taskName) {
TaskContainer rootProjectTasks = project.getRootProject().getTasks();
if (!rootProjectTasks.getNames().contains(taskName)) {
System.out.println("~~~ REGISTER " + taskName);
return rootProjectTasks.register(taskName, RegisterDependenciesTask.class, RegisterDependenciesTask::setup);
} else {
return rootProjectTasks.named(taskName, RegisterDependenciesTask.class);
Expand Down

0 comments on commit 72919ce

Please sign in to comment.