Skip to content

Commit

Permalink
Good buildifier ws changes
Browse files Browse the repository at this point in the history
Pointed out in #100
(the other changes buildifier would propose are, I think, a net negative to readability)
  • Loading branch information
cpsauer committed Jan 13, 2023
1 parent 1266d6a commit adf45c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ refresh_compile_commands(
# Implementation:
# If you are looking into the implementation, start with the overview in ImplementationReadme.md.

exports_files(["refresh.template.py"]) # For implicit use by refresh_compile_commands.
exports_files(["refresh.template.py"]) # For implicit use by refresh_compile_commands.
4 changes: 2 additions & 2 deletions refresh_compile_commands.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def refresh_compile_commands(
# In Python, `type(x) == y` is an antipattern, but [Starlark doesn't support inheritance](https://bazel.build/rules/language), so `isinstance` doesn't exist, and this is the correct way to switch on type.
if not targets: # Default to all targets in main workspace
targets = {"@//...": ""}
elif type(targets) == "select": # Allow select: https://bazel.build/reference/be/functions#select
elif type(targets) == "select": # Allow select: https://bazel.build/reference/be/functions#select
# Pass select() to _expand_template to make it work
# see https://bazel.build/docs/configurable-attributes#faq-select-macro
pass
Expand Down Expand Up @@ -103,7 +103,7 @@ _expand_template = rule(
attrs = {
"labels_to_flags": attr.string_dict(mandatory = True), # string keys instead of label_keyed because Bazel doesn't support parsing wildcard target patterns (..., *, :all) in BUILD attributes.
"exclude_external_sources": attr.bool(default = False),
"exclude_headers": attr.string(values = ["all", "external", ""]), # "" needed only for compatibility with Bazel < 3.6.0
"exclude_headers": attr.string(values = ["all", "external", ""]), # "" needed only for compatibility with Bazel < 3.6.0
"_script_template": attr.label(allow_single_file = True, default = "refresh.template.py"),
# For Windows INCLUDE. If this were eliminated, for example by the resolution of https://github.com/clangd/clangd/issues/123, we'd be able to just use a macro and skylib's expand_template rule: https://github.com/bazelbuild/bazel-skylib/pull/330
# Once https://github.com/bazelbuild/bazel/pull/17108 is widely released, we should be able to eliminate this and get INCLUDE directly. Perhaps for 7.0? Should be released in the sucessor to 6.0
Expand Down

0 comments on commit adf45c4

Please sign in to comment.