mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-10 12:28:25 +00:00
Newer versions of `protobuf` depend on Rust to a limited extent. Builds don't use it, and _our_ builds rarely even touch on `protobuf`. But the way CI was running `bazel mod` commands in `action.yml` forced fully evaluating all the module extensions, including Rust. This ends up both hitting end points we didn't allow and being really expensive. We can skip that and keep the more targeted `cquery` that doesn't do anything beyond what our builds need. We also still have a test that the lock file is accurate, so we don't lose any coverage here, it just makes things faster. That said, we _do_ want to be able to hit the Rust dependency if and where we (transitively) need it, and we'll at least need our `prek` checks to be able to resolve them and rebuilding the lock file after an update, so the relevant end points are added to our hardened runner as allowed. The second issue is that `rules_python` in version 2.0 and newer is using a Bazel feature we disable. There is an escape hatch though that we can enable in our `.bazelrc` so it keeps working, and that works even with the current version. Once this lands, the Dependabot update of the Bazel module versions should be able to make more progress. Assisted-by: Antigravity with Claude Opus
155 lines
6.0 KiB
Python
155 lines
6.0 KiB
Python
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
# Exceptions. See /LICENSE for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
"""Bazel modules.
|
|
|
|
`MODULE.bazel.lock` may change locally when `bazel` is executed. This means one
|
|
of:
|
|
|
|
1. An input is changing, typically `MODULE.bazel` or `.bazelversion`.
|
|
- Running `bazel mod deps` provides a canonical update to
|
|
`MODULE.bazel.lock`; include the changes.
|
|
- GitHub test actions may also identify platform-specific lockfile
|
|
updates.
|
|
2. The host platform hasn't yet been added to the lock file.
|
|
- Platforms tested with GitHub actions are kept up-to-date. Other
|
|
platforms may fall out of sync due to `bazel` or dependency changes,
|
|
and should be updated with a PR the same way a platform is added.
|
|
- Running `bazel mod deps` provides a canonical update to
|
|
`MODULE.bazel.lock`; create a PR with those changes in order to include
|
|
the host platform.
|
|
|
|
`bazel mod deps` evaluates every module extension, but reuses results recorded
|
|
in `MODULE.bazel.lock`. Re-evaluating some extensions can be expensive; for
|
|
example, the Rust crates newer protobuf versions depend on require downloading
|
|
a Rust toolchain.
|
|
|
|
For updates, run `scripts/query_module_versions.py` to list the latest package
|
|
versions.
|
|
"""
|
|
|
|
module(name = "carbon")
|
|
|
|
bazel_dep(name = "abseil-cpp", version = "20260107.1")
|
|
bazel_dep(name = "bazel_skylib", version = "1.9.0")
|
|
bazel_dep(name = "boost.unordered", version = "1.90.0.bcr.1")
|
|
bazel_dep(name = "google_benchmark", version = "1.9.5")
|
|
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
|
|
bazel_dep(name = "libpfm", version = "4.13.0")
|
|
bazel_dep(name = "re2", version = "2025-11-05.bcr.1")
|
|
bazel_dep(name = "rules_cc", version = "0.2.25")
|
|
bazel_dep(name = "rules_pkg", version = "1.2.0")
|
|
bazel_dep(name = "rules_shell", version = "0.8.0")
|
|
bazel_dep(name = "tcmalloc", version = "0.0.0-20250927-12f2552")
|
|
bazel_dep(name = "tree-sitter-bazel", version = "0.26.5")
|
|
|
|
bazel_dep(name = "wolfd_bazel_compile_commands", version = "0.5.2", dev_dependency = True)
|
|
git_override(
|
|
module_name = "wolfd_bazel_compile_commands",
|
|
# This is https://github.com/wolfd/bazel-compile-commands/pull/3 which is
|
|
# needed to correctly select target configurations in our compile commands.
|
|
commit = "7c673ac868cd237f262bb37a7819b1a279566a66",
|
|
remote = "https://github.com/chandlerc/bazel-compile-commands.git",
|
|
)
|
|
|
|
bazel_dep(name = "bazel_clang_tidy", dev_dependency = True)
|
|
git_override(
|
|
module_name = "bazel_clang_tidy",
|
|
# HEAD as of 2026-01-28.
|
|
commit = "c4d35e0d0b838309358e57a2efed831780f85cd0",
|
|
remote = "https://github.com/erenon/bazel_clang_tidy.git",
|
|
)
|
|
|
|
bazel_cc_toolchain = use_extension(
|
|
"//bazel/cc_toolchains:clang_configuration.bzl",
|
|
"clang_toolchain_extension",
|
|
)
|
|
use_repo(bazel_cc_toolchain, "bazel_cc_toolchain")
|
|
|
|
register_toolchains("@bazel_cc_toolchain//:all")
|
|
|
|
register_toolchains("//toolchain/install:all")
|
|
|
|
# Required for llvm-project.
|
|
bazel_dep(name = "libxml2", version = "2.15.2")
|
|
bazel_dep(name = "platforms", version = "1.0.0")
|
|
bazel_dep(name = "protobuf", version = "34.0.bcr.1", repo_name = "com_google_protobuf")
|
|
bazel_dep(name = "zlib-ng", version = "2.3.3", repo_name = "llvm_zlib")
|
|
bazel_dep(name = "zstd", version = "1.5.7.bcr.1", repo_name = "llvm_zstd")
|
|
bazel_dep(name = "xz", version = "5.4.5.bcr.9", repo_name = "llvm_xz")
|
|
|
|
###############################################################################
|
|
# llvm-project
|
|
###############################################################################
|
|
|
|
# Load a repository for the raw llvm-project, pre-overlay.
|
|
bazel_dep(name = "llvm-raw")
|
|
git_override(
|
|
module_name = "llvm-raw",
|
|
build_file_content = "# empty",
|
|
# We pin to specific upstream commits and try to track top-of-tree
|
|
# reasonably closely rather than pinning to a specific release.
|
|
# HEAD as of 2026-10-08.
|
|
commit = "b08e005995ed29a2f89aa9a3f599a9d45db65523",
|
|
patch_cmds = ["echo \"module(name='llvm-raw')\" > MODULE.bazel"],
|
|
patch_strip = 1,
|
|
patches = [
|
|
"//bazel/llvm_project:0001_Patch_for_mallinfo2_when_using_Bazel_build_system.patch",
|
|
"//bazel/llvm_project:0002_Added_Bazel_build_for_compiler_rt_fuzzer.patch",
|
|
"//bazel/llvm_project:0004_Introduce_basic_sources_exporting_for_libunwind.patch",
|
|
"//bazel/llvm_project:0005_Introduce_basic_sources_exporting_for_libcxx_and_libcxxabi.patch",
|
|
"//bazel/llvm_project:0006_Add_more_libc_math_excludes.patch",
|
|
"//bazel/llvm_project:0012_Drop_dependencies_on_linux_uapi_and_pyyaml.patch",
|
|
],
|
|
remote = "https://github.com/llvm/llvm-project.git",
|
|
)
|
|
|
|
# Apply the overlay to produce llvm-project.
|
|
llvm_project = use_extension(
|
|
"//bazel/llvm_project:llvm_project.bzl",
|
|
"llvm_project",
|
|
)
|
|
use_repo(llvm_project, "llvm-project")
|
|
|
|
###############################################################################
|
|
# Python
|
|
###############################################################################
|
|
|
|
bazel_dep(name = "rules_python", version = "1.9.0")
|
|
|
|
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
|
|
python.toolchain(
|
|
python_version = "3.12",
|
|
)
|
|
use_repo(python, "python_versions")
|
|
|
|
###############################################################################
|
|
# Bazel integration testing
|
|
###############################################################################
|
|
|
|
bazel_dep(
|
|
name = "rules_bazel_integration_test",
|
|
version = "0.37.1",
|
|
dev_dependency = True,
|
|
)
|
|
|
|
# We test against our current Bazel version, the latest release, and the latest
|
|
# release candidate.
|
|
bazel_binaries = use_extension(
|
|
"@rules_bazel_integration_test//:extensions.bzl",
|
|
"bazel_binaries",
|
|
dev_dependency = True,
|
|
)
|
|
bazel_binaries.download(version_file = "//:.bazelversion")
|
|
bazel_binaries.download(version = "latest")
|
|
bazel_binaries.download(version = "last_rc")
|
|
use_repo(
|
|
bazel_binaries,
|
|
"bazel_binaries",
|
|
"bazel_binaries_bazelisk",
|
|
"build_bazel_bazel_.bazelversion",
|
|
"build_bazel_bazel_last_rc",
|
|
"build_bazel_bazel_latest",
|
|
)
|