Skip to content

Commit

Permalink
https://github.com/hedronvision/bazel-compile-commands-extractor/pull…
Browse files Browse the repository at this point in the history
…/89#discussion_r1037776844

refresh.template.py: using endwith api
  • Loading branch information
xinzhengzhang committed Dec 3, 2022
1 parent 4fbd4a3 commit dac489a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions refresh.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,7 @@ def _apple_platform_patch(compile_args: typing.List[str], environmentVariables =
# Bazel wraps the compiler as `external/local_config_cc/wrapped_clang` and exports that wrapped compiler in the proto. However, we need a clang call that clangd can introspect. (See notes in "how clangd uses compile_commands.json" in ImplementationReadme.md for more.)
# Removing the wrapper is also important because Bazel's Xcode (but not CommandLineTools) wrapper crashes if you don't specify particular environment variables (replaced below). We'd need the wrapper to be invokable by clangd's --query-driver if we didn't remove the wrapper.
# Bazel wrapps the swiftc as `external/build_bazel_rules_swift/tools/worker/worker swiftc ` and worker has been removed in apple_swift_patch

if compile_args[0][-6:] == "swiftc":
if compile_args[0].endswith('swiftc'):
compile_args[0] = _get_apple_active_swiftc()
else:
compile_args[0] = _get_apple_active_clang()
Expand Down Expand Up @@ -817,7 +816,7 @@ def _get_swift_command_for_files(compile_action):
compile_action.arguments = _apple_platform_patch(compile_action.arguments, compile_action.environmentVariables)

# Source files is end with `.swift`
source_files = set(filter(lambda x: x[-6:] == ".swift", compile_action.arguments))
source_files = set(filter(lambda arg: arg.endswith('.swift'), compile_action.arguments))

for source_file in source_files:
_warn_if_file_doesnt_exist(source_file)
Expand Down

0 comments on commit dac489a

Please sign in to comment.