代码拉取完成,页面将自动刷新
"""
Generates package naming variables for use with rules_pkg.
"""
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("@rules_pkg//pkg:providers.bzl", "PackageVariablesInfo")
load(":protobuf_version.bzl", "PROTOC_VERSION")
def _package_naming_impl(ctx):
values = {}
values["version"] = PROTOC_VERSION
# infer from the current cpp toolchain.
toolchain = find_cpp_toolchain(ctx)
cpu = toolchain.cpu
system_name = toolchain.target_gnu_system_name
# rename cpus to match what we want artifacts to be
if cpu == "systemz":
cpu = "s390_64"
elif cpu == "aarch64":
cpu = "aarch_64"
elif cpu == "ppc64":
cpu = "ppcle_64"
# use the system name to determine the os and then create platform names
if "apple" in system_name:
values["platform"] = "osx-" + cpu
elif "linux" in system_name:
values["platform"] = "linux-" + cpu
elif "mingw" in system_name:
if cpu == "x86_64":
values["platform"] = "win64"
else:
values["platform"] = "win32"
else:
values["platform"] = "unknown"
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"],
)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。