grpc_extra_deps.bzl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Copyright 2021 The gRPC Authors
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. """Loads the dependencies necessary for the external repositories defined in grpc_deps.bzl."""
  15. load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
  16. load("@upb//bazel:workspace_deps.bzl", "upb_deps")
  17. load("@envoy_api//bazel:repositories.bzl", "api_dependencies")
  18. load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
  19. load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
  20. load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")
  21. load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
  22. def grpc_extra_deps(ignore_version_differences = False):
  23. """Loads the extra dependencies.
  24. These are necessary for using the external repositories defined in
  25. grpc_deps.bzl. Projects that depend on gRPC as an external repository need
  26. to call both grpc_deps and grpc_extra_deps, if they have not already loaded
  27. the extra dependencies. For example, they can do the following in their
  28. WORKSPACE
  29. ```
  30. load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps", "grpc_test_only_deps")
  31. grpc_deps()
  32. grpc_test_only_deps()
  33. load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
  34. grpc_extra_deps()
  35. ```
  36. Args:
  37. ignore_version_differences: Plumbed directly to the invocation of
  38. apple_rules_dependencies.
  39. """
  40. protobuf_deps()
  41. upb_deps()
  42. api_dependencies()
  43. go_rules_dependencies()
  44. go_register_toolchains()
  45. apple_rules_dependencies(ignore_version_differences = ignore_version_differences)
  46. apple_support_dependencies()
  47. # Initialize Google APIs with only C++ and Python targets
  48. switched_rules_by_language(
  49. name = "com_google_googleapis_imports",
  50. cc = True,
  51. grpc = True,
  52. python = True,
  53. )