Skip to content

Commit 3cc11b7

Browse files
committed
fix: update VM configuration handling to use semicolon-separated paths and refactor related structures
1 parent ae4d790 commit 3cc11b7

File tree

5 files changed

+35
-101
lines changed

5 files changed

+35
-101
lines changed

Cargo.lock

Lines changed: 9 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kernel/build.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,18 @@ struct ConfigFile {
4242
pub content: String,
4343
}
4444

45-
/// Gets the paths (colon-separated) from the `AXVISOR_VM_CONFIGS` environment variable.
45+
/// Gets the paths (semicolon-separated) from the `AXVISOR_VM_CONFIGS` environment variable.
4646
///
4747
/// Returns `None` if the environment variable is not set.
4848
fn get_config_paths() -> Option<Vec<OsString>> {
4949
env::var("AXVISOR_VM_CONFIGS")
5050
.ok()
51-
.map(|paths| env::split_paths(&paths).map(OsString::from).collect())
51+
.map(|paths| {
52+
paths
53+
.split(';')
54+
.map(|s| OsString::from(s.trim()))
55+
.collect()
56+
})
5257
}
5358

5459
/// Gets the paths and contents of the configuration files specified by the `AXVISOR_VM_CONFIGS` environment variable.

xtask/src/ctx.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use ostool::ctx::AppContext;
33
pub struct Context {
44
pub ctx: AppContext,
55
pub build_config_path: Option<std::path::PathBuf>,
6-
pub vmconfigs: Vec<String>,
6+
pub vmconfigs: String,
77
}
88

99
impl Context {
@@ -18,7 +18,7 @@ impl Context {
1818
Context {
1919
ctx,
2020
build_config_path: None,
21-
vmconfigs: vec![],
21+
vmconfigs: String::new(),
2222
}
2323
}
2424
}

xtask/src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,15 @@ enum Commands {
4444

4545
#[derive(Parser)]
4646
struct QemuArgs {
47+
/// Path to the build configuration file
4748
#[arg(long)]
4849
build_config: Option<PathBuf>,
50+
/// Path to the QEMU configuration file
4951
#[arg(long)]
5052
qemu_config: Option<PathBuf>,
53+
/// VM configuration files (comma-separated paths)
5154
#[arg(long)]
52-
vmconfigs: Vec<String>,
55+
vmconfigs: String,
5356
}
5457

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

7780
#[derive(Parser)]
7881
struct UbootArgs {
82+
/// Path to the build configuration file
7983
#[arg(long)]
8084
build_config: Option<PathBuf>,
85+
/// Path to the uboot configuration file
8186
#[arg(long)]
8287
uboot_config: Option<PathBuf>,
88+
/// VM configuration files (comma-separated paths)
8389
#[arg(long)]
84-
vmconfigs: Vec<String>,
90+
vmconfigs: String,
8591
}
8692

8793
#[tokio::main]

xtask/src/tbuld.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,15 @@ impl Context {
4545

4646
self.ctx.build_config_path = Some(config_path);
4747

48-
let mut vm_configs = config.vm_configs.to_vec();
49-
vm_configs.extend(self.vmconfigs.iter().cloned());
48+
let vm_configs = if !self.vmconfigs.is_empty() {
49+
self.vmconfigs
50+
.split(',')
51+
.map(|s| s.trim().to_string())
52+
.filter(|s| !s.is_empty())
53+
.collect()
54+
} else {
55+
vec![]
56+
};
5057

5158
let mut vm_config_paths = vec![];
5259
for vm_config in &vm_configs {

0 commit comments

Comments
 (0)