plugin: log build.rs bridge-file presence; use manifest dir for robust path

This commit is contained in:
Damocles 2026-05-04 00:27:34 +02:00
parent fa861a4399
commit 78abe800ed

View file

@ -26,8 +26,17 @@ fn main() {
// Crane's deps-only build stubs out lib.rs and removes our bridge sources to
// build a dummy crate that only compiles dependencies. Skip cxx-qt codegen in
// that case - we just want cxx-qt-lib (the heavy dep) cached, not our own glue.
// Use CARGO_MANIFEST_DIR for a robust path that doesn't depend on cargo's CWD.
let manifest = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
let bridge_files = ["src/system_stats.rs", "src/cpu_service.rs"];
if !bridge_files.iter().all(|p| std::path::Path::new(p).exists()) {
let present: Vec<bool> = bridge_files
.iter()
.map(|p| manifest.join(p).exists())
.collect();
println!("cargo:warning=build.rs manifest_dir={}", manifest.display());
println!("cargo:warning=build.rs bridge_files present: {present:?}");
if !present.iter().all(|b| *b) {
println!("cargo:warning=build.rs bailing: bridge files missing (deps-only build?)");
return;
}