Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 16, 2024
1 parent 3d19ef4 commit 12aebcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion refresh.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ def main():
There should be actionable warnings, above, that led to this.""")
sys.exit(1)


if not (root_dir := pathlib.Path({out_dir})).exists():
root_dir.mkdir(parents=True)

Expand Down
12 changes: 6 additions & 6 deletions refresh_compile_commands.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def refresh_compile_commands(
exclude_headers = None,
exclude_external_sources = False,
**kwargs): # For the other common attributes. Tags, compatible_with, etc. https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes.

# Given `targets` that may be absent, or be a single string target:
# targets = "//:some_target"
#
Expand All @@ -106,7 +106,7 @@ def refresh_compile_commands(
# "//:some_target": "--flag ...",
# "//:another_target": "--arg ..."
# }
#
#
# And given `target_groups` that may be absent, or have a group name associated with a string target or list of string targets:
# target_groups = {
# "host": "//:host_target",
Expand Down Expand Up @@ -141,7 +141,7 @@ def refresh_compile_commands(

target_group_targets_list = []
serialized_target_groups = {}

if target_groups:
# Convert the targets specified in `target_groups` into the format we'll use with `targets`, so we can combine them into one list of targets to generate compile commands for.
for targets_for_group in target_groups.values():
Expand All @@ -158,7 +158,7 @@ def refresh_compile_commands(
flags = ""

target_data = (_make_label_absolute(target_name), flags)

# Targets may appear in multiple groups. We don't want duplicates in the final list, but Starlark doesn't have Python's set class. So we de-duplicate manually.
if target_data not in target_group_targets_list:
target_group_targets_list.append(target_data)
Expand All @@ -173,9 +173,9 @@ def refresh_compile_commands(
serialized_targets.append("".join(target))
else:
serialized_targets.append(target)

serialized_target_groups[group] = serialized_targets

target_group_targets = {"{}{}".format(target, flags): [target, flags] for target, flags in target_group_targets_list}

# Convert the various, acceptable target shorthands into the dictionary format
Expand Down

0 comments on commit 12aebcf

Please sign in to comment.