MODULE.bazel 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. If `MODULE.bazel.lock` changes locally, it means the host platform hasn't yet
  6. been added to the lock file. Running `bazel mod deps` provides a canonical
  7. update to `MODULE.bazel.lock`; create a PR with those changes in order to
  8. include the host platform.
  9. Platforms tested with GitHub actions are kept up-to-date. Other platforms may
  10. fall out of sync on dependency changes, and should be updated with a PR the same
  11. way a platform is added.
  12. """
  13. module(name = "carbon")
  14. http_archive = use_repo_rule(
  15. "@bazel_tools//tools/build_defs/repo:http.bzl",
  16. "http_archive",
  17. )
  18. bazel_dep(name = "bazel_skylib", version = "1.7.1")
  19. bazel_dep(name = "rules_pkg", version = "0.10.1")
  20. bazel_dep(name = "abseil-cpp", version = "20240116.2")
  21. bazel_dep(name = "re2", version = "2024-06-01")
  22. bazel_dep(name = "googletest", version = "1.14.0.bcr.1")
  23. bazel_dep(name = "google_benchmark", version = "1.8.4")
  24. # The registry only has an old version. We use that here to avoid a miss but
  25. # override it with a newer version.
  26. bazel_dep(name = "libpfm", version = "4.11.0")
  27. libpfm_version = "4.13.0"
  28. archive_override(
  29. module_name = "libpfm",
  30. integrity = "sha256-0YuXdkx1VSjBBR03bjNUXQ62DG6/hWgENoE/pbBMw9E=",
  31. patch_strip = 1,
  32. patches = ["@//bazel/libpfm:0001-Introduce-a-simple-native-Bazel-build.patch"],
  33. strip_prefix = "libpfm-{0}".format(libpfm_version),
  34. urls = ["https://sourceforge.net/projects/perfmon2/files/libpfm4/libpfm-{0}.tar.gz".format(libpfm_version)],
  35. )
  36. bazel_dep(name = "rules_bison", version = "0.2.2")
  37. bazel_dep(name = "rules_flex", version = "0.2.1")
  38. bazel_dep(name = "rules_m4", version = "0.2.3")
  39. bazel_dep(name = "rules_cc", version = "0.0.9")
  40. bazel_dep(name = "rules_proto", version = "6.0.2")
  41. bazel_dep(name = "protobuf", version = "27.1")
  42. libprotobuf_mutator_version = "1.3"
  43. http_archive(
  44. name = "com_google_libprotobuf_mutator",
  45. build_file = "@//:third_party/libprotobuf_mutator/BUILD.txt",
  46. sha256 = "1ee3473a6b0274494fce599539605bb19305c0efadc62b58d645812132c31baa",
  47. strip_prefix = "libprotobuf-mutator-{0}".format(libprotobuf_mutator_version),
  48. urls = ["https://github.com/google/libprotobuf-mutator/archive/v{0}.tar.gz".format(libprotobuf_mutator_version)],
  49. )
  50. bazel_dep(name = "bazel_clang_tidy", dev_dependency = True)
  51. git_override(
  52. module_name = "bazel_clang_tidy",
  53. # HEAD as of 2024-03-12.
  54. commit = "bff5c59c843221b05ef0e37cef089ecc9d24e7da",
  55. remote = "https://github.com/erenon/bazel_clang_tidy.git",
  56. )
  57. bazel_cc_toolchain = use_extension(
  58. "//bazel/cc_toolchains:clang_configuration.bzl",
  59. "clang_toolchain_extension",
  60. )
  61. use_repo(bazel_cc_toolchain, "bazel_cc_toolchain")
  62. register_toolchains("@bazel_cc_toolchain//:all")
  63. bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
  64. git_override(
  65. module_name = "hedron_compile_commands",
  66. # HEAD as of 2024-03-12.
  67. commit = "204aa593e002cbd177d30f11f54cff3559110bb9",
  68. remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
  69. )
  70. boost_unordered_version = "1.85.0"
  71. http_archive(
  72. name = "boost_unordered",
  73. build_file = "@//:third_party/boost_unordered/BUILD.bazel",
  74. integrity = "sha256-2dQ4IQH/xFiK1iWCkrMYLeR8zsSQqGchKOdTuf1u0zI=",
  75. strip_prefix = "boost_unordered-{0}".format(boost_unordered_version),
  76. urls = ["https://github.com/MikePopoloski/boost_unordered/archive/v{0}.tar.gz".format(boost_unordered_version)],
  77. )
  78. # Required for llvm-project.
  79. bazel_dep(name = "platforms", version = "0.0.10")
  80. bazel_dep(name = "zlib", version = "1.3.1.bcr.1", repo_name = "llvm_zlib")
  81. bazel_dep(name = "zstd", version = "1.5.6", repo_name = "llvm_zstd")
  82. ###############################################################################
  83. # llvm-project
  84. ###############################################################################
  85. # We pin to specific upstream commits and try to track top-of-tree reasonably
  86. # closely rather than pinning to a specific release.
  87. # HEAD as of 2024-06-20.
  88. llvm_project_version = "80f881485accb020345ee7e1c4c3151ec55ce590"
  89. # Load a repository for the raw llvm-project, pre-overlay.
  90. http_archive(
  91. name = "llvm-raw",
  92. build_file_content = "# empty",
  93. patch_args = ["-p1"],
  94. patches = [
  95. "@carbon//bazel/llvm_project:0001_Patch_for_mallinfo2_when_using_Bazel_build_system.patch",
  96. "@carbon//bazel/llvm_project:0002_Added_Bazel_build_for_compiler_rt_fuzzer.patch",
  97. ],
  98. sha256 = "3216d56b308d420170d6284d04560175b56fd56065a7442f32b732c606e77367",
  99. strip_prefix = "llvm-project-{0}".format(llvm_project_version),
  100. urls = ["https://github.com/llvm/llvm-project/archive/{0}.tar.gz".format(llvm_project_version)],
  101. )
  102. # Apply the overlay to produce llvm-project.
  103. llvm_project = use_extension(
  104. "//bazel/llvm_project:llvm_project.bzl",
  105. "llvm_project",
  106. )
  107. use_repo(llvm_project, "llvm-project")
  108. ###############################################################################
  109. # Python
  110. ###############################################################################
  111. bazel_dep(name = "rules_python", version = "0.33.1")
  112. python = use_extension("@rules_python//python/extensions:python.bzl", "python")
  113. python.toolchain(
  114. python_version = "3.11",
  115. )
  116. use_repo(python, "python_versions")