Creates a protoc release zip (#9188)
* Creates a protoc release zip Mimics what we're doing manually today but powered by Bazel. * don't special case this. * Addressing feedback. * adding comment about _cc_toolchainpull/9195/head
parent
11de748d66
commit
3a4d9316aa
6 changed files with 108 additions and 2 deletions
@ -0,0 +1,28 @@ |
||||
""" |
||||
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, |
||||
) |
Loading…
Reference in new issue