From 396e26b4756f7fe8bb4e7bc4e338ccc620283998 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Mon, 26 Feb 2024 17:11:21 -0800 Subject: [PATCH] Enable C++ tests for Bazel 7 on mac PiperOrigin-RevId: 610573579 --- .bazelrc | 2 ++ .github/BUILD.bazel | 4 ++-- .github/workflows/test_cpp.yml | 11 +++++------ WORKSPACE | 8 ++++++++ ci/macOS.bazelrc | 1 + protobuf_deps.bzl | 11 +++++++++-- 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.bazelrc b/.bazelrc index b3467d87a5..65cc8c491e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -30,3 +30,5 @@ common --noenable_bzlmod # Important: this flag ensures that we remain compliant with the C++ layering # check. build --features=layering_check + +common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 diff --git a/.github/BUILD.bazel b/.github/BUILD.bazel index 3f37e2d32c..6d619f02ef 100644 --- a/.github/BUILD.bazel +++ b/.github/BUILD.bazel @@ -11,7 +11,7 @@ xcode_version( default_macos_sdk_version = "13.1", default_tvos_sdk_version = "16.1", default_watchos_sdk_version = "9.1", - version = "14.2.14C18", + version = "14.2.0.14C18", ) xcode_version( @@ -26,7 +26,7 @@ xcode_version( xcode_config( name = "host_xcodes", - default = ":version14_1_0_14B47b", + default = ":version14_2_14C18", versions = [ ":version14_2_14C18", ":version14_1_0_14B47b", diff --git a/.github/workflows/test_cpp.yml b/.github/workflows/test_cpp.yml index 91a3443126..94a0730c2a 100644 --- a/.github/workflows/test_cpp.yml +++ b/.github/workflows/test_cpp.yml @@ -320,12 +320,11 @@ jobs: os: macos-12 cache_key: macos-12 bazel: test //src/... //third_party/utf8_range/... - # TODO Enable these once mac setup is working for Bazel 7 - #- name: MacOS Bazel 7 - # os: macos-12 - # cache_key: macos-12-bazel7 - # bazel: test //src/... //third_party/utf8_range/... - # bazel_version: '7.0.0' + - name: MacOS Bazel 7 + os: macos-12 + cache_key: macos-12-bazel7 + bazel: test //src/... //third_party/utf8_range/... + bazel_version: '7.0.0' - name: MacOS Apple Silicon (build only) Bazel os: macos-12 cache_key: macos-12-arm diff --git a/WORKSPACE b/WORKSPACE index b7bc51cb72..e4ae60df0f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -82,6 +82,14 @@ load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependenci apple_rules_dependencies() +load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") + +apple_support_dependencies() + +load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies") + +rules_cc_dependencies() + # For `kt_jvm_library` load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") diff --git a/ci/macOS.bazelrc b/ci/macOS.bazelrc index d5dcf5de00..465bf0957f 100644 --- a/ci/macOS.bazelrc +++ b/ci/macOS.bazelrc @@ -1,3 +1,4 @@ import common.bazelrc build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 +common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl index 24c25fbda1..daa40e8e99 100644 --- a/protobuf_deps.bzl +++ b/protobuf_deps.bzl @@ -122,8 +122,15 @@ def protobuf_deps(): if not native.existing_rule("build_bazel_rules_apple"): http_archive( name = "build_bazel_rules_apple", - sha256 = "34c41bfb59cdaea29ac2df5a2fa79e5add609c71bb303b2ebb10985f93fa20e7", - url = "https://github.com/bazelbuild/rules_apple/releases/download/3.1.1/rules_apple.3.1.1.tar.gz", + sha256 = "9c4f1e1ec4fdfeac5bddb07fa0e872c398e3d8eb0ac596af9c463f9123ace292", + url = "https://github.com/bazelbuild/rules_apple/releases/download/3.2.1/rules_apple.3.2.1.tar.gz", + ) + + if not native.existing_rule("build_bazel_apple_support"): + http_archive( + name = "build_bazel_apple_support", + sha256 = "100d12617a84ebc7ee7a10ecf3b3e2fdadaebc167ad93a21f820a6cb60158ead", + url = "https://github.com/bazelbuild/apple_support/releases/download/1.12.0/apple_support.1.12.0.tar.gz", ) if not native.existing_rule("io_bazel_rules_kotlin"):