ci(windows): stage git.exe next to dart.exe; show all git matches
build-windows / build-windows-x64 (push) Failing after 1h0m49s
build-windows / build-windows-x64 (push) Failing after 1h0m49s
This commit is contained in:
@@ -123,36 +123,55 @@ jobs:
|
||||
Add-Content -Path $env:GITHUB_PATH -Value "$tools\bin"
|
||||
|
||||
- name: Generate Rust <-> Dart bridge
|
||||
# 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:
|
||||
LIBCLANG_PATH: '${{ env.LLVM_HOME }}\bin'
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Belt-and-suspenders for the cargo-installed tools.
|
||||
$env:PATH = "C:\cargo-tools\bin;$env:PATH"
|
||||
# Force-prepend cargo-tools and Git so they win the lookup race even if
|
||||
# something earlier in PATH owns the same name.
|
||||
$env:PATH = "C:\cargo-tools\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\bin;$env:PATH"
|
||||
|
||||
Write-Host "== PATH visibility check =="
|
||||
Write-Host "== Tool resolution =="
|
||||
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))
|
||||
|
||||
# `where git` shows ALL git.exe matches on PATH. If multiple, the first
|
||||
# is what CreateProcess will pick -- and it might be a broken shim.
|
||||
Write-Host "`n== where git =="
|
||||
where.exe git 2>&1
|
||||
|
||||
Write-Host "`n== git --version =="
|
||||
git --version
|
||||
|
||||
# Workaround: stage git.exe next to dart.exe. CreateProcessW searches
|
||||
# the calling exe's directory before PATH -- so dropping git.exe here
|
||||
# bypasses any PATH oddities the dart child may inherit from its
|
||||
# parents (powershell -> cmd -> flutter.bat -> dart.exe).
|
||||
$dartBin = 'C:\tools\flutter\bin\cache\dart-sdk\bin'
|
||||
$stagedGit = Join-Path $dartBin 'git.exe'
|
||||
$sourceGit = 'C:\Program Files\Git\cmd\git.exe'
|
||||
if ((Test-Path $dartBin) -and -not (Test-Path $stagedGit)) {
|
||||
Write-Host "`nStaging $sourceGit -> $stagedGit"
|
||||
Copy-Item -Force $sourceGit $stagedGit
|
||||
}
|
||||
|
||||
if (-not (Test-Path "$env:LIBCLANG_PATH\libclang.dll")) {
|
||||
throw "libclang.dll not found at $env:LIBCLANG_PATH"
|
||||
}
|
||||
|
||||
Write-Host "`n== flutter pub get =="
|
||||
Push-Location flutter
|
||||
flutter pub get
|
||||
if ($LASTEXITCODE -ne 0) { throw "flutter pub get failed ($LASTEXITCODE)" }
|
||||
$rc = $LASTEXITCODE
|
||||
Pop-Location
|
||||
if ($rc -ne 0) { throw "flutter pub get failed ($rc)" }
|
||||
|
||||
Write-Host "`n== flutter_rust_bridge_codegen =="
|
||||
flutter_rust_bridge_codegen `
|
||||
--llvm-path "$env:LLVM_HOME" `
|
||||
--rust-input ./src/flutter_ffi.rs `
|
||||
|
||||
Reference in New Issue
Block a user