treewide: format repo with buildifier
Change-Id: Ia7aebeb7bba5b119c9157d1ad805cc477bcbb68a
Reviewed-on: https://review.monogon.dev/c/monogon/+/3774
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/metropolis/handbook/defs.bzl b/metropolis/handbook/defs.bzl
index ffd0b84..2ad44f3 100644
--- a/metropolis/handbook/defs.bzl
+++ b/metropolis/handbook/defs.bzl
@@ -21,7 +21,7 @@
# SUMMARY.md and the parent directory of that is the root.
summary = None
for f in ctx.files.srcs:
- if not f.path.endswith('/SUMMARY.md'):
+ if not f.path.endswith("/SUMMARY.md"):
continue
if summary != None:
fail("More then one SUMMARY.md provided.")
@@ -41,8 +41,8 @@
# Then we will need to prepend:
# ../../../../../../../
# To get back to execroot/.
- prepend = len(out_book_toml.path.split('/')) - 1
- src_dir_path = ('../' * prepend) + summary.dirname
+ prepend = len(out_book_toml.path.split("/")) - 1
+ src_dir_path = ("../" * prepend) + summary.dirname
# Generate book.toml.
# Bazel does not have a toml library. We abuse JSON encoding to get
@@ -58,27 +58,29 @@
]
ctx.actions.write(
output = out_book_toml,
- content = "\n".join(book_toml_contents)
+ content = "\n".join(book_toml_contents),
)
out_dir = ctx.actions.declare_directory(ctx.attr.name)
+
# We also have to prepend the out dir path, for the same reasons for which
# we prepend src_dir_path above.
- out_dir_path = ('../' * prepend) + out_dir.path
+ out_dir_path = ("../" * prepend) + out_dir.path
ctx.actions.run(
executable = ctx.executable._mdbook,
arguments = [
"build",
- "-d", out_dir_path,
+ "-d",
+ out_dir_path,
out_book_toml.dirname,
],
- inputs = ctx.files.srcs + [ out_book_toml ],
- outputs = [ out_dir ],
+ inputs = ctx.files.srcs + [out_book_toml],
+ outputs = [out_dir],
)
return [
DefaultInfo(
files = depset([out_dir]),
- )
+ ),
]
mdbook_html = rule(
@@ -100,11 +102,10 @@
allow_files = True,
doc = "The sources of the generated book. Exaclty one file must be named SUMMARY.md, and that file's location will be used to determine the root of the book sources.",
),
-
"_mdbook": attr.label(
doc = "The mdbook tool.",
executable = True,
- cfg = "host",
+ cfg = "exec",
default = "@crate_index//:mdbook__mdbook",
),
},