使用用户配置路径探测 sccache

Windows wrapper 探测改用显式配置的可执行路径

将 wrapper 路径纳入探测缓存键
This commit is contained in:
2026-09-14 08:58:31 +00:00
committed by 孔令弘
parent cf4a275d26
commit b7100c7188
+4 -4
View File
@@ -148,7 +148,7 @@ function applyLocalFfmpegEnv(env, platform = process.platform) {
const localSccacheProbeCache = new Map();
function resolveLocalDevRustcWrapperBypass(options = {}) {
function resolveLocalDevRustcWrapperBypass(configuredWrapper, options = {}) {
if (process.platform !== 'win32') {
return '/usr/bin/env';
}
@@ -156,13 +156,13 @@ function resolveLocalDevRustcWrapperBypass(options = {}) {
const sccacheAvailable =
options.sccacheAvailable ??
(() => {
const cacheKey = `${process.platform}:sccache`;
const cacheKey = `${process.platform}:${configuredWrapper}`;
const cached = localSccacheProbeCache.get(cacheKey);
if (cached !== undefined) {
return cached;
}
const result = spawnSync('sccache', ['rustc', '-vV'], {
const result = spawnSync(configuredWrapper, ['rustc', '-vV'], {
cwd: repoRoot,
encoding: 'utf8',
shell: true,
@@ -628,7 +628,7 @@ function buildLocalRustProcessEnv(env, options = {}) {
}
const rustcWrapper = configuredWrapper
? resolveLocalDevRustcWrapperBypass(options)
? resolveLocalDevRustcWrapperBypass(configuredWrapper, options)
: '';
mergedEnv.RUSTC_WRAPPER = rustcWrapper;
mergedEnv.CARGO_BUILD_RUSTC_WRAPPER = rustcWrapper;