spotless icon indicating copy to clipboard operation
spotless copied to clipboard

[Feature] dependencies task for locks

Open caleb-cushing0-kr opened this issue 2 years ago • 2 comments

In lieu of a solution to https://github.com/gradle/gradle/issues/19081 which references my ticket... could we get a task that is just for dependencies? maybe spotlessDependencies then I could simply add it to my root dependencies task. I admit to this being a workaround, but I don't like running spotlessApply --write-locks running the formatter or a check seems bad.

caleb-cushing0-kr avatar Dec 07 '23 18:12 caleb-cushing0-kr

PR's welcome! Pseudocode for what would work:

List<Integer> hashCodes = new ArrayList<>();
for (FormatterStep step : steps) {
    hashCodes.add(step.hashCode()); // calculating hashcode forces the dependencies to resolve
}

You can grab all the formatter steps which matter here

https://github.com/diffplug/spotless/blob/3fce3142fc38e3985fd90d1f47629b0168b8e0c3/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/FormatExtension.java#L1072

nedtwigg avatar Dec 07 '23 23:12 nedtwigg

sub personal account (for searching)

xenoterracide avatar Jan 23 '24 18:01 xenoterracide