Keep local Rust dev builds on debug
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
kdletters
2026-05-10 04:29:20 +08:00
parent 1767bed609
commit fc54bff62f
9 changed files with 22 additions and 21 deletions

View File

@@ -2,7 +2,7 @@
## 背景
Windows 本地执行 `npm run dev:rust``spacetime publish` 时,`spacetime` 会在内部调用 Cargo 构建 `server-rs/crates/spacetime-module`。因为 `server-rs/.cargo/config.toml` 配置了 `rustc-wrapper = "sccache"`,即使当前 shell 没有设置 `RUSTC_WRAPPER`Cargo 仍会先执行 `sccache rustc -vV`
Windows 本地执行 `npm run dev:rust``spacetime publish` 时,`spacetime` 会在内部调用 Cargo 构建 `server-rs/crates/spacetime-module`当前本地开发 publish 会追加 `--build-options="--debug"`,让 SpacetimeDB CLI 用 debug 构建参数编译模块。因为 `server-rs/.cargo/config.toml` 配置了 `rustc-wrapper = "sccache"`,即使当前 shell 没有设置 `RUSTC_WRAPPER`Cargo 仍会先执行 `sccache rustc -vV`
当本机 sccache server 状态损坏、client/server 通信异常或版本残留不一致时,可能出现:
@@ -17,9 +17,9 @@ sccache: caused by: failed to fill whole buffer
## 本地开发处理
`scripts/dev-rust-stack.sh` 的 publish 阶段保留首次正常 `sccache` 构建;如果 stderr 命中 sccache 通信或 wrapper 失败特征,则自动在同一 `--root-dir`、同一发布参数下清空本次子进程的 `RUSTC_WRAPPER``CARGO_BUILD_RUSTC_WRAPPER` 后重试
`scripts/dev-rust-stack.sh` 的 publish 阶段继续由 SpacetimeDB CLI 内部调用 Cargo并通过 `--build-options="--debug"` 使用 debug 构建参数。遇到 sccache 通信或 wrapper 失败时,本地排障仍优先绕过 wrapper 验证 rustc 本身可用
该处理只影响本次 publish 子进程,不修改 `server-rs/.cargo/config.toml`,也不删除本地 target 缓存。
该处理不修改 `server-rs/.cargo/config.toml`,也不删除本地 target 缓存。
## 手动排障命令
@@ -33,7 +33,7 @@ rustc -vV
```bash
cd server-rs/crates/spacetime-module
RUSTC_WRAPPER= CARGO_BUILD_RUSTC_WRAPPER= cargo build --target=wasm32-unknown-unknown --release
RUSTC_WRAPPER= CARGO_BUILD_RUSTC_WRAPPER= cargo check --target=wasm32-unknown-unknown
```
如果需要排查 sccache server 状态:
@@ -49,5 +49,5 @@ sccache --start-server
## 验证
1. `bash -n scripts/dev-rust-stack.sh`
2. `RUSTC_WRAPPER= CARGO_BUILD_RUSTC_WRAPPER= cargo check --target=wasm32-unknown-unknown --release`
3. 重新运行 `npm run dev:rust`看到 sccache 通信失败时脚本应打印降级提示并继续真实构建
2. `RUSTC_WRAPPER= CARGO_BUILD_RUSTC_WRAPPER= cargo check --target=wasm32-unknown-unknown`
3. 重新运行 `npm run dev:rust`确认 publish 命令带有 `--build-options="--debug"`