From ac8abb4a1b6f4ccc36e64bcbe06c9c5e8a701256 Mon Sep 17 00:00:00 2001 From: "The gemma.cpp Authors" Date: Wed, 13 May 2026 14:56:30 -0700 Subject: [PATCH] To support bazel the latest 9.1.0 PiperOrigin-RevId: 915074567 --- .bazelversion | 2 +- MODULE.bazel | 36 +++++++++++++++++++++++++----------- bazel/sentencepiece.bazel | 4 ++++ 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.bazelversion b/.bazelversion index 21c8c7b4..8b137891 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.1.1 + diff --git a/MODULE.bazel b/MODULE.bazel index 0dea7752..2ff3b9ec 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -4,24 +4,37 @@ module( ) bazel_dep(name = "abseil-cpp", version = "20250814.1") -bazel_dep(name = "bazel_skylib", version = "1.8.1") +bazel_dep(name = "bazel_skylib", version = "1.8.2") bazel_dep(name = "googletest", version = "1.17.0") bazel_dep(name = "highway", version = "1.1.0") +archive_override( + module_name = "highway", + urls = ["https://github.com/google/highway/archive/2a16a50ff61071bb25ddef0ce35d92b0e2b9c579.zip"], + strip_prefix = "highway-2a16a50ff61071bb25ddef0ce35d92b0e2b9c579", + patch_cmds = [ + "sed -i '1s/^/load(\\\"@rules_cc\\/\\/cc:defs.bzl\\\", \\\"cc_library\\\", \\\"cc_binary\\\", \\\"cc_test\\\")\\n/' BUILD", + "sed -i '1s/^/load(\\\"@rules_cc\\/\\/cc:defs.bzl\\\", \\\"cc_library\\\", \\\"cc_binary\\\", \\\"cc_test\\\")\\n/' hwy/contrib/sort/BUILD", + "sed -i 's/#define HWY_BROKEN_AVX10_2 0/#define HWY_BROKEN_AVX10_2 HWY_AVX10_2/g' hwy/detect_targets.h", + ], +) bazel_dep(name = "nlohmann_json", version = "3.11.3") -bazel_dep(name = "protobuf", version = "33.4") bazel_dep(name = "platforms", version = "1.0.0") -bazel_dep(name = "pybind11_bazel", version = "2.13.6") -bazel_dep(name = "rules_cc", version = "0.2.0") +bazel_dep(name = "pybind11_bazel", version = "2.12.0") +bazel_dep(name = "rules_cc", version = "0.2.17") bazel_dep(name = "rules_license", version = "1.0.0") -bazel_dep(name = "rules_python", version = "1.6.3") -bazel_dep(name = "google_benchmark", version = "1.8.5") +bazel_dep(name = "rules_python", version = "1.7.0") +bazel_dep(name = "google_benchmark", version = "1.9.1") +single_version_override( + module_name = "google_benchmark", + patches = ["//:google_benchmark.patch"], + patch_strip = 1, +) +bazel_dep(name = "rules_foreign_cc", version = "0.13.0") +bazel_dep(name = "rules_proto", version = "7.1.0") +bazel_dep(name = "protobuf", version = "29.3") # Require a more recent version. -git_override( - module_name = "highway", - commit = "c971dbe61bd2751923e3458666450bf95dfbbd98", - remote = "https://github.com/google/highway", -) +# Removed git_override to rely on bzlmod. http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") @@ -48,6 +61,7 @@ http_archive( http_archive( name = "darts_clone", build_file_content = """ +load("@rules_cc//cc:defs.bzl", "cc_library") licenses(["notice"]) exports_files(["LICENSE"]) package(default_visibility = ["//visibility:public"]) diff --git a/bazel/sentencepiece.bazel b/bazel/sentencepiece.bazel index ab728877..05c96b93 100644 --- a/bazel/sentencepiece.bazel +++ b/bazel/sentencepiece.bazel @@ -1,3 +1,7 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") +load("@protobuf//bazel:cc_proto_library.bzl", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") + package( default_visibility = ["//visibility:public"], features = [