Skip to content

Commit 0fc9036

Browse files
committed
Add warnings that buf must be the first step.
1 parent 0943a81 commit 0fc9036

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

plugin-gradle/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ black().pathToExe('C:/myuser/.pyenv/versions/3.8.0/scripts/black.exe')
524524
525525
`com.diffplug.gradle.spotless.ProtobufExtension` [javadoc](https://javadoc.io/doc/com.diffplug.spotless/spotless-plugin-gradle/6.19.0/com/diffplug/gradle/spotless/ProtobufExtension.html), [code](https://github.com/diffplug/spotless/blob/main/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/ProtobufExtension.java)
526526
527+
**WARNING** this step **must** be the first step in the chain, steps before it will be ignored. Thumbs up [this issue](https://github.com/bufbuild/buf/issues/1035) for a resolution, see [here](https://github.com/diffplug/spotless/pull/1208#discussion_r1264439669) for more details on the problem.
528+
527529
```gradle
528530
spotless {
529531
protobuf {

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/ProtobufExtension.java

+3
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public class BufFormatExtension {
6666

6767
BufFormatExtension(String version) {
6868
this.step = BufStep.withVersion(version);
69+
if (!steps.isEmpty()) {
70+
throw new IllegalArgumentException("buf() must be the first step, move other steps after it. Thumbs up [this issue](https://github.com/bufbuild/buf/issues/1035) for a resolution, see [here](https://github.com/diffplug/spotless/pull/1208#discussion_r1264439669) for more details on the problem.");
71+
}
6972
addStep(createStep());
7073
}
7174

0 commit comments

Comments
 (0)