Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support resolving arm triplet with bazel #1038

Merged
merged 2 commits into from Apr 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions tools/bazel/vendor.bzl
Expand Up @@ -17,13 +17,19 @@ def _impl(repository_ctx):
root_lockfile = repository_ctx.path("workspace/Cargo.lock")
_copy_file(repository_ctx, src = vendor_lockfile, dst = root_lockfile)

is_mac = "mac" in repository_ctx.os.name
is_arm = "arm" in getattr(repository_ctx.os, "arch", "")
# Figure out which version of cargo to use.
if repository_ctx.attr.target_triple:
target_triple = repository_ctx.attr.target_triple
elif "mac" in repository_ctx.os.name:
target_triple = "x86_64-apple-darwin"
elif is_mac and is_arm:
target_triple = "aarch64-apple-darwin"
elif is_mac:
target_triple = "x86_64-apple-darwin"
elif "windows" in repository_ctx.os.name:
target_triple = "x86_64-pc-windows-msvc"
elif is_arm:
target_triple = "aarch64-unknown-linux-gnu"
else:
target_triple = "x86_64-unknown-linux-gnu"

Expand Down