From 90f2d3476deabe45bb18c2419fa9084a3802739b Mon Sep 17 00:00:00 2001 From: Steffen Smolka Date: Mon, 22 Jun 2026 12:41:43 -0700 Subject: [PATCH] [NetKAT] Upgrade to abseil-cpp/20260526.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit abseil-cpp/20260526.0 has two BCR packaging issues that need local workarounds, plus it introduced breaking API changes that required upgrading the rest of the dependency stack. BCR issues fixed via a local registry (registry/): - Missing `compatibility_level = 1` in the BCR MODULE.bazel entry (field defaults to 0, causing Bazel's MVS to reject it). - Removed `absl/utility:if_constexpr` compat shim (added back via a source patch), still referenced by the protobuf 29 build graph. API breaking changes required upgrading the whole dep stack: - `absl::Nonnull` template alias removed (replaced by `absl_nonnull` attribute); fuzztest 20241028.0 used the old form → bump to 20260219.0. - `absl/random/bit_gen_ref.h` dropped its transitive include of `absl/random/internal/distribution_caller.h`; fuzztest 20260219.0's `fuzzing_bit_gen.h` relied on that → patch adds forward declarations. - gutil 20250502.0 pulled in grpc/googleapis, whose older protobuf usage was incompatible with the required protobuf upgrade → bump gutil to 20260309.0.bcr.1 (which dropped grpc and targets protobuf 33.5). Dep versions changed: abseil-cpp 20240722.0 -> 20260526.0 protobuf 29.0 -> 33.5 gutil 20250502.0 -> 20260309.0.bcr.1 re2 2024-07-02.bcr.1 -> 2025-11-05.bcr.1 googletest 1.15.2 -> 1.17.0.bcr.2 fuzztest 20241028.0 -> 20260219.0 benchmark 1.9.4 -> 1.9.5 All 17 tests pass. Co-Authored-By: Claude Sonnet 4.6 --- .bazelrc | 5 ++ MODULE.bazel | 25 ++++-- patches/BUILD.bazel | 1 + ...0219.0_abseil_random_internal_compat.patch | 22 ++++++ registry/bazel_registry.json | 1 + .../abseil-cpp/20260526.0/MODULE.bazel | 46 +++++++++++ .../patches/if_constexpr_compat.patch | 78 +++++++++++++++++++ .../modules/abseil-cpp/20260526.0/source.json | 9 +++ registry/modules/abseil-cpp/metadata.json | 9 +++ 9 files changed, 189 insertions(+), 7 deletions(-) create mode 100644 patches/BUILD.bazel create mode 100644 patches/fuzztest_20260219.0_abseil_random_internal_compat.patch create mode 100644 registry/bazel_registry.json create mode 100644 registry/modules/abseil-cpp/20260526.0/MODULE.bazel create mode 100644 registry/modules/abseil-cpp/20260526.0/patches/if_constexpr_compat.patch create mode 100644 registry/modules/abseil-cpp/20260526.0/source.json create mode 100644 registry/modules/abseil-cpp/metadata.json diff --git a/.bazelrc b/.bazelrc index 5c36303..654e631 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,3 +1,8 @@ +# Use our local registry first so the fixed abseil-cpp 20260526.0 entry +# (with compatibility_level = 1) takes precedence over the broken BCR entry. +common --registry=file://%workspace%/registry +common --registry=https://bcr.bazel.build + # Use C++ 20. build --cxxopt=-std=c++20 build --host_cxxopt=-std=c++20 diff --git a/MODULE.bazel b/MODULE.bazel index 2c751db..dcda4c6 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -21,13 +21,24 @@ module( compatibility_level = 1, ) -bazel_dep(name = "protobuf", version = "29.0", repo_name = "com_google_protobuf") -bazel_dep(name = "abseil-cpp", version = "20240722.0", repo_name = "com_google_absl") -bazel_dep(name = "gutil", version = "20250502.0", repo_name = "com_google_gutil") -bazel_dep(name = "re2", version = "2024-07-02.bcr.1", repo_name = "com_googlesource_code_re2") +bazel_dep(name = "protobuf", version = "33.5", repo_name = "com_google_protobuf") +bazel_dep(name = "abseil-cpp", version = "20260526.0", repo_name = "com_google_absl") +bazel_dep(name = "gutil", version = "20260309.0.bcr.1", repo_name = "com_google_gutil") +bazel_dep(name = "re2", version = "2025-11-05.bcr.1", repo_name = "com_googlesource_code_re2") # Dev Depdencies. bazel_dep(name = "rules_license", version = "1.0.0", dev_dependency = True) -bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True, repo_name = "com_google_googletest") -bazel_dep(name = "fuzztest", version = "20241028.0", dev_dependency = True, repo_name = "com_google_fuzztest") -bazel_dep(name = "google_benchmark", version = "1.9.4", dev_dependency = True, repo_name = "com_google_benchmark") +bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True, repo_name = "com_google_googletest") +bazel_dep(name = "fuzztest", version = "20260219.0", dev_dependency = True, repo_name = "com_google_fuzztest") +bazel_dep(name = "google_benchmark", version = "1.9.5", dev_dependency = True, repo_name = "com_google_benchmark") + +# fuzztest 20260219.0 relies on a transitive include of +# absl/random/internal/distribution_caller.h via absl/random/bit_gen_ref.h, +# which was removed in abseil 20260526.0 as a layering cleanup. Patch it to +# forward-declare those types directly so the friend declarations compile. +single_version_override( + module_name = "fuzztest", + patches = ["//patches:fuzztest_20260219.0_abseil_random_internal_compat.patch"], + patch_strip = 0, + version = "20260219.0", +) diff --git a/patches/BUILD.bazel b/patches/BUILD.bazel new file mode 100644 index 0000000..d518110 --- /dev/null +++ b/patches/BUILD.bazel @@ -0,0 +1 @@ +exports_files(glob(["*.patch"])) diff --git a/patches/fuzztest_20260219.0_abseil_random_internal_compat.patch b/patches/fuzztest_20260219.0_abseil_random_internal_compat.patch new file mode 100644 index 0000000..e61c3f6 --- /dev/null +++ b/patches/fuzztest_20260219.0_abseil_random_internal_compat.patch @@ -0,0 +1,22 @@ +diff --git fuzztest/fuzzing_bit_gen.h fuzztest/fuzzing_bit_gen.h +--- fuzztest/fuzzing_bit_gen.h ++++ fuzztest/fuzzing_bit_gen.h +@@ -24,6 +24,18 @@ + #include "absl/random/bit_gen_ref.h" + #include "absl/types/span.h" + ++ ++// Forward-declare internal abseil types used for friend access below. ++// These were transitively declared via absl/random/bit_gen_ref.h in abseil ++// versions before 20260526.0, but that transitive exposure was removed. ++namespace absl { ++namespace random_internal { ++template ++struct DistributionCaller; ++class MockHelpers; ++} // namespace random_internal ++} // namespace absl ++ + namespace fuzztest { + + /// FuzzingBitGen is a BitGen instance which uses the Abseil mock mechanisms diff --git a/registry/bazel_registry.json b/registry/bazel_registry.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/registry/bazel_registry.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/registry/modules/abseil-cpp/20260526.0/MODULE.bazel b/registry/modules/abseil-cpp/20260526.0/MODULE.bazel new file mode 100644 index 0000000..155c7c5 --- /dev/null +++ b/registry/modules/abseil-cpp/20260526.0/MODULE.bazel @@ -0,0 +1,46 @@ +# Copyright 2024 The Abseil Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# https://bazel.build/external/overview#bzlmod + +module( + name = "abseil-cpp", + version = "20260526.0", + # compatibility_level = 1 is required for interop with other modules that + # depend on earlier abseil-cpp versions. The BCR entry for 20260526.0 + # accidentally omits this field (defaulting to 0), causing a conflict. + compatibility_level = 1, +) + +cc_configure = use_extension("@rules_cc//cc:extensions.bzl", + "cc_configure_extension", + dev_dependency = True) +use_repo(cc_configure, "local_config_cc") + +bazel_dep(name = "rules_cc", version = "0.2.18") +bazel_dep(name = "bazel_skylib", version = "1.9.0") +bazel_dep(name = "platforms", version = "1.1.0") + +bazel_dep( + name = "google_benchmark", + version = "1.9.5", + dev_dependency = True, +) + +# Note: Googletest is NOT a dev_dependency. Some Abseil test utilities +# intended to be used by Abseil users depend on GoogleTest. +bazel_dep( + name = "googletest", + version = "1.17.0.bcr.2", +) diff --git a/registry/modules/abseil-cpp/20260526.0/patches/if_constexpr_compat.patch b/registry/modules/abseil-cpp/20260526.0/patches/if_constexpr_compat.patch new file mode 100644 index 0000000..f0626df --- /dev/null +++ b/registry/modules/abseil-cpp/20260526.0/patches/if_constexpr_compat.patch @@ -0,0 +1,78 @@ +diff --git absl/utility/BUILD.bazel absl/utility/BUILD.bazel +--- absl/utility/BUILD.bazel ++++ absl/utility/BUILD.bazel +@@ -45,3 +45,16 @@ + "//absl/meta:type_traits", + ], + ) ++ ++# Compatibility shim: removed in 20260526.0 but still referenced by protobuf 29. ++cc_library( ++ name = "if_constexpr", ++ hdrs = [ ++ "internal/if_constexpr.h", ++ ], ++ copts = ABSL_DEFAULT_COPTS, ++ linkopts = ABSL_DEFAULT_LINKOPTS, ++ deps = [ ++ "//absl/base:config", ++ ], ++) +diff --git absl/utility/internal/if_constexpr.h absl/utility/internal/if_constexpr.h +new file mode 100644 +--- /dev/null ++++ absl/utility/internal/if_constexpr.h +@@ -0,0 +1,53 @@ ++// Copyright 2023 The Abseil Authors ++// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// https://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++// Compatibility shim: this header was present in abseil through 20250512 but ++// removed in 20260526. protobuf 29 still references the if_constexpr target. ++// This header provides IfConstexpr/IfConstexprElse for pre-C++17 code; ++// in C++17+ you can use `if constexpr` directly. ++ ++#ifndef ABSL_UTILITY_INTERNAL_IF_CONSTEXPR_H_ ++#define ABSL_UTILITY_INTERNAL_IF_CONSTEXPR_H_ ++ ++#include ++#include ++ ++#include "absl/base/config.h" ++ ++namespace absl { ++ABSL_NAMESPACE_BEGIN ++ ++namespace utility_internal { ++ ++template ++auto IfConstexprElse(TrueFunc&& true_func, FalseFunc&& false_func, ++ Args&&... args) { ++ return std::get(std::forward_as_tuple( ++ std::forward(false_func), std::forward(true_func)))( ++ std::forward(args)...); ++} ++ ++template ++void IfConstexpr(Func&& func, Args&&... args) { ++ IfConstexprElse(std::forward(func), [](auto&&...){}, ++ std::forward(args)...); ++} ++ ++} // namespace utility_internal ++ ++ABSL_NAMESPACE_END ++} // namespace absl ++ ++#endif // ABSL_UTILITY_INTERNAL_IF_CONSTEXPR_H_ diff --git a/registry/modules/abseil-cpp/20260526.0/source.json b/registry/modules/abseil-cpp/20260526.0/source.json new file mode 100644 index 0000000..7a7ac10 --- /dev/null +++ b/registry/modules/abseil-cpp/20260526.0/source.json @@ -0,0 +1,9 @@ +{ + "url": "https://github.com/abseil/abseil-cpp/releases/download/20260526.0/abseil-cpp-20260526.0.tar.gz", + "strip_prefix": "abseil-cpp-20260526.0", + "integrity": "sha256-bhruU1RzQUFkv4Pk68QCQN7HGkcB+KZC2QbpW+oa6gw=", + "patch_strip": 0, + "patches": { + "if_constexpr_compat.patch": "sha256-0F/pU9I+SsPUag7fYcoHKod/ZZolm7ahFlZyNbktiMc=" + } +} \ No newline at end of file diff --git a/registry/modules/abseil-cpp/metadata.json b/registry/modules/abseil-cpp/metadata.json new file mode 100644 index 0000000..7890de5 --- /dev/null +++ b/registry/modules/abseil-cpp/metadata.json @@ -0,0 +1,9 @@ +{ + "homepage": "https://abseil.io", + "maintainers": [], + "repository": ["github:abseil/abseil-cpp"], + "versions": [ + "20260526.0" + ], + "yanked_versions": {} +} \ No newline at end of file