feat: Add platform arg to force building a specific architecture
This commit is contained in:
parent
20d1950530
commit
75eae89e4a
22 changed files with 408 additions and 71 deletions
|
|
@ -167,3 +167,41 @@ impl DetermineDriver<CiDriverType> for Option<CiDriverType> {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy, ValueEnum)]
|
||||
pub enum Platform {
|
||||
#[default]
|
||||
#[value(name = "native")]
|
||||
Native,
|
||||
#[value(name = "linux/amd64")]
|
||||
LinuxAmd64,
|
||||
|
||||
#[value(name = "linux/arm64")]
|
||||
LinuxArm64,
|
||||
}
|
||||
|
||||
impl Platform {
|
||||
/// The architecture of the platform.
|
||||
#[must_use]
|
||||
pub const fn arch(&self) -> &str {
|
||||
match *self {
|
||||
Self::Native => "native",
|
||||
Self::LinuxAmd64 => "amd64",
|
||||
Self::LinuxArm64 => "arm64",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Platform {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match *self {
|
||||
Self::Native => "native",
|
||||
Self::LinuxAmd64 => "linux/amd64",
|
||||
Self::LinuxArm64 => "linux/arm64",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue