Skip to content

Commit dac489a

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

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
@@ -735,8 +735,7 @@ def _apple_platform_patch(compile_args: typing.List[str], environmentVariables =
735735
# 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.)
736736
# 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.
737737
# Bazel wrapps the swiftc as `external/build_bazel_rules_swift/tools/worker/worker swiftc ` and worker has been removed in apple_swift_patch
738-
739-
if compile_args[0][-6:] == "swiftc":
738+
if compile_args[0].endswith('swiftc'):
740739
compile_args[0] = _get_apple_active_swiftc()
741740
else:
742741
compile_args[0] = _get_apple_active_clang()
@@ -817,7 +816,7 @@ def _get_swift_command_for_files(compile_action):
817816
compile_action.arguments = _apple_platform_patch(compile_action.arguments, compile_action.environmentVariables)
818817

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

822821
for source_file in source_files:
823822
_warn_if_file_doesnt_exist(source_file)

0 commit comments

Comments
 (0)