diff --git a/.github/workflows/template_build.yml b/.github/workflows/template_build.yml index 5df5f0d3..75d3fe3c 100644 --- a/.github/workflows/template_build.yml +++ b/.github/workflows/template_build.yml @@ -48,7 +48,7 @@ jobs: - name: Setup soldr id: setup-soldr # Canary exact setup-soldr main SHA before v0 promotion. - uses: zackees/setup-soldr@a71cd1c92c72f8effbe65862e1440e9627678189 + uses: zackees/setup-soldr@dfbe9627f6cb0226716b61625b99a58949162720 with: # cache-preset: foundation expands to: # build-cache: true, target-cache: false, diff --git a/bench/fastled-examples/src/build_comparison.rs b/bench/fastled-examples/src/build_comparison.rs index fda6a7b8..2981462c 100644 --- a/bench/fastled-examples/src/build_comparison.rs +++ b/bench/fastled-examples/src/build_comparison.rs @@ -11,7 +11,7 @@ use std::env; use std::ffi::{OsStr, OsString}; use std::fs::{self, File}; use std::io::{self, Write}; -use std::path::{Path, PathBuf}; +use std::path::Path; use std::process::{Command, Output}; use std::sync::Mutex; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -423,11 +423,11 @@ fn phase_medians(trials: &[BTreeMap]) -> BTreeMap { } /// Locate the compile DB fbuild wrote for env `uno`. -fn find_compile_db(project_dir: &Path) -> Option { - fn search(dir: &Path) -> Option { +fn find_compile_db(project_dir: &Path) -> Option { + fn search(dir: &Path) -> Option { let candidate = dir.join("compile_commands.json"); if candidate.is_file() { - return Some(candidate); + return Some(NormalizedPath::from(candidate)); } let mut subdirs = fs::read_dir(dir) .ok()? @@ -438,9 +438,9 @@ fn find_compile_db(project_dir: &Path) -> Option { subdirs.sort(); subdirs.iter().find_map(|sub| search(sub)) } - search(&project_dir.join(".fbuild/build/uno")).or_else(|| { + search(&fbuild_paths::get_project_build_root(project_dir).join("uno")).or_else(|| { let fallback = project_dir.join("compile_commands.json"); - fallback.is_file().then_some(fallback) + fallback.is_file().then(|| NormalizedPath::from(fallback)) }) } @@ -575,7 +575,7 @@ fn rewrite_compile_argv(argv: &[String], output: &Path) -> Vec { /// Replay every compile DB entry with the bare compiler across `jobs` threads. fn raw_baseline_ms(entries: &[CompileEntry], jobs: usize) -> AppResult { - let temp = tempfile::TempDir::new()?; + let temp = tempfile::TempDir::new_in(fbuild_paths::temp_subdir("fastled-examples-bench"))?; let next = AtomicUsize::new(0); let failure: Mutex> = Mutex::new(None); let started = Instant::now(); diff --git a/crates/fbuild-build-engine/src/perf_log.rs b/crates/fbuild-build-engine/src/perf_log.rs index b1b4efa7..dc145da9 100644 --- a/crates/fbuild-build-engine/src/perf_log.rs +++ b/crates/fbuild-build-engine/src/perf_log.rs @@ -29,8 +29,9 @@ //! // auto-summary on drop //! ``` +use std::ffi::OsString; use std::io::Write; -use std::path::{Path, PathBuf}; +use std::path::Path; use std::sync::OnceLock; use std::sync::atomic::{AtomicBool, Ordering}; use std::time::{Duration, Instant}; @@ -57,13 +58,12 @@ pub fn enabled() -> bool { /// /// Cached after the first call. pub fn json_sink_path() -> Option<&'static Path> { - static SINK: OnceLock> = OnceLock::new(); - SINK.get_or_init(|| { - std::env::var_os("FBUILD_PERF_LOG_JSON") - .filter(|v| !v.is_empty()) - .map(PathBuf::from) - }) - .as_deref() + // Keep the raw value: lexical normalization would resolve `..` across + // symlinks and could open a different file than the caller named. + static SINK: OnceLock> = OnceLock::new(); + SINK.get_or_init(|| std::env::var_os("FBUILD_PERF_LOG_JSON").filter(|v| !v.is_empty())) + .as_ref() + .map(Path::new) } /// Append `value` as a single JSON line to `path` (append + create).