cross-rs/cross

Make it possible to choose platform

Opened this issue · 0 comments

} else {
let same_arch = self
.toolchain
.iter()
.filter(|platform| {
&platform.architecture
== engine.arch.as_ref().unwrap_or(&Architecture::Amd64)
})
.collect::<Vec<_>>();
if same_arch.len() == 1 {
// pick the platform with the same architecture
same_arch.first().expect("should contain one element")
} else if let Some(platform) = same_arch
.iter()
.find(|platform| &platform.os == engine.os.as_ref().unwrap_or(&Os::Linux))
{
*platform
} else if let Some(platform) =
same_arch.iter().find(|platform| platform.os == Os::Linux)
{
// container engine should be fine with linux
platform
} else {
let platform = self
.toolchain
.first()
.expect("should be at least one platform");
// FIXME: Don't throw away
msg_info.warn(
format_args!("could not determine what toolchain to use for image, defaulting to `{}`", platform.target),
).ok();
platform
}
};

We should allow users to pick exactly which platform to run the docker image on.

related to #1498