diff --git a/jenkins/Jenkinsfile.production-stdb-module-build b/jenkins/Jenkinsfile.production-stdb-module-build index 6a409e9e..2e5f7975 100644 --- a/jenkins/Jenkinsfile.production-stdb-module-build +++ b/jenkins/Jenkinsfile.production-stdb-module-build @@ -79,17 +79,33 @@ pipeline { if (-not (Get-Command bash -ErrorAction SilentlyContinue)) { throw '[stdb-build] Windows 构建节点缺少 bash,无法执行仓库现有生产构建脚本。请先安装 Git Bash 或 WSL bash,并确保 bash 在 PATH 中。' } + function Convert-ToMsysPath([string]$Path) { + if ([string]::IsNullOrWhiteSpace($Path)) { + return $Path + } + $normalized = $Path -replace '\\', '/' + if ($normalized -match '^([A-Za-z]):/(.*)$') { + return '/' + $matches[1].ToLower() + '/' + $matches[2] + } + return $normalized + } + $bashCargoHome = Convert-ToMsysPath $env:CARGO_HOME + $bashCargoTargetDir = Convert-ToMsysPath $env:CARGO_TARGET_DIR + $bashSccacheDir = Convert-ToMsysPath $env:SCCACHE_DIR + $bashRustupHome = Convert-ToMsysPath $env:RUSTUP_HOME + $bashWorkspace = Convert-ToMsysPath $env:WORKSPACE $bashScript = @" set -euo pipefail - export CARGO_HOME='$($env:CARGO_HOME)' - export CARGO_TARGET_DIR='$($env:CARGO_TARGET_DIR)' - export SCCACHE_DIR='$($env:SCCACHE_DIR)' + export CARGO_HOME='$bashCargoHome' + export CARGO_TARGET_DIR='$bashCargoTargetDir' + export SCCACHE_DIR='$bashSccacheDir' + export RUSTUP_HOME='$bashRustupHome' + export WORKSPACE='$bashWorkspace' export CARGO_INCREMENTAL='$($env:CARGO_INCREMENTAL)' export RUSTC_WRAPPER='$($env:RUSTC_WRAPPER)' export SCCACHE_CACHE_SIZE='$($env:SCCACHE_CACHE_SIZE)' export SOURCE_BRANCH='$($env:SOURCE_BRANCH)' export SOURCE_COMMIT='$($env:SOURCE_COMMIT)' - export EFFECTIVE_BUILD_VERSION='$effectiveBuildVersion' chmod +x scripts/jenkins-prepare-cargo-env.sh source scripts/jenkins-prepare-cargo-env.sh if ! command -v cargo >/dev/null 2>&1; then