fix: Download llvm tools for nightly builds after 2020-05-22 (#365)
Co-authored-by: Damien Martin-Guillerez <damienmg@users.noreply.github.com>
diff --git a/rust/repositories.bzl b/rust/repositories.bzl
index 1d8318f..89dc015 100644
--- a/rust/repositories.bzl
+++ b/rust/repositories.bzl
@@ -431,6 +431,25 @@
return
+def _load_llvm_tools(ctx, target_triple):
+ """Loads the llvm tools
+
+ Args:
+ ctx: A repository_ctx.
+ target_triple: The rust-style target triple of the tool
+ """
+
+ load_arbitrary_tool(
+ ctx,
+ iso_date = ctx.attr.iso_date,
+ target_triple = target_triple,
+ tool_name = "llvm-tools",
+ tool_subdirectories = ["llvm-tools-preview"],
+ version = ctx.attr.version,
+ )
+
+ return
+
def _rust_toolchain_repository_impl(ctx):
"""The implementation of the rust toolchain repository rule."""
@@ -441,6 +460,10 @@
if ctx.attr.rustfmt_version:
BUILD_components.append(_load_rustfmt(ctx))
+ # Nightly Rust builds after 2020-05-22 need the llvm-tools gzip to get the libLLVM dylib
+ if ctx.attr.version == "nightly" and ctx.attr.iso_date > "2020-05-22":
+ _load_llvm_tools(ctx, ctx.attr.exec_triple)
+
for target_triple in [ctx.attr.exec_triple] + ctx.attr.extra_target_triples:
BUILD_components.append(_load_rust_stdlib(ctx, target_triple))