Skip to content

Commit 33d90de

Browse files
Arm1sticedamienmg
andauthored
fix: Download llvm tools for nightly builds after 2020-05-22 (#365)
Co-authored-by: Damien Martin-Guillerez <[email protected]>
1 parent f41a008 commit 33d90de

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

rust/repositories.bzl

+23
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,25 @@ def _load_rustc_dev_nightly(ctx, target_triple):
431431

432432
return
433433

434+
def _load_llvm_tools(ctx, target_triple):
435+
"""Loads the llvm tools
436+
437+
Args:
438+
ctx: A repository_ctx.
439+
target_triple: The rust-style target triple of the tool
440+
"""
441+
442+
load_arbitrary_tool(
443+
ctx,
444+
iso_date = ctx.attr.iso_date,
445+
target_triple = target_triple,
446+
tool_name = "llvm-tools",
447+
tool_subdirectories = ["llvm-tools-preview"],
448+
version = ctx.attr.version,
449+
)
450+
451+
return
452+
434453
def _rust_toolchain_repository_impl(ctx):
435454
"""The implementation of the rust toolchain repository rule."""
436455

@@ -441,6 +460,10 @@ def _rust_toolchain_repository_impl(ctx):
441460
if ctx.attr.rustfmt_version:
442461
BUILD_components.append(_load_rustfmt(ctx))
443462

463+
# Nightly Rust builds after 2020-05-22 need the llvm-tools gzip to get the libLLVM dylib
464+
if ctx.attr.version == "nightly" and ctx.attr.iso_date > "2020-05-22":
465+
_load_llvm_tools(ctx, ctx.attr.exec_triple)
466+
444467
for target_triple in [ctx.attr.exec_triple] + ctx.attr.extra_target_triples:
445468
BUILD_components.append(_load_rust_stdlib(ctx, target_triple))
446469

0 commit comments

Comments
 (0)