@@ -576,8 +576,8 @@ function choose_shards(p::AbstractPlatform;
576
576
ps_build:: VersionNumber = v " 2024.08.10" ,
577
577
GCC_builds:: Vector{GCCBuild} = available_gcc_builds,
578
578
LLVM_builds:: Vector{LLVMBuild} = available_llvm_builds,
579
- Rust_build :: VersionNumber = maximum ( getversion .( available_rust_builds)) ,
580
- Go_build :: VersionNumber = maximum ( getversion .( available_go_builds)) ,
579
+ Rust_builds :: Vector{RustBuild} = available_rust_builds,
580
+ Go_builds :: Vector{GoBuild} = available_go_builds,
581
581
archive_type:: Symbol = (use_squashfs[] ? :squashfs : :unpacked ),
582
582
bootstrap_list:: Vector{Symbol} = bootstrap_list,
583
583
# Because GCC has lots of compatibility issues, we always default to
@@ -586,6 +586,11 @@ function choose_shards(p::AbstractPlatform;
586
586
# Because LLVM doesn't have compatibility issues, we always default
587
587
# to the newest version possible.
588
588
preferred_llvm_version:: VersionNumber = getversion (LLVM_builds[end ]),
589
+ # Rust can have compatibility issues between versions, but by default choose
590
+ # the newest one.
591
+ preferred_rust_version:: VersionNumber = maximum (getversion .(Rust_builds)),
592
+ # Always default to the latest Go version
593
+ preferred_go_version:: VersionNumber = maximum (getversion .(Go_builds)),
589
594
)
590
595
591
596
function find_shard (name, version, archive_type; target = nothing )
@@ -654,9 +659,23 @@ function choose_shards(p::AbstractPlatform;
654
659
end
655
660
656
661
if :rust in compilers
662
+ # Make sure the selected Rust toolchain version is available
663
+ if preferred_rust_version in getversion .(Rust_builds)
664
+ Rust_build = preferred_rust_version
665
+ else
666
+ error (" Requested Rust toolchain $(preferred_rust_version) not available in $(Rust_builds) " )
667
+ end
668
+
669
+ base_shard = find_shard (" RustBase" , Rust_build, archive_type)
670
+ toolchain_shard = find_shard (" RustToolchain" , Rust_build, archive_type; target= p)
671
+
672
+ if isnothing (toolchain_shard)
673
+ error (" Requested Rust toolchain $(preferred_rust_version) not available on platform $(triplet (p)) " )
674
+ end
675
+
657
676
append! (shards, [
658
- find_shard ( " RustBase " , Rust_build, archive_type) ,
659
- find_shard ( " RustToolchain " , Rust_build, archive_type; target = p) ,
677
+ base_shard ,
678
+ toolchain_shard ,
660
679
])
661
680
662
681
if ! platforms_match (p, default_host_platform)
@@ -677,6 +696,13 @@ function choose_shards(p::AbstractPlatform;
677
696
end
678
697
679
698
if :go in compilers
699
+ # Make sure the selected Go toolchain version is available
700
+ if preferred_go_version in getversion .(Go_builds)
701
+ Go_build = preferred_go_version
702
+ else
703
+ error (" Requested Go toolchain $(preferred_go_version) not available in $(Go_builds) " )
704
+ end
705
+
680
706
push! (shards, find_shard (" Go" , Go_build, archive_type))
681
707
end
682
708
else
0 commit comments