xref: /aosp_15_r20/external/tink/cc/integration/gcpkms/tink_cc_gcpkms_deps_init.bzl (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1"""Initialization of dependencies of Tink C++ Cloud KMS."""
2
3load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
4load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
5
6# TODO(b/233231652): Revert back to grpc_extra_deps() when it's safe to do so.
7#load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
8load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
9load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")
10load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
11load("@com_envoyproxy_protoc_gen_validate//:dependencies.bzl", "go_third_party")
12load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
13load("@envoy_api//bazel:repositories.bzl", "api_dependencies")
14load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
15load("@upb//bazel:workspace_deps.bzl", "upb_deps")
16
17def tink_cc_gcpkms_deps_init(
18        ignore_version_differences = False,
19        register_go = True):
20    """Initializes dependencies of Tink C++ GCP Cloud KMS.
21
22    Args:
23      ignore_version_differences: Plumbed directly to the invocation of
24        apple_rules_dependencies.
25      register_go: Whether or not to register Go toolchains. If toolchains
26        are already registered, it should not be done again here.
27    """
28    switched_rules_by_language(
29        name = "com_google_googleapis_imports",
30        cc = True,
31        grpc = True,
32    )
33    grpc_deps()
34
35    # From this point on, the work normally done by grpc_extra_deps() is
36    # locally replicated, to facilitate making makes Go toolchain registration
37    # optional. Without this option, Bazel will fail if this is used in a
38    # workspace where go_register_toolchains() has already been called.
39    #
40    # TODO(b/233231652): Upstream this (or an equivalent) fix to gRPC.
41    protobuf_deps()
42
43    upb_deps()
44
45    api_dependencies()
46
47    if register_go:
48        go_rules_dependencies()
49        go_register_toolchains(version = "1.18")
50
51    gazelle_dependencies()
52
53    # Pull-in the go 3rd party dependencies for protoc_gen_validate, which is
54    # needed for building C++ xDS protos
55    go_third_party()
56
57    apple_rules_dependencies(ignore_version_differences = ignore_version_differences)
58
59    apple_support_dependencies()
60