Repository navigation
clean now runs after all SpotlessTask. Fixes #159. - #160
Conversation
b3caf72 to
9707b1c
Compare
| .matching(task -> task.getName().equals("clean")) | ||
| .all(task -> task.doLast(unused -> SpotlessCache.clear())); | ||
| .matching(task -> task instanceof SpotlessTask) | ||
| .all(task -> clean.mustRunAfter(task)); |
There was a problem hiding this comment.
@nedtwigg IIUC from what you said at #159 (comment), this line ought to be, .all(task -> task.mustRunAfter(clean)). Have I misunderstood something here?
There was a problem hiding this comment.
It's also unclear to me if clean.mustRunAfter(task) forces clean to run regardless of whether or not a user requested it on top of spotless{Apply,Check}.
In other words, do ./gradlew spotlessCheck and ./gradlew {clean} spotlessCheck {clean} do the same thing now?
There was a problem hiding this comment.
mustRunAfter is not the same as dependsOn
this line ought to be,
.all(task -> task.mustRunAfter(clean))
Good catch! When I wrote this code, I meant for the order to be spotless then clean, but that's silly. "Run the compiler, then clean the output". lol. I'll push a fix.
There was a problem hiding this comment.
mustRunAfteris not the same asdependsOn
Cool! Thanks for the clarification.
Good catch!
You're very welcome!
When I wrote this code, I meant for the order to be spotless then clean, but that's silly. "Run the compiler, then clean the output". lol. I'll push a fix.
haha, SGTM. :)
| .matching(task -> task.getName().equals("clean")) | ||
| .all(task -> task.doLast(unused -> SpotlessCache.clear())); | ||
| .matching(task -> task instanceof SpotlessTask) | ||
| .all(task -> task.mustRunAfter(clean)); |
There was a problem hiding this comment.
Gradle has a method (at least in the newer versions) that's something like:
project.getTasks().withType(SpotlessTask.class).all(task -> task.mustRunAfter(clean));|
Unless there are objections, I'm gonna merge in an hour, so that @JLLeitschuh can do an integration test on |
JLLeitschuh
left a comment
There was a problem hiding this comment.
Looks good to me. If you can add a test that would be good. But if not, this is fine as is.
|
I agree a test would be nice, but I couldn't figure a way to reliably repeat the race condition. |
No description provided.