Skip to content

Commit

Permalink
download: Generalize rustup_target() install in prefetch() (#139)
Browse files Browse the repository at this point in the history
Excerpt from #127 expanded to
all platforms: we already have `rustup_triple()` for all target
architectures available, instead of hardcoding one specific architecture
per platform.
  • Loading branch information
MarijnS95 authored Sep 14, 2023
1 parent 6caae75 commit fffc0b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions xbuild/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,25 +125,25 @@ impl<'a> DownloadManager<'a> {
}

pub fn prefetch(&self) -> Result<()> {
for target in self.env().target().compile_targets() {
self.rustup_target(target.rust_triple()?)?;
}

match self.env().target().platform() {
Platform::Linux if Platform::host()? != Platform::Linux => {
anyhow::bail!("cross compiling to linux is not yet supported");
}
Platform::Windows if Platform::host()? != Platform::Windows => {
self.rustup_target("x86_64-pc-windows-msvc")?;
self.windows_sdk()?;
}
Platform::Macos if Platform::host()? != Platform::Macos => {
self.rustup_target("x86_64-apple-darwin")?;
self.macos_sdk()?;
}
Platform::Android => {
self.rustup_target("aarch64-linux-android")?;
self.android_ndk()?;
self.android_jar()?;
}
Platform::Ios => {
self.rustup_target("aarch64-apple-ios")?;
self.ios_sdk()?;
if let Some(device) = self.env().target().device() {
let (major, minor) = device.ios_product_version()?;
Expand Down

0 comments on commit fffc0b4

Please sign in to comment.