From feab6f051ab48abf91c5a55ae82b019c54411100 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 22 Mar 2025 17:53:38 +0000 Subject: [PATCH 1/8] add more error messaging --- crates/xtask/src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 72bfcba346..a78ef7abce 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -1217,10 +1217,10 @@ impl Xtasks { fn bench(app_settings: GlobalArgs) -> Result<()> { // first of all figure out which branch we're on // run // git rev-parse --abbrev-ref HEAD - + let workspace_dir = Self::workspace_dir(&app_settings).unwrap(); let command = Command::new("git") .args(["rev-parse", "--abbrev-ref", "HEAD"]) - .current_dir(Self::workspace_dir(&app_settings).unwrap()) + .current_dir(workspace_dir) .output() .with_context(|| "Trying to figure out which branch we're on in benchmarking")?; let branch = String::from_utf8(command.stdout)?; @@ -1251,7 +1251,7 @@ impl Xtasks { bencher_cmd .stdout(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit()) - .current_dir(Self::workspace_dir(&app_settings).unwrap()) + .current_dir(workspace_dir) .arg("run") .args(["--project", "bms"]) .args(["--branch", &format!("\"{branch}\"")]) @@ -1277,7 +1277,9 @@ impl Xtasks { .args(["--adapter", "rust_criterion"]) .arg("cargo bench --features=lua54"); - let out = bencher_cmd.output()?; + let out = bencher_cmd + .output() + .with_context(|| "Could not trigger bencher command")?; if !out.status.success() { bail!("Failed to run bencher: {:?}", out); } From e2634119e4499258c6c42f9e7ebcb1831127d422 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 22 Mar 2025 17:55:01 +0000 Subject: [PATCH 2/8] fix --- crates/xtask/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index a78ef7abce..98e60846b2 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -1220,7 +1220,7 @@ impl Xtasks { let workspace_dir = Self::workspace_dir(&app_settings).unwrap(); let command = Command::new("git") .args(["rev-parse", "--abbrev-ref", "HEAD"]) - .current_dir(workspace_dir) + .current_dir(workspace_dir.clone()) .output() .with_context(|| "Trying to figure out which branch we're on in benchmarking")?; let branch = String::from_utf8(command.stdout)?; From afffe39f42f7ba320ff2bcba3fd61b0a6b213202 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 22 Mar 2025 17:58:08 +0000 Subject: [PATCH 3/8] remove explicit directory --- crates/xtask/src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 98e60846b2..08de81a625 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -1251,7 +1251,6 @@ impl Xtasks { bencher_cmd .stdout(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit()) - .current_dir(workspace_dir) .arg("run") .args(["--project", "bms"]) .args(["--branch", &format!("\"{branch}\"")]) From 907f1ab5a9994c370e3b1a94f6fef83c35892064 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 22 Mar 2025 18:20:48 +0000 Subject: [PATCH 4/8] log command --- crates/xtask/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 08de81a625..cbb806f640 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -1276,6 +1276,8 @@ impl Xtasks { .args(["--adapter", "rust_criterion"]) .arg("cargo bench --features=lua54"); + log::info!("Running bencher command: {:?}", bencher_cmd); + let out = bencher_cmd .output() .with_context(|| "Could not trigger bencher command")?; From 67e8fcd14dd6fb80680611ef9f534e776288ac66 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 22 Mar 2025 18:23:57 +0000 Subject: [PATCH 5/8] install bencher in init --- crates/xtask/src/main.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index cbb806f640..2ad56c1357 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -1498,6 +1498,34 @@ impl Xtasks { )?; } + // install bencher + // linux curl --proto '=https' --tlsv1.2 -sSfL https://bencher.dev/download/install-cli.sh | sh + // windows irm https://bencher.dev/download/install-cli.ps1 | iex + + if cfg!(target_os = "windows") { + Self::run_system_command( + &app_settings, + "powershell", + "Failed to install bencher", + vec![ + "-Command", + "irm https://bencher.dev/download/install-cli.ps1 | iex", + ], + None, + )?; + } else { + Self::run_system_command( + &app_settings, + "sh", + "Failed to install bencher", + vec![ + "-c", + "curl --proto '=https' --tlsv1.2 -sSfL https://bencher.dev/download/install-cli.sh | sh", + ], + None, + )?; + } + // install cargo mdbook Self::run_system_command( &app_settings, From b2cf9924face76d92fb40d2d5268bccdf0106b01 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 22 Mar 2025 18:32:07 +0000 Subject: [PATCH 6/8] fix powershell script --- crates/xtask/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 2ad56c1357..4f19acc7a5 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -1508,6 +1508,9 @@ impl Xtasks { "powershell", "Failed to install bencher", vec![ + "-ExecutionPolicy", + "Bypass", + "-NoProfile", "-Command", "irm https://bencher.dev/download/install-cli.ps1 | iex", ], From e260a56ded74821962f356a189e15015ade75a9a Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 22 Mar 2025 18:40:49 +0000 Subject: [PATCH 7/8] change executable to pwsh --- crates/xtask/src/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 4f19acc7a5..2bcbbbb035 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -1505,12 +1505,9 @@ impl Xtasks { if cfg!(target_os = "windows") { Self::run_system_command( &app_settings, - "powershell", + "pwsh", "Failed to install bencher", vec![ - "-ExecutionPolicy", - "Bypass", - "-NoProfile", "-Command", "irm https://bencher.dev/download/install-cli.ps1 | iex", ], From d27a1d7e9f8ead4d91936e76ca16e926253005f1 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 22 Mar 2025 18:42:54 +0000 Subject: [PATCH 8/8] just install from source --- crates/xtask/src/main.rs | 41 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 2bcbbbb035..efba243e01 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -1501,31 +1501,22 @@ impl Xtasks { // install bencher // linux curl --proto '=https' --tlsv1.2 -sSfL https://bencher.dev/download/install-cli.sh | sh // windows irm https://bencher.dev/download/install-cli.ps1 | iex - - if cfg!(target_os = "windows") { - Self::run_system_command( - &app_settings, - "pwsh", - "Failed to install bencher", - vec![ - "-Command", - "irm https://bencher.dev/download/install-cli.ps1 | iex", - ], - None, - )?; - } else { - Self::run_system_command( - &app_settings, - "sh", - "Failed to install bencher", - vec![ - "-c", - "curl --proto '=https' --tlsv1.2 -sSfL https://bencher.dev/download/install-cli.sh | sh", - ], - None, - )?; - } - + Self::run_system_command( + &app_settings, + "cargo", + "Failed to install bencher", + vec![ + "install", + "--git", + "https://github.com/bencherdev/bencher", + "--branch", + "main", + "--locked", + "--force", + "bencher_cli", + ], + None, + )?; // install cargo mdbook Self::run_system_command( &app_settings,