add release flag to x task
This commit is contained in:
parent
872f933506
commit
09e861eb73
@ -10,7 +10,10 @@ pub struct Args {
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum Command {
|
||||
Run,
|
||||
Run {
|
||||
#[arg(short, long)]
|
||||
release: bool,
|
||||
},
|
||||
Collect,
|
||||
Mapper,
|
||||
}
|
||||
|
||||
@ -15,8 +15,11 @@ async fn main() {
|
||||
.expect("Failed to change to workspace directory");
|
||||
|
||||
match args.command {
|
||||
Some(args::Command::Run) | None => {
|
||||
run::run().await;
|
||||
Some(args::Command::Run { release }) => {
|
||||
run::run(release).await;
|
||||
}
|
||||
None => {
|
||||
run::run(false).await;
|
||||
}
|
||||
Some(args::Command::Collect) => {
|
||||
collect::collect().await;
|
||||
|
||||
@ -5,7 +5,7 @@ use tokio_util::sync::CancellationToken;
|
||||
|
||||
type ProcessHandle = Arc<Mutex<Option<Child>>>;
|
||||
|
||||
pub async fn run() {
|
||||
pub async fn run(release: bool) {
|
||||
let qjackctl_handle: ProcessHandle = Arc::new(Mutex::new(None));
|
||||
let audio_engine_handle: ProcessHandle = Arc::new(Mutex::new(None));
|
||||
let gui_handle: ProcessHandle = Arc::new(Mutex::new(None));
|
||||
@ -35,9 +35,9 @@ pub async fn run() {
|
||||
// Start processes
|
||||
let qjackctl = spawn_qjackctl().await;
|
||||
tokio::time::sleep(tokio::time::Duration::from_secs(2)).await;
|
||||
let audio_engine = spawn_audio_engine().await;
|
||||
let gui = spawn_gui().await;
|
||||
let simulator = spawn_simulator().await;
|
||||
let audio_engine = spawn_audio_engine(release).await;
|
||||
let gui = spawn_gui(release).await;
|
||||
let simulator = spawn_simulator(release).await;
|
||||
|
||||
// Store handles for cleanup
|
||||
*qjackctl_handle.lock().await = Some(qjackctl);
|
||||
@ -130,11 +130,12 @@ async fn spawn_qjackctl() -> Child {
|
||||
.expect("Could not start qjackctl")
|
||||
}
|
||||
|
||||
async fn spawn_audio_engine() -> Child {
|
||||
async fn spawn_audio_engine(release: bool) -> Child {
|
||||
Command::new("cargo")
|
||||
.args([
|
||||
"run",
|
||||
"--release",
|
||||
"--profile",
|
||||
if release { "release" } else { "debug" },
|
||||
"--bin",
|
||||
"audio_engine",
|
||||
"--",
|
||||
@ -145,18 +146,31 @@ async fn spawn_audio_engine() -> Child {
|
||||
.expect("Could not start audio engine")
|
||||
}
|
||||
|
||||
async fn spawn_gui() -> Child {
|
||||
async fn spawn_gui(release: bool) -> Child {
|
||||
Command::new("cargo")
|
||||
.args(["run", "--release", "--bin", "gui"])
|
||||
.args([
|
||||
"run",
|
||||
"--profile",
|
||||
if release { "release" } else { "debug" },
|
||||
"--bin",
|
||||
"gui"
|
||||
])
|
||||
.spawn()
|
||||
.expect("Could not start gui")
|
||||
}
|
||||
|
||||
async fn spawn_simulator() -> Child {
|
||||
Command::new("cargo")
|
||||
.args(["run", "--release", "--bin", "simulator"])
|
||||
.spawn()
|
||||
.expect("Could not start simulator")
|
||||
async fn spawn_simulator(release: bool) -> Child {
|
||||
if release {
|
||||
Command::new("sleep")
|
||||
.args(["infinity"])
|
||||
.spawn()
|
||||
.expect("Could not start simulator")
|
||||
} else {
|
||||
Command::new("cargo")
|
||||
.args(["run", "--release", "--bin", "simulator"])
|
||||
.spawn()
|
||||
.expect("Could not start simulator")
|
||||
}
|
||||
}
|
||||
|
||||
async fn kill_process(child: &mut Child, name: &str) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user