From 3c0070fe36dfe226dd9e7a01518675ee8f28346a Mon Sep 17 00:00:00 2001 From: yuyawk <46620009+yuyawk@users.noreply.github.com> Date: Tue, 26 Nov 2024 21:42:59 +0900 Subject: [PATCH] Support Bazel 8.0.0rc4 (#87) Addressing https://github.com/bazelbuild/bazel-central-registry/issues/3260 --- .github/workflows/tests.yml | 2 ++ MODULE.bazel | 2 ++ lang/cc/build_error.bzl | 9 ++++----- platforms/BUILD.bazel | 0 platforms/os/BUILD.bazel | 14 ++++++++++++++ 5 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 platforms/BUILD.bazel create mode 100644 platforms/os/BUILD.bazel diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bf0babd..9f64672 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,6 +19,7 @@ jobs: bazel-version: - 6.x - 7.x + - 8.0.0rc4 runner: - ubuntu-20.04 - ubuntu-22.04 @@ -55,6 +56,7 @@ jobs: bazel-version: - 6.x - 7.x + - 8.0.0rc4 runner: - ubuntu-20.04 - ubuntu-22.04 diff --git a/MODULE.bazel b/MODULE.bazel index b361666..0d2cf3e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -6,6 +6,8 @@ module( version = "0.0.0", ) +bazel_dep(name = "platforms", version = "0.0.10") + ################################ # # Dev-dependencies diff --git a/lang/cc/build_error.bzl b/lang/cc/build_error.bzl index c8cee3e..6ca99e4 100644 --- a/lang/cc/build_error.bzl +++ b/lang/cc/build_error.bzl @@ -7,7 +7,6 @@ load( ) load( "@bazel_tools//tools/cpp:toolchain_utils.bzl", - "CPP_TOOLCHAIN_TYPE", "find_cpp_toolchain", ) load( @@ -449,7 +448,7 @@ _try_build = rule( ), }, fragments = ["cpp"], - toolchains = [CPP_TOOLCHAIN_TYPE], + toolchains = ["@bazel_tools//tools/cpp:toolchain_type"], provides = [CcBuildErrorInfo, DefaultInfo], ) @@ -603,9 +602,9 @@ def cc_build_error( name = try_build_target, tags = ["manual"] + tags, os = select({ - "@platforms//os:linux": "linux", - "@platforms//os:macos": "macos", - "@platforms//os:windows": "windows", + Label("//platforms/os:linux"): "linux", + Label("//platforms/os:macos"): "macos", + Label("//platforms/os:windows"): "windows", }), visibility = ["//visibility:private"], testonly = testonly, diff --git a/platforms/BUILD.bazel b/platforms/BUILD.bazel new file mode 100644 index 0000000..e69de29 diff --git a/platforms/os/BUILD.bazel b/platforms/os/BUILD.bazel new file mode 100644 index 0000000..152e700 --- /dev/null +++ b/platforms/os/BUILD.bazel @@ -0,0 +1,14 @@ +alias( + name = "linux", + actual = "@platforms//os:linux", +) + +alias( + name = "macos", + actual = "@platforms//os:macos", +) + +alias( + name = "windows", + actual = "@platforms//os:windows", +)