diff --git a/src/config.rs b/src/config.rs index 063c2088f..14910381a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -101,6 +101,10 @@ impl Environment { get_possible_image(self, "IMAGE", "IMAGE_TOOLCHAIN", get_target, get_target) } + fn extra_args(&self, target: &Target) -> (Option>, Option>) { + self.get_values_for("EXTRA_ARGS", target, split_to_cloned_by_ws) + } + fn dockerfile(&self, target: &Target) -> (Option, Option) { self.get_values_for("DOCKERFILE", target, ToOwned::to_owned) } @@ -409,6 +413,10 @@ impl Config { ) } + pub fn extra_args(&self, target: &Target) -> Result>> { + self.get_from_ref(target, Environment::extra_args, CrossToml::extra_args) + } + pub fn env_volumes(&self, target: &Target) -> Result>> { self.get_from_ref(target, Environment::volumes, CrossToml::env_volumes) } diff --git a/src/cross_toml.rs b/src/cross_toml.rs index b079b04ce..1529c527b 100644 --- a/src/cross_toml.rs +++ b/src/cross_toml.rs @@ -15,6 +15,8 @@ use std::str::FromStr; pub struct CrossEnvConfig { volumes: Option>, passthrough: Option>, + /// Additional arguments to the underlying container engine + extra_args: Option>, } /// Build configuration @@ -362,6 +364,14 @@ impl CrossToml { ) } + pub fn extra_args(&self, target: &Target) -> (Option<&[String]>, Option<&[String]>) { + self.get_ref( + target, + |build| build.env.extra_args.as_deref(), + |t| t.env.extra_args.as_deref(), + ) + } + /// Returns the default target to build, pub fn default_target(&self, target_list: &TargetList) -> Option { self.build