| 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 |
|
| 16 |
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") |
| 17 |
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") |
| 18 |
load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") |
| 19 |
load("@com_envoyproxy_protoc_gen_validate//:dependencies.bzl", "go_third_party") |
| 20 |
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language") |
| 21 |
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") |
| 22 |
load("@envoy_api//bazel:repositories.bzl", "api_dependencies") |
| 23 |
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") |
| 24 |
load("@upb//bazel:workspace_deps.bzl", "upb_deps") |
| 25 |
|
| 26 |
def grpc_extra_deps(ignore_version_differences = False): |
| 27 |
"""Loads the extra dependencies. |
| 28 |
|
| 29 |
These are necessary for using the external repositories defined in |
| 30 |
grpc_deps.bzl. Projects that depend on gRPC as an external repository need |
| 31 |
to call both grpc_deps and grpc_extra_deps, if they have not already loaded |
| 32 |
the extra dependencies. For example, they can do the following in their |
| 33 |
WORKSPACE |
| 34 |
``` |
| 35 |
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps", "grpc_test_only_deps") |
| 36 |
grpc_deps() |
| 37 |
|
| 38 |
grpc_test_only_deps() |
| 39 |
|
| 40 |
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps") |
| 41 |
|
| 42 |
grpc_extra_deps() |
| 43 |
``` |
| 44 |
|
| 45 |
Args: |
| 46 |
ignore_version_differences: Plumbed directly to the invocation of |
| 47 |
apple_rules_dependencies. |
| 48 |
""" |
| 49 |
protobuf_deps() |
| 50 |
|
| 51 |
upb_deps() |
| 52 |
|
| 53 |
api_dependencies() |
| 54 |
|
| 55 |
go_rules_dependencies() |
| 56 |
go_register_toolchains(version = "1.18") |
| 57 |
gazelle_dependencies() |
| 58 |
|
| 59 |
# Pull-in the go 3rd party dependencies for protoc_gen_validate, which is |
| 60 |
# needed for building C++ xDS protos |
| 61 |
go_third_party() |
| 62 |
|
| 63 |
apple_rules_dependencies(ignore_version_differences = ignore_version_differences) |
| 64 |
|
| 65 |
apple_support_dependencies() |
| 66 |
|
| 67 |
# Initialize Google APIs with only C++ and Python targets |
| 68 |
switched_rules_by_language( |
| 69 |
name = "com_google_googleapis_imports", |
| 70 |
cc = True, |
| 71 |
grpc = True, |
| 72 |
python = True, |
| 73 |
) |