Bazel: Automatically fix lint errors with buildifier
In recent buildifier versions, lint errors can be fixed automatically:
$ find . \( -name BUILD -o -name "*.bzl" \) -print \
| xargs buildifier --lint=fix
This commit was created with Buildifier version 0.19.2:
$ buildifier --version
buildifier version: 0.19.2
buildifier scm revision: d39e4d5c25111527369142f16cdb49aa67707313
Change-Id: I1f06cd4596e794981ccc2d9fc2d1da9b17f3973a
diff --git a/tools/bzl/classpath.bzl b/tools/bzl/classpath.bzl
index afdd907..9ec5f15 100644
--- a/tools/bzl/classpath.bzl
+++ b/tools/bzl/classpath.bzl
@@ -7,8 +7,8 @@
elif hasattr(d, "files"):
all += d.files
- as_strs = [c.path for c in all]
- ctx.file_action(
+ as_strs = [c.path for c in all.to_list()]
+ ctx.actions.write(
output = ctx.outputs.runtime,
content = "\n".join(sorted(as_strs)),
)