From 65e700a7b6475a74156eb7c36b009e61a2d8b28c Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 1 Nov 2022 16:53:15 -0700 Subject: [PATCH] Fix buildifier --- crosstool/cc_toolchain_config.bzl | 50 +++---------------------------- crosstool/osx_cc_configure.bzl | 10 +++---- 2 files changed, 9 insertions(+), 51 deletions(-) diff --git a/crosstool/cc_toolchain_config.bzl b/crosstool/cc_toolchain_config.bzl index 1a21d5e..3843929 100644 --- a/crosstool/cc_toolchain_config.bzl +++ b/crosstool/cc_toolchain_config.bzl @@ -39,8 +39,7 @@ def _compare_versions(dv1, v2): return dv1.compare_to(apple_common.dotted_version(v2)) def _can_use_deterministic_libtool(ctx): - """Returns `True` if the current version of `libtool` has support for - deterministic mode, and `False` otherwise.""" + """Returns `True` if the current version of `libtool` has support for deterministic mode, and `False` otherwise.""" xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig] xcode_version = xcode_config.xcode_version() if _compare_versions(xcode_version, _SUPPORTS_DETERMINISTIC_MODE) >= 0: @@ -49,8 +48,7 @@ def _can_use_deterministic_libtool(ctx): return False def _deterministic_libtool_flags(ctx): - """Returns additional `libtool` flags to enable deterministic mode, if they - are available.""" + """Returns additional `libtool` flags to enable deterministic mode, if they are available.""" if _can_use_deterministic_libtool(ctx): return ["-D"] return [] @@ -117,48 +115,6 @@ def _impl(ctx): if ctx.attr.cpu in ["ios_sim_arm64", "tvos_sim_arm64", "watchos_arm64"]: arch = "arm64" - all_compile_actions = [ - ACTION_NAMES.c_compile, - ACTION_NAMES.cpp_compile, - ACTION_NAMES.linkstamp_compile, - ACTION_NAMES.assemble, - ACTION_NAMES.preprocess_assemble, - ACTION_NAMES.cpp_header_parsing, - ACTION_NAMES.cpp_module_compile, - ACTION_NAMES.cpp_module_codegen, - ACTION_NAMES.clif_match, - ACTION_NAMES.lto_backend, - ] - - all_cpp_compile_actions = [ - ACTION_NAMES.cpp_compile, - ACTION_NAMES.linkstamp_compile, - ACTION_NAMES.cpp_header_parsing, - ACTION_NAMES.cpp_module_compile, - ACTION_NAMES.cpp_module_codegen, - ACTION_NAMES.clif_match, - ] - - preprocessor_compile_actions = [ - ACTION_NAMES.c_compile, - ACTION_NAMES.cpp_compile, - ACTION_NAMES.linkstamp_compile, - ACTION_NAMES.preprocess_assemble, - ACTION_NAMES.cpp_header_parsing, - ACTION_NAMES.cpp_module_compile, - ACTION_NAMES.clif_match, - ] - - codegen_compile_actions = [ - ACTION_NAMES.c_compile, - ACTION_NAMES.cpp_compile, - ACTION_NAMES.linkstamp_compile, - ACTION_NAMES.assemble, - ACTION_NAMES.preprocess_assemble, - ACTION_NAMES.cpp_module_codegen, - ACTION_NAMES.lto_backend, - ] - all_link_actions = [ ACTION_NAMES.cpp_link_executable, ACTION_NAMES.cpp_link_dynamic_library, @@ -2765,6 +2721,7 @@ def _impl(ctx): ubsan_feature, default_sanitizer_flags_feature, archive_param_file_feature, + supports_pic_feature, ] elif (ctx.attr.cpu == "darwin_x86_64" or ctx.attr.cpu == "darwin_arm64" or @@ -2847,6 +2804,7 @@ def _impl(ctx): ubsan_feature, default_sanitizer_flags_feature, archive_param_file_feature, + supports_pic_feature, ] else: fail("Unreachable") diff --git a/crosstool/osx_cc_configure.bzl b/crosstool/osx_cc_configure.bzl index f40a04e..67dc120 100644 --- a/crosstool/osx_cc_configure.bzl +++ b/crosstool/osx_cc_configure.bzl @@ -25,12 +25,11 @@ load( "get_env", ) -def _get_escaped_xcode_cxx_inc_directories(repository_ctx, cc, xcode_toolchains): +def _get_escaped_xcode_cxx_inc_directories(repository_ctx, xcode_toolchains): """Compute the list of default C++ include paths on Xcode-enabled darwin. Args: repository_ctx: The repository context. - cc: The default C++ compiler on the local system. xcode_toolchains: A list containing the xcode toolchains available Returns: include_paths: A list of builtin include paths. @@ -139,6 +138,9 @@ def configure_osx_toolchain(repository_ctx): Args: repository_ctx: The repository context. + + Returns: + Whether or not configuration was successful """ paths = resolve_labels(repository_ctx, [ "@bazel_tools//tools/cpp:armeabi_cc_toolchain_config.bzl", @@ -172,8 +174,6 @@ def configure_osx_toolchain(repository_ctx): # cc_wrapper.sh script. The wrapped_clang binary is already hardcoded # into the Objective-C crosstool actions, anyway, so this ensures that # the C++ actions behave consistently. - cc = repository_ctx.path("wrapped_clang") - cc_path = '"$(/usr/bin/dirname "$0")"/wrapped_clang' repository_ctx.template( "cc_wrapper.sh", @@ -220,7 +220,7 @@ def configure_osx_toolchain(repository_ctx): gcov_path = repository_ctx.which(gcov_path) tool_paths["gcov"] = gcov_path - escaped_include_paths = _get_escaped_xcode_cxx_inc_directories(repository_ctx, cc, xcode_toolchains) + escaped_include_paths = _get_escaped_xcode_cxx_inc_directories(repository_ctx, xcode_toolchains) escaped_cxx_include_directories = [] for path in escaped_include_paths: escaped_cxx_include_directories.append((" \"%s\"," % path))