Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
857 B
29 lines
857 B
3 years ago
|
"""
|
||
|
Generates package naming variables for use with rules_pkg.
|
||
|
"""
|
||
|
|
||
|
load("@rules_pkg//:providers.bzl", "PackageVariablesInfo")
|
||
|
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
|
||
|
load(":protobuf_version.bzl", "PROTOBUF_VERSION")
|
||
|
|
||
|
def _package_naming_impl(ctx):
|
||
|
values = {}
|
||
|
values["version"] = PROTOBUF_VERSION
|
||
|
|
||
|
# infer from the current cpp toolchain.
|
||
|
toolchain = find_cpp_toolchain(ctx)
|
||
|
values["cpu"] = toolchain.cpu
|
||
|
|
||
|
return PackageVariablesInfo(values = values)
|
||
|
|
||
|
|
||
|
package_naming = rule(
|
||
|
implementation = _package_naming_impl,
|
||
|
attrs = {
|
||
|
# Necessary data dependency for find_cpp_toolchain.
|
||
|
"_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
|
||
|
},
|
||
|
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
|
||
|
incompatible_use_toolchain_transition = True,
|
||
|
)
|