-
Notifications
You must be signed in to change notification settings - Fork 16.1k
Expand file tree
/
Copy pathBUILD.bazel
More file actions
32 lines (28 loc) · 1.38 KB
/
BUILD.bazel
File metadata and controls
32 lines (28 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Create lazy definitions to reference the pre-built protoc toolchains.
Ensures that Bazel only downloads required binaries for selected toolchains.
In particular, see comment below on the toolchain#toolchain attribute.
"""
load(":protoc_authenticity.bzl", "protoc_authenticity")
load("//toolchain:platforms.bzl", "PROTOBUF_PLATFORMS")
[
toolchain(
name = "{}_toolchain".format(platform.replace("-", "_")),
exec_compatible_with = meta["compatible_with"],
# Toolchain resolution will only permit this toolchain if the config_setting for prefer_prebuilt_protoc is true,
target_settings = ["@com_google_protobuf//bazel/toolchains:prefer_prebuilt_protoc.flag_set"],
# Bazel does not follow this attribute during analysis, so the referenced repo
# will only be fetched if this toolchain is selected.
toolchain = "@prebuilt_protoc.{}//:prebuilt_protoc_toolchain".format(platform.replace("-", "_")),
toolchain_type = "@com_google_protobuf//bazel/private:proto_toolchain_type",
)
for platform, meta in PROTOBUF_PLATFORMS.items()
]
# Support verification of user-registered toolchains
protoc_authenticity(
name = "authenticity_validation",
fail_on_mismatch = select({
"//bazel/toolchains:allow_nonstandard_protoc.flag_set": False,
"//conditions:default": True,
}),
visibility = ["//visibility:public"],
)