Skip to content
Open
Show file tree
Hide file tree
Changes from all 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.

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
25 changes: 16 additions & 9 deletions xtask/src/tbuld.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::{env, path::PathBuf};

use anyhow::Context as _;
use ostool::build::config::{Cargo, LogLevel};
Expand Down 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 Expand Up @@ -78,12 +85,12 @@ impl Context {
}

if !vm_config_paths.is_empty() {
let value = vm_config_paths
.iter()
.map(|p| format!("{}", p.display()))
.collect::<Vec<_>>()
.join(";");
cargo.env.insert("AXVISOR_VM_CONFIGS".to_string(), value);
if let Ok(joined) = env::join_paths(&vm_config_paths) {
cargo.env.insert(
"AXVISOR_VM_CONFIGS".to_string(),
joined.to_string_lossy().into_owned()
);
}
}

Ok(cargo)
Expand Down