From 76e06438e93156e89578bc639fbf97cc034d62d8 Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Tue, 12 Oct 2021 01:17:24 -0500 Subject: [PATCH] Update bazel version to 4.x (#9763) * Update to bazel 4.0.0 * bazel 4.2.1 * Regenerate crosstool configs * restore manual tags * restore manual tags --- .bazelversion | 2 +- tools/cross-toolchain/configs/.latest.bazelrc | 14 +++++++------- .../clang/{bazel_3.7.0 => bazel_4.2.1}/cc/BUILD | 1 + .../cc/armeabi_cc_toolchain_config.bzl | 0 .../cc/builtin_include_directory_paths | 0 .../cc/cc_toolchain_config.bzl | 15 +++++++++++++++ .../{bazel_3.7.0 => bazel_4.2.1}/cc/cc_wrapper.sh | 0 .../cc/module.modulemap | 0 .../{bazel_3.7.0 => bazel_4.2.1}/config/BUILD | 2 +- .../clang/{bazel_3.7.0 => bazel_4.2.1}/java/BUILD | 0 .../prysm_toolchains/BUILD.bazel | 0 .../prysm_toolchains/WORKSPACE | 0 .../cc_toolchain_config_linux_arm64.bzl | 0 .../prysm_toolchains/cc_toolchain_config_osx.bzl | 0 .../cc_toolchain_config_windows.bzl | 0 tools/cross-toolchain/configs/versions.bzl | 2 +- 16 files changed, 26 insertions(+), 10 deletions(-) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/cc/BUILD (99%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/cc/armeabi_cc_toolchain_config.bzl (100%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/cc/builtin_include_directory_paths (100%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/cc/cc_toolchain_config.bzl (99%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/cc/cc_wrapper.sh (100%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/cc/module.modulemap (100%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/config/BUILD (94%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/java/BUILD (100%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/prysm_toolchains/BUILD.bazel (100%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/prysm_toolchains/WORKSPACE (100%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/prysm_toolchains/cc_toolchain_config_linux_arm64.bzl (100%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/prysm_toolchains/cc_toolchain_config_osx.bzl (100%) rename tools/cross-toolchain/configs/clang/{bazel_3.7.0 => bazel_4.2.1}/prysm_toolchains/cc_toolchain_config_windows.bzl (100%) diff --git a/.bazelversion b/.bazelversion index 7c69a55db..fae6e3d04 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -3.7.0 +4.2.1 diff --git a/tools/cross-toolchain/configs/.latest.bazelrc b/tools/cross-toolchain/configs/.latest.bazelrc index 37da2b3c9..7cc88c9df 100644 --- a/tools/cross-toolchain/configs/.latest.bazelrc +++ b/tools/cross-toolchain/configs/.latest.bazelrc @@ -19,13 +19,13 @@ # Specifically, it includes all toolchain/platform flags # This file is used for testing purposes. -build:remote --host_javabase=//tools/cross-toolchain/configs/clang/bazel_3.7.0/java:jdk -build:remote --javabase=//tools/cross-toolchain/configs/clang/bazel_3.7.0/java:jdk -build:remote --crosstool_top=//tools/cross-toolchain/configs/clang/bazel_3.7.0/cc:toolchain -build:remote --extra_toolchains=//tools/cross-toolchain/configs/clang/bazel_3.7.0/config:cc-toolchain -build:remote --extra_execution_platforms=//tools/cross-toolchain/configs/clang/bazel_3.7.0/config:platform -build:remote --host_platform=//tools/cross-toolchain/configs/clang/bazel_3.7.0/config:platform -build:remote --platforms=//tools/cross-toolchain/configs/clang/bazel_3.7.0/config:platform +build:remote --host_javabase=//tools/cross-toolchain/configs/clang/bazel_4.2.1/java:jdk +build:remote --javabase=//tools/cross-toolchain/configs/clang/bazel_4.2.1/java:jdk +build:remote --crosstool_top=//tools/cross-toolchain/configs/clang/bazel_4.2.1/cc:toolchain +build:remote --extra_toolchains=//tools/cross-toolchain/configs/clang/bazel_4.2.1/config:cc-toolchain +build:remote --extra_execution_platforms=//tools/cross-toolchain/configs/clang/bazel_4.2.1/config:platform +build:remote --host_platform=//tools/cross-toolchain/configs/clang/bazel_4.2.1/config:platform +build:remote --platforms=//tools/cross-toolchain/configs/clang/bazel_4.2.1/config:platform # Import the default bazelrc file in bazel-toolchains repo. # This will only work for tests executed from bazel-toolchains diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/BUILD b/tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/BUILD similarity index 99% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/BUILD rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/BUILD index 3fb72a67b..718caba4d 100755 --- a/tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/BUILD +++ b/tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/BUILD @@ -137,6 +137,7 @@ cc_toolchain_config( tool_paths = { "ar": "/usr/bin/ar", "ld": "/usr/bin/ld", + "llvm-cov": "/usr/bin/llvm-cov", "cpp": "/usr/bin/cpp", "gcc": "/usr/bin/clang", "dwp": "/usr/bin/dwp", diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/armeabi_cc_toolchain_config.bzl b/tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/armeabi_cc_toolchain_config.bzl similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/armeabi_cc_toolchain_config.bzl rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/armeabi_cc_toolchain_config.bzl diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/builtin_include_directory_paths b/tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/builtin_include_directory_paths similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/builtin_include_directory_paths rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/builtin_include_directory_paths diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/cc_toolchain_config.bzl b/tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/cc_toolchain_config.bzl similarity index 99% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/cc_toolchain_config.bzl rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/cc_toolchain_config.bzl index 6fca87a72..5dbaa86ab 100755 --- a/tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/cc_toolchain_config.bzl +++ b/tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/cc_toolchain_config.bzl @@ -16,10 +16,12 @@ load( "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", + "action_config", "feature", "feature_set", "flag_group", "flag_set", + "tool", "tool_path", "variable_with_value", "with_feature_set", @@ -147,6 +149,17 @@ def _impl(ctx): ] action_configs = [] + llvm_cov_action = action_config( + action_name = ACTION_NAMES.llvm_cov, + tools = [ + tool( + path = ctx.attr.tool_paths["llvm-cov"], + ), + ], + ) + + action_configs.append(llvm_cov_action) + supports_pic_feature = feature( name = "supports_pic", enabled = True, @@ -1226,6 +1239,7 @@ def _impl(ctx): abi_version = ctx.attr.abi_version, abi_libc_version = ctx.attr.abi_libc_version, tool_paths = tool_paths, + builtin_sysroot = ctx.attr.builtin_sysroot, ) cc_toolchain_config = rule( @@ -1252,6 +1266,7 @@ cc_toolchain_config = rule( "coverage_compile_flags": attr.string_list(), "coverage_link_flags": attr.string_list(), "supports_start_end_lib": attr.bool(), + "builtin_sysroot": attr.string(), }, provides = [CcToolchainConfigInfo], ) diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/cc_wrapper.sh b/tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/cc_wrapper.sh similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/cc_wrapper.sh rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/cc_wrapper.sh diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/module.modulemap b/tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/module.modulemap similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/cc/module.modulemap rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/cc/module.modulemap diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/config/BUILD b/tools/cross-toolchain/configs/clang/bazel_4.2.1/config/BUILD similarity index 94% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/config/BUILD rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/config/BUILD index 7c4ea8844..593c5e88f 100644 --- a/tools/cross-toolchain/configs/clang/bazel_3.7.0/config/BUILD +++ b/tools/cross-toolchain/configs/clang/bazel_4.2.1/config/BUILD @@ -29,7 +29,7 @@ toolchain( "@bazel_tools//platforms:linux", "@bazel_tools//platforms:x86_64", ], - toolchain = "//tools/cross-toolchain/configs/clang/bazel_3.7.0/cc:cc-compiler-k8", + toolchain = "//tools/cross-toolchain/configs/clang/bazel_4.2.1/cc:cc-compiler-k8", toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", ) diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/java/BUILD b/tools/cross-toolchain/configs/clang/bazel_4.2.1/java/BUILD similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/java/BUILD rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/java/BUILD diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/BUILD.bazel b/tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/BUILD.bazel similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/BUILD.bazel rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/BUILD.bazel diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/WORKSPACE b/tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/WORKSPACE similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/WORKSPACE rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/WORKSPACE diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/cc_toolchain_config_linux_arm64.bzl b/tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/cc_toolchain_config_linux_arm64.bzl similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/cc_toolchain_config_linux_arm64.bzl rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/cc_toolchain_config_linux_arm64.bzl diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/cc_toolchain_config_osx.bzl b/tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/cc_toolchain_config_osx.bzl similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/cc_toolchain_config_osx.bzl rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/cc_toolchain_config_osx.bzl diff --git a/tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/cc_toolchain_config_windows.bzl b/tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/cc_toolchain_config_windows.bzl similarity index 100% rename from tools/cross-toolchain/configs/clang/bazel_3.7.0/prysm_toolchains/cc_toolchain_config_windows.bzl rename to tools/cross-toolchain/configs/clang/bazel_4.2.1/prysm_toolchains/cc_toolchain_config_windows.bzl diff --git a/tools/cross-toolchain/configs/versions.bzl b/tools/cross-toolchain/configs/versions.bzl index ca71c4fc9..af8267994 100644 --- a/tools/cross-toolchain/configs/versions.bzl +++ b/tools/cross-toolchain/configs/versions.bzl @@ -3,7 +3,7 @@ """Definitions to be used in rbe_repo attr of an rbe_autoconf rule """ toolchain_config_spec0 = struct(config_repos = ["prysm_toolchains"], create_cc_configs = True, create_java_configs = True, env = {"BAZEL_COMPILER": "clang", "BAZEL_LINKLIBS": "-l%:libstdc++.a", "BAZEL_LINKOPTS": "-lm:-static-libgcc", "BAZEL_USE_LLVM_NATIVE_COVERAGE": "1", "GCOV": "llvm-profdata", "CC": "clang", "CXX": "clang++"}, java_home = "/usr/lib/jvm/java-8-openjdk-amd64", name = "clang") _TOOLCHAIN_CONFIG_SPECS = [toolchain_config_spec0] -_BAZEL_TO_CONFIG_SPEC_NAMES = {"3.7.0": ["clang"]} +_BAZEL_TO_CONFIG_SPEC_NAMES = {"4.2.1": ["clang"]} LATEST = "sha256:bd40e9a43b983c8b06079d14a0530100d6e1d59796616ca1d8b3902a197c97b1" CONTAINER_TO_CONFIG_SPEC_NAMES = {"sha256:bd40e9a43b983c8b06079d14a0530100d6e1d59796616ca1d8b3902a197c97b1": ["clang"]} _DEFAULT_TOOLCHAIN_CONFIG_SPEC = toolchain_config_spec0