Skip to content

Commit fffc0b4

Browse files
authored
download: Generalize rustup_target() install in prefetch() (#139)
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.
1 parent 6caae75 commit fffc0b4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

xbuild/src/download.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,25 +125,25 @@ impl<'a> DownloadManager<'a> {
125125
}
126126

127127
pub fn prefetch(&self) -> Result<()> {
128+
for target in self.env().target().compile_targets() {
129+
self.rustup_target(target.rust_triple()?)?;
130+
}
131+
128132
match self.env().target().platform() {
129133
Platform::Linux if Platform::host()? != Platform::Linux => {
130134
anyhow::bail!("cross compiling to linux is not yet supported");
131135
}
132136
Platform::Windows if Platform::host()? != Platform::Windows => {
133-
self.rustup_target("x86_64-pc-windows-msvc")?;
134137
self.windows_sdk()?;
135138
}
136139
Platform::Macos if Platform::host()? != Platform::Macos => {
137-
self.rustup_target("x86_64-apple-darwin")?;
138140
self.macos_sdk()?;
139141
}
140142
Platform::Android => {
141-
self.rustup_target("aarch64-linux-android")?;
142143
self.android_ndk()?;
143144
self.android_jar()?;
144145
}
145146
Platform::Ios => {
146-
self.rustup_target("aarch64-apple-ios")?;
147147
self.ios_sdk()?;
148148
if let Some(device) = self.env().target().device() {
149149
let (major, minor) = device.ios_product_version()?;

0 commit comments

Comments
 (0)