ci(windows): switch bridge codegen step to pwsh to dodge msys path conversion
build-windows / build-windows-x64 (push) Failing after 1h0m27s

This commit is contained in:
2026-05-05 07:13:31 +02:00
parent 34a83b2b40
commit 8850a01b0c
+30 -31
View File
@@ -123,47 +123,46 @@ jobs:
Add-Content -Path $env:GITHUB_PATH -Value "$tools\bin"
- name: Generate Rust <-> Dart bridge
shell: bash
# Run in pwsh, NOT bash. Git-Bash-on-Windows mangles entries like
# `C:\Program Files\Git\cmd` during MSYS PATH conversion -- when bash
# spawns dart.exe, dart sees a malformed PATH and `pub` fails with
# "Unable to find git in your PATH" even though `which git` works in bash.
shell: pwsh
env:
# ffigen searches a hardcoded list of locations for libclang.dll and does
# not honor LIBCLANG_PATH; the --llvm-path flag below is what matters.
# Setting LIBCLANG_PATH anyway because some other Rust crates (e.g. bindgen)
# do read it during the build that follows.
LIBCLANG_PATH: '${{ env.LLVM_HOME }}\bin'
run: |
set -e
$ErrorActionPreference = 'Stop'
# Belt-and-suspenders: explicitly prepend the dirs we need so we don't
# depend on whatever PATH act_runner hands the bash step. Forward-slash
# form is what MSYS bash expects.
export PATH="/c/cargo-tools/bin:/c/Program Files/Git/cmd:/c/Program Files/Git/bin:$PATH"
# Belt-and-suspenders for the cargo-installed tools.
$env:PATH = "C:\cargo-tools\bin;$env:PATH"
echo "== PATH visibility check =="
echo "PATH=$PATH"
echo
echo "which git -> $(which git 2>&1 || echo MISSING)"
echo "which git.exe -> $(which git.exe 2>&1 || echo MISSING)"
echo "which flutter -> $(which flutter 2>&1 || echo MISSING)"
echo "which flutter_rust_bridge_codegen -> $(which flutter_rust_bridge_codegen 2>&1 || echo MISSING)"
echo "git --version -> $(git --version 2>&1 || echo FAILED)"
echo
Write-Host "== PATH visibility check =="
foreach ($t in 'git','flutter','flutter_rust_bridge_codegen','dart') {
$cmd = Get-Command $t -ErrorAction SilentlyContinue
if ($cmd) { Write-Host ("{0,-30} {1}" -f $t, $cmd.Source) }
else { Write-Host ("{0,-30} MISSING" -f $t) }
}
Write-Host ("git --version -> " + ((git --version) 2>&1))
if [ ! -f "${LIBCLANG_PATH}/libclang.dll" ]; then
echo "libclang.dll not found at ${LIBCLANG_PATH}"
ls "${LIBCLANG_PATH}" || true
exit 1
fi
if (-not (Test-Path "$env:LIBCLANG_PATH\libclang.dll")) {
throw "libclang.dll not found at $env:LIBCLANG_PATH"
}
pushd flutter
Push-Location flutter
flutter pub get
popd
if ($LASTEXITCODE -ne 0) { throw "flutter pub get failed ($LASTEXITCODE)" }
Pop-Location
flutter_rust_bridge_codegen \
--llvm-path "${LLVM_HOME}" \
--rust-input ./src/flutter_ffi.rs \
--dart-output ./flutter/lib/generated_bridge.dart \
flutter_rust_bridge_codegen `
--llvm-path "$env:LLVM_HOME" `
--rust-input ./src/flutter_ffi.rs `
--dart-output ./flutter/lib/generated_bridge.dart `
--c-output ./flutter/macos/Runner/bridge_generated.h
cp ./flutter/macos/Runner/bridge_generated.h ./flutter/ios/Runner/bridge_generated.h
if ($LASTEXITCODE -ne 0) { throw "flutter_rust_bridge_codegen failed ($LASTEXITCODE)" }
Copy-Item -Force `
./flutter/macos/Runner/bridge_generated.h `
./flutter/ios/Runner/bridge_generated.h
- name: Replace Flutter engine with rustdesk custom engine
shell: pwsh