improve spotless error to suggest running 'gradlew tidy' (#817)

The current error isn't helpful as it suggests a per-module command. If
the user has modified multiple modules, they will be running gradle
commands to try to fix each one of them, when it would be easier to just
run 'gradlew tidy' a single time and fix everything.
This commit is contained in:
Robert Muir 2022-04-21 08:30:10 -04:00 committed by GitHub
parent 844bd88839
commit d6461eab0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -111,3 +111,9 @@ configure(project(":lucene").subprojects) { prj ->
v.dependsOn ":checkJdkInternalsExportedToGradle"
}
}
gradle.taskGraph.afterTask { Task task, TaskState state ->
if (task.name == 'spotlessJavaCheck' && state.failure) {
throw new GradleException("\n****************************\n*PLEASE RUN ./gradlew tidy!*\n****************************");
}
}