WORKSPACE 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. # LLVM libraries
  72. ###############################################################################
  73. new_local_repository(
  74. name = "llvm-raw",
  75. build_file_content = "# empty",
  76. path = "third_party/llvm-project",
  77. )
  78. load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
  79. llvm_configure(
  80. name = "llvm-project",
  81. targets = [
  82. "AArch64",
  83. "X86",
  84. ],
  85. )
  86. load("@llvm-raw//utils/bazel:terminfo.bzl", "llvm_terminfo_system")
  87. # We require successful detection and use of a system terminfo library.
  88. llvm_terminfo_system(name = "llvm_terminfo")
  89. load("@llvm-raw//utils/bazel:zlib.bzl", "llvm_zlib_system")
  90. # We require successful detection and use of a system zlib library.
  91. llvm_zlib_system(name = "llvm_zlib")
  92. ###############################################################################
  93. # Flex/Bison rules
  94. ###############################################################################
  95. # TODO: Can switch to a normal release version when it includes:
  96. # https://github.com/jmillikin/rules_m4/commit/b504241407916d1d6d72c66a766daacf9603cf8b
  97. rules_m4_version = "b504241407916d1d6d72c66a766daacf9603cf8b"
  98. http_archive(
  99. name = "rules_m4",
  100. sha256 = "e6003c5f45746a2ad01335a8526044591f2b6c5c68852cee1bcd28adc2cf452b",
  101. strip_prefix = "rules_m4-%s" % rules_m4_version,
  102. urls = ["https://github.com/jmillikin/rules_m4/archive/%s.zip" %
  103. rules_m4_version],
  104. )
  105. load("@rules_m4//m4:m4.bzl", "m4_register_toolchains")
  106. # When building M4, disable all compiler warnings as we can't realistically fix
  107. # them anyways.
  108. m4_register_toolchains(extra_copts = ["-w"])
  109. # TODO: Can switch to a normal release version when it includes:
  110. # https://github.com/jmillikin/rules_flex/commit/1f1d9c306c2b4b8be2cb899a3364b84302124e77
  111. rules_flex_version = "1f1d9c306c2b4b8be2cb899a3364b84302124e77"
  112. http_archive(
  113. name = "rules_flex",
  114. sha256 = "ad1c3a1a9bdd6254df857f84f3ab4c052df6e21ce4af5d32710f2feff2abf4dd",
  115. strip_prefix = "rules_flex-%s" % rules_flex_version,
  116. urls = ["https://github.com/jmillikin/rules_flex/archive/%s.zip" %
  117. rules_flex_version],
  118. )
  119. load("@rules_flex//flex:flex.bzl", "flex_register_toolchains")
  120. # When building Flex, disable all compiler warnings as we can't realistically
  121. # fix them anyways.
  122. flex_register_toolchains(extra_copts = ["-w"])
  123. # TODO: Can switch to a normal release version when it includes:
  124. # https://github.com/jmillikin/rules_bison/commit/478079b28605a38000eaf83719568d756b3383a0
  125. rules_bison_version = "478079b28605a38000eaf83719568d756b3383a0"
  126. http_archive(
  127. name = "rules_bison",
  128. sha256 = "d662d200f4e2a868f6873d666402fa4d413f07ba1a433591c5f60ac601157fb9",
  129. strip_prefix = "rules_bison-%s" % rules_bison_version,
  130. urls = ["https://github.com/jmillikin/rules_bison/archive/%s.zip" %
  131. rules_bison_version],
  132. )
  133. load("@rules_bison//bison:bison.bzl", "bison_register_toolchains")
  134. # When building Bison, disable all compiler warnings as we can't realistically
  135. # fix them anyways.
  136. bison_register_toolchains(extra_copts = ["-w"])
  137. ###############################################################################
  138. # Example conversion repositories
  139. ###############################################################################
  140. local_repository(
  141. name = "brotli",
  142. path = "third_party/examples/brotli/original",
  143. )
  144. new_local_repository(
  145. name = "woff2",
  146. build_file = "third_party/examples/woff2/BUILD.original",
  147. path = "third_party/examples/woff2/original",
  148. workspace_file = "third_party/examples/woff2/WORKSPACE.original",
  149. )
  150. local_repository(
  151. name = "woff2_carbon",
  152. path = "third_party/examples/woff2/carbon",
  153. )