Skip to content

Commit

Permalink
Replace half-baked repository_os logic with get_host_triple
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Apr 27, 2022
1 parent 07b30a5 commit b828c00
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions tools/bazel/vendor.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
of a crate in the current workspace.
"""

load("@rules_rust//rust:repositories.bzl", "load_arbitrary_tool")
load("@rules_rust//rust:defs.bzl", "rust_common")
load("@rules_rust//rust:repositories.bzl", "load_arbitrary_tool")
load("@rules_rust//rust/platform:triple.bzl", "get_host_triple")

def _impl(repository_ctx):
# Link cxx repository into @third-party.
Expand All @@ -21,20 +22,7 @@ def _impl(repository_ctx):
if repository_ctx.attr.target_triple:
target_triple = repository_ctx.attr.target_triple
else:
if "mac" in repository_ctx.os.name:
triple_os = "apple-darwin"
elif "windows" in repository_ctx.os.name:
triple_os = "pc-windows-msvc"
else:
triple_os = "unknown-linux-gnu"

# FIXME can we just use `triple_arch = repository_ctx.os.arch`?
if "aarch64" in getattr(repository_ctx.os, "arch", ""):
triple_arch = "aarch64"
else:
triple_arch = "x86_64"

target_triple = "{}-{}".format(triple_arch, triple_os)
target_triple = get_host_triple(repository_ctx).str

# Download cargo.
load_arbitrary_tool(
Expand Down

0 comments on commit b828c00

Please sign in to comment.