MODULE.bazel 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. """Bazel modules.
  5. `MODULE.bazel.lock` may change locally when `bazel` is executed. This means one
  6. of:
  7. 1. An input is changing, typically `MODULE.bazel` or `.bazelversion`.
  8. - Running `bazel mod deps` provides a canonical update to
  9. `MODULE.bazel.lock`; include the changes.
  10. - GitHub test actions may also identify platform-specific lockfile
  11. updates.
  12. 2. The host platform hasn't yet been added to the lock file.
  13. - Platforms tested with GitHub actions are kept up-to-date. Other
  14. platforms may fall out of sync due to `bazel` or dependency changes,
  15. and should be updated with a PR the same way a platform is added.
  16. - Running `bazel mod deps` provides a canonical update to
  17. `MODULE.bazel.lock`; create a PR with those changes in order to include
  18. the host platform.
  19. For updates, run `scripts/query_module_versions.py` to list the latest package
  20. versions.
  21. """
  22. module(name = "carbon")
  23. bazel_dep(name = "abseil-cpp", version = "20260107.1")
  24. bazel_dep(name = "bazel_skylib", version = "1.9.0")
  25. bazel_dep(name = "boost.unordered", version = "1.90.0.bcr.1")
  26. bazel_dep(name = "google_benchmark", version = "1.9.5")
  27. bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
  28. bazel_dep(name = "libpfm", version = "4.13.0")
  29. bazel_dep(name = "re2", version = "2025-11-05.bcr.1")
  30. bazel_dep(name = "rules_cc", version = "0.2.17")
  31. bazel_dep(name = "rules_pkg", version = "1.2.0")
  32. bazel_dep(name = "rules_shell", version = "0.6.1")
  33. bazel_dep(name = "tcmalloc", version = "0.0.0-20250927-12f2552")
  34. bazel_dep(name = "tree-sitter-bazel", version = "0.26.5")
  35. bazel_dep(name = "wolfd_bazel_compile_commands", version = "0.5.2", dev_dependency = True)
  36. git_override(
  37. module_name = "wolfd_bazel_compile_commands",
  38. # This is https://github.com/wolfd/bazel-compile-commands/pull/3 which is
  39. # needed to correctly select target configurations in our compile commands.
  40. commit = "7c673ac868cd237f262bb37a7819b1a279566a66",
  41. remote = "https://github.com/chandlerc/bazel-compile-commands.git",
  42. )
  43. bazel_dep(name = "bazel_clang_tidy", dev_dependency = True)
  44. git_override(
  45. module_name = "bazel_clang_tidy",
  46. # HEAD as of 2026-01-28.
  47. commit = "c4d35e0d0b838309358e57a2efed831780f85cd0",
  48. remote = "https://github.com/erenon/bazel_clang_tidy.git",
  49. )
  50. bazel_cc_toolchain = use_extension(
  51. "//bazel/cc_toolchains:clang_configuration.bzl",
  52. "clang_toolchain_extension",
  53. )
  54. use_repo(bazel_cc_toolchain, "bazel_cc_toolchain")
  55. register_toolchains("@bazel_cc_toolchain//:all")
  56. register_toolchains("//toolchain/install:all")
  57. # Required for llvm-project.
  58. bazel_dep(name = "platforms", version = "1.0.0")
  59. bazel_dep(name = "protobuf", version = "34.0.bcr.1", repo_name = "com_google_protobuf")
  60. bazel_dep(name = "zlib-ng", version = "2.0.7", repo_name = "llvm_zlib")
  61. bazel_dep(name = "zstd", version = "1.5.7.bcr.1", repo_name = "llvm_zstd")
  62. ###############################################################################
  63. # llvm-project
  64. ###############################################################################
  65. # Load a repository for the raw llvm-project, pre-overlay.
  66. bazel_dep(name = "llvm-raw")
  67. git_override(
  68. module_name = "llvm-raw",
  69. build_file_content = "# empty",
  70. # We pin to specific upstream commits and try to track top-of-tree
  71. # reasonably closely rather than pinning to a specific release.
  72. # HEAD as of 2026-04-01.
  73. commit = "b71eacea7687f68c11299e3bda5654fbbaa1e20e",
  74. patch_cmds = ["echo \"module(name='llvm-raw')\" > MODULE.bazel"],
  75. patch_strip = 1,
  76. patches = [
  77. "//bazel/llvm_project:0001_Patch_for_mallinfo2_when_using_Bazel_build_system.patch",
  78. "//bazel/llvm_project:0002_Added_Bazel_build_for_compiler_rt_fuzzer.patch",
  79. "//bazel/llvm_project:0004_Introduce_basic_sources_exporting_for_libunwind.patch",
  80. "//bazel/llvm_project:0005_Introduce_basic_sources_exporting_for_libcxx_and_libcxxabi.patch",
  81. "//bazel/llvm_project:0009_Introduce_starlark_exporting_compiler-rt_build_information.patch",
  82. ],
  83. remote = "https://github.com/llvm/llvm-project.git",
  84. )
  85. # Apply the overlay to produce llvm-project.
  86. llvm_project = use_extension(
  87. "//bazel/llvm_project:llvm_project.bzl",
  88. "llvm_project",
  89. )
  90. use_repo(llvm_project, "llvm-project")
  91. ###############################################################################
  92. # Python
  93. ###############################################################################
  94. bazel_dep(name = "rules_python", version = "1.9.0")
  95. python = use_extension("@rules_python//python/extensions:python.bzl", "python")
  96. python.toolchain(
  97. python_version = "3.11",
  98. )
  99. use_repo(python, "python_versions")
  100. ###############################################################################
  101. # Bazel integration testing
  102. ###############################################################################
  103. bazel_dep(
  104. name = "rules_bazel_integration_test",
  105. version = "0.37.1",
  106. dev_dependency = True,
  107. )
  108. # We test against our current Bazel version, the latest release, and the latest
  109. # release candidate.
  110. bazel_binaries = use_extension(
  111. "@rules_bazel_integration_test//:extensions.bzl",
  112. "bazel_binaries",
  113. dev_dependency = True,
  114. )
  115. bazel_binaries.download(version_file = "//:.bazelversion")
  116. bazel_binaries.download(version = "latest")
  117. bazel_binaries.download(version = "last_rc")
  118. use_repo(
  119. bazel_binaries,
  120. "bazel_binaries",
  121. "bazel_binaries_bazelisk",
  122. "build_bazel_bazel_.bazelversion",
  123. "build_bazel_bazel_last_rc",
  124. "build_bazel_bazel_latest",
  125. )