diff --git a/refresh.template.py b/refresh.template.py index 90e5496..6ab9556 100644 --- a/refresh.template.py +++ b/refresh.template.py @@ -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) diff --git a/refresh_compile_commands.bzl b/refresh_compile_commands.bzl index ad5becf..4c9c3ec 100644 --- a/refresh_compile_commands.bzl +++ b/refresh_compile_commands.bzl @@ -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" # @@ -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", @@ -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(): @@ -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) @@ -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