WORKSPACE 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. workspace(name = "carbon")
  5. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
  6. ###############################################################################
  7. # Python rules
  8. ###############################################################################
  9. rules_python_version = "0.3.0"
  10. # Add Bazel's python rules and set up pip.
  11. http_archive(
  12. name = "rules_python",
  13. sha256 = "934c9ceb552e84577b0faf1e5a2f0450314985b4d8712b2b70717dc679fdc01b",
  14. url = "https://github.com/bazelbuild/rules_python/releases/download/%s/rules_python-%s.tar.gz" % (
  15. rules_python_version,
  16. rules_python_version,
  17. ),
  18. )
  19. load("@rules_python//python:pip.bzl", "pip_install")
  20. # Create a central repo that knows about the pip dependencies.
  21. pip_install(
  22. name = "py_deps",
  23. requirements = "//github_tools:requirements.txt",
  24. )
  25. ###############################################################################
  26. # Python mypy rules
  27. ###############################################################################
  28. # NOTE: https://github.com/bazelbuild/bazel/issues/4948 tracks bazel supporting
  29. # typing directly. If it's added, we will probably want to switch.
  30. # Add mypy
  31. mypy_integration_version = "e5f8071f33eca637cd90bf70cb45f749e63bf2ca"
  32. # TODO: Can switch back to the official repo when it includes:
  33. # https://github.com/thundergolfer/bazel-mypy-integration/pull/43
  34. #http_archive(
  35. # name = "mypy_integration",
  36. # sha256 = "621df076709dc72809add1f5fe187b213fee5f9b92e39eb33851ab13487bd67d",
  37. # strip_prefix = "bazel-mypy-integration-%s" % mypy_integration_version,
  38. # urls = [
  39. # "https://github.com/thundergolfer/bazel-mypy-integration/archive/refs/tags/%s.tar.gz" % mypy_integration_version,
  40. # ],
  41. #)
  42. http_archive(
  43. name = "mypy_integration",
  44. sha256 = "481ec6f0953a84a36b8103286f04c4cd274ae689060099085c02ac187d007592",
  45. strip_prefix = "bazel-mypy-integration-%s" % mypy_integration_version,
  46. urls = [
  47. "https://github.com/jonmeow/bazel-mypy-integration/archive/%s.zip" % mypy_integration_version,
  48. ],
  49. )
  50. load(
  51. "@mypy_integration//repositories:repositories.bzl",
  52. mypy_integration_repositories = "repositories",
  53. )
  54. mypy_integration_repositories()
  55. load("@mypy_integration//:config.bzl", "mypy_configuration")
  56. mypy_configuration("//bazel/mypy:mypy.ini")
  57. load("@mypy_integration//repositories:deps.bzl", mypy_integration_deps = "deps")
  58. mypy_integration_deps(
  59. mypy_requirements_file = "//bazel/mypy:version.txt",
  60. )
  61. ###############################################################################
  62. # C++ rules
  63. ###############################################################################
  64. # Configure the bootstrapped Clang and LLVM toolchain for Bazel.
  65. load(
  66. "//bazel/cc_toolchains:clang_configuration.bzl",
  67. "configure_clang_toolchain",
  68. )
  69. configure_clang_toolchain(name = "bazel_cc_toolchain")
  70. ###############################################################################
  71. # Abseil libraries
  72. ###############################################################################
  73. abseil_version = "4a995b1eaa4a602f0d3a9ff8eac89d4649cd2fe8"
  74. http_archive(
  75. name = "com_google_absl",
  76. sha256 = "f5021900ff9a6b8f39406d15f460714660ab6b3e727754663d786d75ecad5ee0",
  77. strip_prefix = "abseil-cpp-%s" % abseil_version,
  78. urls = ["https://github.com/abseil/abseil-cpp/archive/%s.zip" % abseil_version],
  79. )
  80. ###############################################################################
  81. # GoogleTest libraries
  82. ###############################################################################
  83. googletest_version = "075810f7a20405ea09a93f68847d6e963212fa62"
  84. http_archive(
  85. name = "com_google_googletest",
  86. sha256 = "19949c33e795197dbb8610672c18bff447dc31faef3257665d69d1bf0884d67b",
  87. strip_prefix = "googletest-%s" % googletest_version,
  88. urls = ["https://github.com/google/googletest/archive/%s.zip" % googletest_version],
  89. )
  90. ###############################################################################
  91. # Google Benchmark libraries
  92. ###############################################################################
  93. benchmark_version = "0baacde3618ca617da95375e0af13ce1baadea47"
  94. http_archive(
  95. name = "com_github_google_benchmark",
  96. sha256 = "62e2f2e6d8a744d67e4bbc212fcfd06647080de4253c97ad5c6749e09faf2cb0",
  97. strip_prefix = "benchmark-%s" % benchmark_version,
  98. urls = ["https://github.com/google/benchmark/archive/%s.zip" % benchmark_version],
  99. )
  100. ###############################################################################
  101. # LLVM libraries
  102. ###############################################################################
  103. new_local_repository(
  104. name = "llvm-raw",
  105. build_file_content = "# empty",
  106. path = "third_party/llvm-project",
  107. )
  108. load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
  109. llvm_configure(
  110. name = "llvm-project",
  111. targets = [
  112. "AArch64",
  113. "X86",
  114. ],
  115. )
  116. load("@llvm-raw//utils/bazel:terminfo.bzl", "llvm_terminfo_system")
  117. # We require successful detection and use of a system terminfo library.
  118. llvm_terminfo_system(name = "llvm_terminfo")
  119. load("@llvm-raw//utils/bazel:zlib.bzl", "llvm_zlib_system")
  120. # We require successful detection and use of a system zlib library.
  121. llvm_zlib_system(name = "llvm_zlib")
  122. ###############################################################################
  123. # Flex/Bison rules
  124. ###############################################################################
  125. # TODO: Can switch to a normal release version when it includes:
  126. # https://github.com/jmillikin/rules_m4/commit/b504241407916d1d6d72c66a766daacf9603cf8b
  127. rules_m4_version = "b504241407916d1d6d72c66a766daacf9603cf8b"
  128. http_archive(
  129. name = "rules_m4",
  130. sha256 = "e6003c5f45746a2ad01335a8526044591f2b6c5c68852cee1bcd28adc2cf452b",
  131. strip_prefix = "rules_m4-%s" % rules_m4_version,
  132. urls = ["https://github.com/jmillikin/rules_m4/archive/%s.zip" %
  133. rules_m4_version],
  134. )
  135. load("@rules_m4//m4:m4.bzl", "m4_register_toolchains")
  136. # When building M4, disable all compiler warnings as we can't realistically fix
  137. # them anyways.
  138. m4_register_toolchains(extra_copts = ["-w"])
  139. # TODO: Can switch to a normal release version when it includes:
  140. # https://github.com/jmillikin/rules_flex/commit/1f1d9c306c2b4b8be2cb899a3364b84302124e77
  141. rules_flex_version = "1f1d9c306c2b4b8be2cb899a3364b84302124e77"
  142. http_archive(
  143. name = "rules_flex",
  144. sha256 = "ad1c3a1a9bdd6254df857f84f3ab4c052df6e21ce4af5d32710f2feff2abf4dd",
  145. strip_prefix = "rules_flex-%s" % rules_flex_version,
  146. urls = ["https://github.com/jmillikin/rules_flex/archive/%s.zip" %
  147. rules_flex_version],
  148. )
  149. load("@rules_flex//flex:flex.bzl", "flex_register_toolchains")
  150. # When building Flex, disable all compiler warnings as we can't realistically
  151. # fix them anyways.
  152. flex_register_toolchains(extra_copts = ["-w"])
  153. # TODO: Can switch to a normal release version when it includes:
  154. # https://github.com/jmillikin/rules_bison/commit/478079b28605a38000eaf83719568d756b3383a0
  155. rules_bison_version = "478079b28605a38000eaf83719568d756b3383a0"
  156. http_archive(
  157. name = "rules_bison",
  158. sha256 = "d662d200f4e2a868f6873d666402fa4d413f07ba1a433591c5f60ac601157fb9",
  159. strip_prefix = "rules_bison-%s" % rules_bison_version,
  160. urls = ["https://github.com/jmillikin/rules_bison/archive/%s.zip" %
  161. rules_bison_version],
  162. )
  163. load("@rules_bison//bison:bison.bzl", "bison_register_toolchains")
  164. # When building Bison, disable all compiler warnings as we can't realistically
  165. # fix them anyways.
  166. bison_register_toolchains(extra_copts = ["-w"])
  167. ###############################################################################
  168. # Example conversion repositories
  169. ###############################################################################
  170. local_repository(
  171. name = "brotli",
  172. path = "third_party/examples/brotli/original",
  173. )
  174. new_local_repository(
  175. name = "woff2",
  176. build_file = "third_party/examples/woff2/BUILD.original",
  177. path = "third_party/examples/woff2/original",
  178. workspace_file = "third_party/examples/woff2/WORKSPACE.original",
  179. )
  180. local_repository(
  181. name = "woff2_carbon",
  182. path = "third_party/examples/woff2/carbon",
  183. )