Skip to content

Commit 2f1e30f

Browse files
committed
fix: stop cargo build cache invalidation (#128)
1 parent bdf9b7c commit 2f1e30f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

server/packages/sandbox-agent/build.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ fn main() {
1717

1818
println!("cargo:rerun-if-env-changed=SANDBOX_AGENT_SKIP_INSPECTOR");
1919
println!("cargo:rerun-if-env-changed=SANDBOX_AGENT_VERSION");
20-
println!("cargo:rerun-if-changed={}", dist_dir.display());
20+
let dist_exists = dist_dir.exists();
21+
if dist_exists {
22+
println!("cargo:rerun-if-changed={}", dist_dir.display());
23+
} else {
24+
println!(
25+
"cargo:warning=Inspector frontend missing at {}. Embedding disabled; set SANDBOX_AGENT_SKIP_INSPECTOR=1 to silence or build the inspector to embed it.",
26+
dist_dir.display()
27+
);
28+
}
2129

2230
// Rebuild when the git HEAD changes so BUILD_ID stays current.
2331
let git_head = manifest_dir.join(".git/HEAD");
@@ -36,21 +44,14 @@ fn main() {
3644
generate_version(&out_dir);
3745
generate_build_id(&out_dir);
3846

39-
let skip = env::var("SANDBOX_AGENT_SKIP_INSPECTOR").is_ok();
47+
let skip = env::var("SANDBOX_AGENT_SKIP_INSPECTOR").is_ok() || !dist_exists;
4048
let out_file = out_dir.join("inspector_assets.rs");
4149

4250
if skip {
4351
write_disabled(&out_file);
4452
return;
4553
}
4654

47-
if !dist_dir.exists() {
48-
panic!(
49-
"Inspector frontend missing at {}. Run `pnpm --filter @sandbox-agent/inspector build` (or `pnpm -C frontend/packages/inspector build`) or set SANDBOX_AGENT_SKIP_INSPECTOR=1 to skip embedding.",
50-
dist_dir.display()
51-
);
52-
}
53-
5455
let dist_literal = quote_path(&dist_dir);
5556
let contents = format!(
5657
"pub const INSPECTOR_ENABLED: bool = true;\n\

0 commit comments

Comments
 (0)