diff --git a/refresh.template.py b/refresh.template.py index 0185053..abd28a6 100644 --- a/refresh.template.py +++ b/refresh.template.py @@ -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() @@ -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)