Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 9 additions & 93 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions kernel/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@ struct ConfigFile {
pub content: String,
}

/// Gets the paths (colon-separated) from the `AXVISOR_VM_CONFIGS` environment variable.
/// Gets the paths (semicolon-separated) from the `AXVISOR_VM_CONFIGS` environment variable.
///
/// Returns `None` if the environment variable is not set.
fn get_config_paths() -> Option<Vec<OsString>> {
env::var("AXVISOR_VM_CONFIGS")
.ok()
.map(|paths| env::split_paths(&paths).map(OsString::from).collect())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #307 please.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pr differs from #307. We plan to use commas in the command-line arguments to distinguish between different files, ensuring consistency without distinguishing between systems.

.map(|paths| {
paths
.split(';')
.map(|s| OsString::from(s.trim()))
.collect()
})
}

/// Gets the paths and contents of the configuration files specified by the `AXVISOR_VM_CONFIGS` environment variable.
Expand Down
4 changes: 2 additions & 2 deletions xtask/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ostool::ctx::AppContext;
pub struct Context {
pub ctx: AppContext,
pub build_config_path: Option<std::path::PathBuf>,
pub vmconfigs: Vec<String>,
pub vmconfigs: String,
}

impl Context {
Expand All @@ -18,7 +18,7 @@ impl Context {
Context {
ctx,
build_config_path: None,
vmconfigs: vec![],
vmconfigs: String::new(),
}
}
}
10 changes: 8 additions & 2 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ enum Commands {

#[derive(Parser)]
struct QemuArgs {
/// Path to the build configuration file
#[arg(long)]
build_config: Option<PathBuf>,
/// Path to the QEMU configuration file
#[arg(long)]
qemu_config: Option<PathBuf>,
/// VM configuration files (comma-separated paths)
#[arg(long)]
vmconfigs: Vec<String>,
vmconfigs: String,
}

#[derive(Parser)]
Expand All @@ -76,12 +79,15 @@ struct ClippyArgs {

#[derive(Parser)]
struct UbootArgs {
/// Path to the build configuration file
#[arg(long)]
build_config: Option<PathBuf>,
/// Path to the uboot configuration file
#[arg(long)]
uboot_config: Option<PathBuf>,
/// VM configuration files (comma-separated paths)
#[arg(long)]
vmconfigs: Vec<String>,
vmconfigs: String,
}

#[tokio::main]
Expand Down
11 changes: 9 additions & 2 deletions xtask/src/tbuld.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,15 @@ impl Context {

self.ctx.build_config_path = Some(config_path);

let mut vm_configs = config.vm_configs.to_vec();
vm_configs.extend(self.vmconfigs.iter().cloned());
let vm_configs = if !self.vmconfigs.is_empty() {
self.vmconfigs
.split(',')
.map(|s| s.trim().to_string())
.filter(|s| !s.is_empty())
.collect()
} else {
vec![]
};

let mut vm_config_paths = vec![];
for vm_config in &vm_configs {
Expand Down