支持 Windows 本地 sccache 自动回退

Windows 本地开发检测可用的 sccache 并启用缓存

未安装或不可执行时清空 Rust wrapper 并回退到 rustc

补充测试并更新开发运维文档
This commit is contained in:
2026-09-14 05:20:11 +00:00
committed by 孔令弘
parent 2566ae705f
commit dcaa1a2dd5
3 changed files with 27 additions and 12 deletions
+5 -6
View File
@@ -657,17 +657,16 @@ describe('dev scheduler local worker cleanup', () => {
});
describe('dev scheduler Rust build env', () => {
test('local dev Rust env bypasses project sccache wrapper', () => {
test('local dev Rust env enables available sccache wrapper', () => {
const env = buildLocalRustProcessEnv(
{
RUSTC_WRAPPER: '/usr/bin/sccache',
CARGO_BUILD_RUSTC_WRAPPER: 'sccache',
},
{ log: false },
{ log: false, sccacheAvailable: true },
);
expect(env.RUSTC_WRAPPER).not.toBe('/usr/bin/sccache');
expect(env.RUSTC_WRAPPER).not.toBe('sccache');
expect(env.RUSTC_WRAPPER).toBe('sccache');
expect(env.CARGO_BUILD_RUSTC_WRAPPER).toBe(env.RUSTC_WRAPPER);
});
@@ -684,7 +683,7 @@ describe('dev scheduler Rust build env', () => {
expect(env.CARGO_BUILD_RUSTC_WRAPPER).toBe('custom-wrapper');
});
test('Windows 下本地 dev Rust env 用空 wrapper 覆盖项目 sccache', () => {
test('Windows 下未安装 sccache 时回退到空 wrapper', () => {
const originalPlatform = Object.getOwnPropertyDescriptor(
process,
'platform',
@@ -700,7 +699,7 @@ describe('dev scheduler Rust build env', () => {
RUSTC_WRAPPER: 'sccache',
CARGO_BUILD_RUSTC_WRAPPER: 'sccache',
},
{ log: false },
{ log: false, sccacheAvailable: false },
);
expect(env.RUSTC_WRAPPER).toBe('');