pub struct Context {
pub config: Config,
pub workspace_root: PathBuf,
pub target_dir: PathBuf,
pub executable: PathBuf,
pub is_test: bool,
pub cache_dir: PathBuf,
pub output_dir: PathBuf,
pub template_vars: HashMap<String, String>,
pub cli_extra_args: Vec<String>,
pub env_extra_args: Vec<String>,
}Expand description
Context object that carries state through the build pipeline.
Fields§
§config: ConfigConfiguration.
workspace_root: PathBufWorkspace root directory.
target_dir: PathBufTarget directory for build artifacts.
executable: PathBufPath to the executable being run.
is_test: boolWhether this is a test run.
cache_dir: PathBufCache directory for downloaded/generated files.
output_dir: PathBufOutput directory for the current build.
template_vars: HashMap<String, String>Template variables available for substitution.
cli_extra_args: Vec<String>Extra QEMU arguments from CLI passthrough (-- args).
env_extra_args: Vec<String>Extra QEMU arguments from CARGO_IMAGE_RUNNER_QEMU_ARGS env var.
Implementations§
Source§impl Context
impl Context
Sourcepub fn new(
config: Config,
workspace_root: PathBuf,
executable: PathBuf,
) -> Result<Self>
pub fn new( config: Config, workspace_root: PathBuf, executable: PathBuf, ) -> Result<Self>
Create a new context from configuration and executable path.
Sourcepub fn detect_test(&mut self)
pub fn detect_test(&mut self)
Detect if the executable is a test binary.
Tests are detected by checking if the executable name ends with a hash
(Cargo appends a hash suffix to test binaries).
Uses file_stem() to strip extensions like .efi before checking.
Sourcepub fn get_extra_args(&self) -> &[String]
pub fn get_extra_args(&self) -> &[String]
Get the appropriate extra arguments based on whether this is a test run.
Sourcepub fn test_success_exit_code(&self) -> Option<i32>
pub fn test_success_exit_code(&self) -> Option<i32>
Get the success exit code for tests, if configured.