Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
allow specification of path to exe
  • Loading branch information
andrewparmet committed May 13, 2022
commit 5b16ed1324116bd46f3364d8c5ccca4fce5b6703
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ public LicenseHeaderConfig licenseHeaderFile(Object licenseHeaderFile) {
return licenseHeaderFile(licenseHeaderFile, LICENSE_HEADER_DELIMITER);
}

/** If the user hasn't specified files, assume all protobuf files should be checked. */
@Override
protected void setupTask(SpotlessTask task) {
if (target == null) {
target = parseTarget("**/*.proto");
}
super.setupTask(task);
}

/** Adds the specified version of <a href="https://buf.build/">buf</a>. */
public BufFormatExtension buf(String version) {
Objects.requireNonNull(version);
Expand All @@ -53,24 +62,21 @@ public BufFormatExtension buf() {
}

public class BufFormatExtension {
private final String version;
BufStep step;

BufFormatExtension(String version) {
this.version = version;
this.step = BufStep.withVersion(version);
addStep(createStep());
}

private FormatterStep createStep() {
return BufStep.withVersion(version).create();
public BufFormatExtension pathToExe(String pathToExe) {
step = step.withPathToExe(pathToExe);
replaceStep(createStep());
return this;
}
}

/** If the user hasn't specified files, assume all protobuf files should be checked. */
@Override
protected void setupTask(SpotlessTask task) {
if (target == null) {
target = parseTarget("**/*.proto");
private FormatterStep createStep() {
return step.create();
}
super.setupTask(task);
}
}