Skip to content

Commit d785abb

Browse files
committed
https://github.com/hedronvision/bazel-compile-commands-extractor/pull/89#discussion_r1037776844
refresh.template.py: using endwith api
1 parent eec7394 commit d785abb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

refresh.template.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,7 @@ def _apple_platform_patch(compile_args: typing.List[str], environmentVariables =
748748
# 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.)
749749
# 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.
750750
# Bazel wrapps the swiftc as `external/build_bazel_rules_swift/tools/worker/worker swiftc ` and worker has been removed in apple_swift_patch
751-
752-
if compile_args[0][-6:] == "swiftc":
751+
if compile_args[0].endswith('swiftc'):
753752
compile_args[0] = _get_apple_active_swiftc()
754753
else:
755754
compile_args[0] = _get_apple_active_clang()
@@ -830,7 +829,7 @@ def _get_swift_command_for_files(compile_action):
830829
compile_action.arguments = _apple_platform_patch(compile_action.arguments, compile_action.environmentVariables)
831830

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

835834
for source_file in source_files:
836835
_warn_if_file_doesnt_exist(source_file)

0 commit comments

Comments
 (0)