repository.bzl 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # Copyright The OpenTelemetry Authors
  2. # SPDX-License-Identifier: Apache-2.0
  3. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
  4. load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
  5. #
  6. # MAINTAINER
  7. #
  8. # This file is used for the Bazel build.
  9. #
  10. # When changing (add, upgrade, remove) dependencies
  11. # please update:
  12. # - the CMake build, see file
  13. # <root>/third_party_release
  14. # - git submodule, see command
  15. # git submodule status
  16. #
  17. def opentelemetry_cpp_deps():
  18. """Loads dependencies need to compile the opentelemetry-cpp library."""
  19. # Google Benchmark library.
  20. # Only needed for benchmarks, not to build the OpenTelemetry library.
  21. maybe(
  22. http_archive,
  23. name = "com_github_google_benchmark",
  24. sha256 = "6bc180a57d23d4d9515519f92b0c83d61b05b5bab188961f36ac7b06b0d9e9ce",
  25. strip_prefix = "benchmark-1.8.3",
  26. urls = [
  27. "https://github.com/google/benchmark/archive/v1.8.3.tar.gz",
  28. ],
  29. )
  30. # GoogleTest framework.
  31. # Only needed for tests, not to build the OpenTelemetry library.
  32. maybe(
  33. http_archive,
  34. name = "com_google_googletest",
  35. sha256 = "8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7",
  36. strip_prefix = "googletest-1.14.0",
  37. urls = [
  38. "https://github.com/google/googletest/archive/v1.14.0.tar.gz",
  39. ],
  40. )
  41. # Load abseil dependency(optional)
  42. maybe(
  43. http_archive,
  44. name = "com_google_absl",
  45. sha256 = "733726b8c3a6d39a4120d7e45ea8b41a434cdacde401cba500f14236c49b39dc",
  46. strip_prefix = "abseil-cpp-20240116.2",
  47. urls = [
  48. "https://github.com/abseil/abseil-cpp/archive/refs/tags/20240116.2.tar.gz",
  49. ],
  50. )
  51. # gRPC transitively depends on apple_support and rules_apple at older
  52. # versions. Bazel 7.x requires newer versions of these rules. By loading
  53. # them before grpc, these newer versions are preferrred.
  54. maybe(
  55. http_archive,
  56. name = "build_bazel_apple_support",
  57. sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80",
  58. url = "https://github.com/bazelbuild/apple_support/releases/download/1.15.1/apple_support.1.15.1.tar.gz",
  59. )
  60. maybe(
  61. http_archive,
  62. name = "build_bazel_rules_apple",
  63. sha256 = "b4df908ec14868369021182ab191dbd1f40830c9b300650d5dc389e0b9266c8d",
  64. url = "https://github.com/bazelbuild/rules_apple/releases/download/3.5.1/rules_apple.3.5.1.tar.gz",
  65. )
  66. # Load gRPC dependency
  67. maybe(
  68. http_archive,
  69. name = "com_github_grpc_grpc",
  70. sha256 = "f40bde4ce2f31760f65dc49a2f50876f59077026494e67dccf23992548b1b04f",
  71. strip_prefix = "grpc-1.62.0",
  72. urls = [
  73. "https://github.com/grpc/grpc/archive/refs/tags/v1.62.0.tar.gz",
  74. ],
  75. )
  76. # OTLP Protocol definition
  77. maybe(
  78. http_archive,
  79. name = "com_github_opentelemetry_proto",
  80. build_file = "@io_opentelemetry_cpp//bazel:opentelemetry_proto.BUILD",
  81. sha256 = "92682778affe8d00cd36f68308b49295db34fce379bef0a781c50837eccbc3c0",
  82. strip_prefix = "opentelemetry-proto-1.6.0",
  83. urls = [
  84. "https://github.com/open-telemetry/opentelemetry-proto/archive/v1.6.0.tar.gz",
  85. ],
  86. )
  87. # JSON library
  88. maybe(
  89. http_archive,
  90. name = "github_nlohmann_json",
  91. build_file = "@io_opentelemetry_cpp//bazel:nlohmann_json.BUILD",
  92. sha256 = "b8cb0ef2dd7f57f18933997c9934bb1fa962594f701cd5a8d3c2c80541559372",
  93. urls = [
  94. "https://github.com/nlohmann/json/releases/download/v3.12.0/include.zip",
  95. ],
  96. )
  97. # C++ Prometheus Client library.
  98. maybe(
  99. http_archive,
  100. name = "com_github_jupp0r_prometheus_cpp",
  101. sha256 = "ac6e958405a29fbbea9db70b00fa3c420e16ad32e1baf941ab233ba031dd72ee",
  102. strip_prefix = "prometheus-cpp-1.3.0",
  103. urls = [
  104. "https://github.com/jupp0r/prometheus-cpp/archive/refs/tags/v1.3.0.tar.gz",
  105. ],
  106. )
  107. # bazel platforms
  108. maybe(
  109. http_archive,
  110. name = "platforms",
  111. sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee",
  112. urls = [
  113. "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
  114. "https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
  115. ],
  116. )
  117. # libcurl (optional)
  118. maybe(
  119. http_archive,
  120. name = "curl",
  121. build_file = "@io_opentelemetry_cpp//bazel:curl.BUILD",
  122. sha256 = "816e41809c043ff285e8c0f06a75a1fa250211bbfb2dc0a037eeef39f1a9e427",
  123. strip_prefix = "curl-8.4.0",
  124. urls = [
  125. "https://curl.haxx.se/download/curl-8.4.0.tar.gz",
  126. "https://github.com/curl/curl/releases/download/curl-8_4_0/curl-8.4.0.tar.gz",
  127. ],
  128. )
  129. # rules foreign cc
  130. maybe(
  131. http_archive,
  132. name = "rules_foreign_cc",
  133. sha256 = "69023642d5781c68911beda769f91fcbc8ca48711db935a75da7f6536b65047f",
  134. strip_prefix = "rules_foreign_cc-0.6.0",
  135. url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.6.0.tar.gz",
  136. )
  137. # bazel skylib
  138. maybe(
  139. http_archive,
  140. name = "bazel_skylib",
  141. sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
  142. urls = [
  143. "https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
  144. "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
  145. ],
  146. )
  147. # Opentracing
  148. maybe(
  149. http_archive,
  150. name = "com_github_opentracing",
  151. sha256 = "5b170042da4d1c4c231df6594da120875429d5231e9baa5179822ee8d1054ac3",
  152. strip_prefix = "opentracing-cpp-1.6.0",
  153. urls = [
  154. "https://github.com/opentracing/opentracing-cpp/archive/refs/tags/v1.6.0.tar.gz",
  155. ],
  156. )
  157. # Zlib (optional)
  158. maybe(
  159. http_archive,
  160. name = "zlib",
  161. build_file = "@io_opentelemetry_cpp//bazel:zlib.BUILD",
  162. sha256 = "d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98",
  163. strip_prefix = "zlib-1.2.13",
  164. urls = [
  165. "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.xz",
  166. "https://zlib.net/zlib-1.2.13.tar.xz",
  167. ],
  168. )