From 07b30a57e93aa359dbf77562355fa43a496961af Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 27 Apr 2022 14:39:15 -0700 Subject: [PATCH 1/2] Pull in newer Bazel rules_rust --- WORKSPACE | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index d0850e875..793bf14d1 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,11 +4,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "rules_rust", - sha256 = "d39af65fc3b88c204e101d4ddc7dd7543be4e2509fa21c35a5d228f54821a2a9", - strip_prefix = "rules_rust-f7cb22efa64a6a07813e30e9f9d70d1fd18e463e", + sha256 = "617082067629939c0a22f587811a3e822a50a203119a90380e21f5aec3373da9", + strip_prefix = "rules_rust-e07881fa22a5f0d16230d8b23bbff2bf358823b8", urls = [ - # Main branch as of 2022-04-25 - "https://github.com/bazelbuild/rules_rust/archive/f7cb22efa64a6a07813e30e9f9d70d1fd18e463e.tar.gz", + # Main branch as of 2022-04-27 + "https://github.com/bazelbuild/rules_rust/archive/e07881fa22a5f0d16230d8b23bbff2bf358823b8.tar.gz", ], ) From b828c0038ef2f36e95c408e18d7b9e1355e9d1bd Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 27 Apr 2022 14:40:54 -0700 Subject: [PATCH 2/2] Replace half-baked repository_os logic with get_host_triple --- tools/bazel/vendor.bzl | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/tools/bazel/vendor.bzl b/tools/bazel/vendor.bzl index df7091b73..b4dd253ee 100644 --- a/tools/bazel/vendor.bzl +++ b/tools/bazel/vendor.bzl @@ -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. @@ -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(