[bazel] Bump the bazel version to fix a UI bug
See https://github.com/bazelbuild/bazel/issues/13985
Signed-off-by: Miguel Young de la Sota <mcyoung@google.com>
diff --git a/.bazelversion b/.bazelversion
index 6aba2b2..ac14c3d 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-4.2.0
+5.1.1
diff --git a/rules/bugfix.bzl b/rules/bugfix.bzl
deleted file mode 100644
index 1c2abd7..0000000
--- a/rules/bugfix.bzl
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright lowRISC contributors.
-# Licensed under the Apache License, Version 2.0, see LICENSE for details.
-# SPDX-License-Identifier: Apache-2.0
-
-def find_cc_toolchain(ctx):
- """
- Returns the current `CcToolchainInfo`.
-
- Args:
- ctx: The rule context for which to find a toolchain.
-
- Returns:
- A CcToolchainInfo.
- """
-
- # Check the incompatible flag for toolchain resolution.
- if hasattr(cc_common, "is_cc_toolchain_resolution_enabled_do_not_use") and cc_common.is_cc_toolchain_resolution_enabled_do_not_use(ctx = ctx):
- if "@rules_cc//cc:toolchain_type" in ctx.toolchains:
- return ctx.toolchains["@rules_cc//cc:toolchain_type"]
-
- # Fall back to the legacy implicit attribute lookup.
- elif hasattr(ctx.attr, "_cc_toolchain"):
- return ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]
-
- # We didn't find anything.
- fail("In order to use find_cc_toolchain, your rule has to depend on C++ toolchain. See find_cc_toolchain.bzl docs for details.")
diff --git a/rules/cc_side_outputs.bzl b/rules/cc_side_outputs.bzl
index 4512fb4..62016ec 100644
--- a/rules/cc_side_outputs.bzl
+++ b/rules/cc_side_outputs.bzl
@@ -5,7 +5,7 @@
"""Aspects and rules for making cc_* libraries emit more outputs."""
load("@rules_cc//cc:action_names.bzl", "ACTION_NAMES", "C_COMPILE_ACTION_NAME")
-load("//rules:bugfix.bzl", "find_cc_toolchain")
+load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")
load("//rules:rv.bzl", "rv_rule")
CcSideProductInfo = provider(fields = ["files"])
@@ -63,7 +63,7 @@
)
cc_compile_ctx = cc_info.compilation_context
- cc_toolchain = find_cc_toolchain(ctx)
+ cc_toolchain = find_cc_toolchain(ctx).cc
feature_configuration = cc_common.configure_features(
ctx = ctx,
cc_toolchain = cc_toolchain,
@@ -226,7 +226,7 @@
)
def _cc_llvm_aspect_impl(target, ctx):
- cc_toolchain = find_cc_toolchain(ctx)
+ cc_toolchain = find_cc_toolchain(ctx).cc
if cc_toolchain.compiler.find("clang") == -1:
return CcSideProductInfo(files = depset())
return _cc_compile_different_output("LLVMOutput", target, ctx, "ll", ["-S", "-emit-llvm"])
@@ -273,7 +273,7 @@
output_file = ctx.actions.declare_file(target.label.name + ".ldmap")
- cc_toolchain = find_cc_toolchain(ctx)
+ cc_toolchain = find_cc_toolchain(ctx).cc
feature_configuration = cc_common.configure_features(
ctx = ctx,
cc_toolchain = cc_toolchain,
diff --git a/rules/opentitan.bzl b/rules/opentitan.bzl
index 2f7ab85..a616ce9 100644
--- a/rules/opentitan.bzl
+++ b/rules/opentitan.bzl
@@ -2,9 +2,7 @@
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
-# TODO(drewmacrae) this should be in rules_cc
-# pending resolution of https://github.com/bazelbuild/rules_cc/issues/75
-load("//rules:bugfix.bzl", "find_cc_toolchain")
+load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")
load(
"//rules:cc_side_outputs.bzl",
"rv_asm",
@@ -43,7 +41,7 @@
}
def _obj_transform_impl(ctx):
- cc_toolchain = find_cc_toolchain(ctx)
+ cc_toolchain = find_cc_toolchain(ctx).cc
outputs = []
for src in ctx.files.srcs:
binary = ctx.actions.declare_file("{}.{}".format(src.basename, ctx.attr.suffix))
@@ -125,7 +123,7 @@
)
def _elf_to_disassembly_impl(ctx):
- cc_toolchain = find_cc_toolchain(ctx)
+ cc_toolchain = find_cc_toolchain(ctx).cc
outputs = []
for src in ctx.files.srcs:
disassembly = ctx.actions.declare_file("{}.elf.s".format(src.basename))
diff --git a/rules/otbn.bzl b/rules/otbn.bzl
index 3491b2a..72eea35 100644
--- a/rules/otbn.bzl
+++ b/rules/otbn.bzl
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
load("//rules:rv.bzl", "rv_rule")
-load("//rules:bugfix.bzl", "find_cc_toolchain")
+load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")
def _get_assembler(cc_toolchain):
"""Find the path to riscv-unknown-elf-as."""
@@ -20,7 +20,7 @@
producing a corresponding object file. Returns a list of all object files
that will be generated by these actions.
"""
- cc_toolchain = find_cc_toolchain(ctx)
+ cc_toolchain = find_cc_toolchain(ctx).cc
assembler = _get_assembler(cc_toolchain)
objs = []
@@ -77,7 +77,7 @@
We achieve by having `otbn_build.py` emit a conventional RV32I library
that other rules can depend on in their `deps`.
"""
- cc_toolchain = find_cc_toolchain(ctx)
+ cc_toolchain = find_cc_toolchain(ctx).cc
assembler = _get_assembler(cc_toolchain)
# Run the otbn assembler on source files to produce object (.o) files.