Skip to content

Commit

Permalink
Remove uses of incompatible_use_toolchain_transition.
Browse files Browse the repository at this point in the history
Now that Bazel 7.0 has been released, it's time to remove this tech debt.

This has been a no-op since Bazel 5.0, I've been waiting to remove the code for
two years, it's time.

Part of bazelbuild/bazel#14127.

PiperOrigin-RevId: 591912356
  • Loading branch information
katre authored and Copybara-Service committed Dec 18, 2023
1 parent bacf61a commit d362e0f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 34 deletions.
64 changes: 31 additions & 33 deletions protobuf_release.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,42 @@ load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
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"
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"] = "win32"
else:
values["platform"] = "unknown"

return PackageVariablesInfo(values = values)
values["platform"] = "unknown"

return PackageVariablesInfo(values = values)

package_naming = rule(
implementation = _package_naming_impl,
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")),
# 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,
)
1 change: 0 additions & 1 deletion rust/aspects.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ def _make_proto_library_aspect(is_upb):
"@rules_rust//rust:toolchain_type",
"@bazel_tools//tools/cpp:toolchain_type",
],
incompatible_use_toolchain_transition = True,
)

rust_upb_proto_library_aspect = _make_proto_library_aspect(is_upb = True)
Expand Down

0 comments on commit d362e0f

Please sign in to comment.