Добавить flutter_rust_bridge codegen перед сборкой

RustDesk не коммитит src/bridge_generated.rs -> cargo build падал
E0583/E0277. Встроил шаг codegen (FRB 1.80.1 + cargo-expand 1.0.95,
RUSTC_BOOTSTRAP=1) в build-windows.ps1; пины в upstream.txt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 15:09:39 +03:00
parent 0e58a15f28
commit 08321338d9
3 changed files with 38 additions and 0 deletions
+20
View File
@@ -92,6 +92,26 @@ $preBash = ("$root/scripts/preconfigure.sh") -replace '\\','/'
if ($LASTEXITCODE) { throw "preconfigure.sh упал ($LASTEXITCODE)" }
if ($SkipBuild) { Write-Host "SkipBuild — стоп после preconfigure." -ForegroundColor Yellow; return }
# --- flutter_rust_bridge codegen ---
# RustDesk НЕ коммитит src/bridge_generated.rs — его генерит flutter_rust_bridge_codegen.
# Без него cargo build падает: E0583 (нет модуля bridge_generated) + E0277 (EventToUI: IntoIntoDart).
Write-Host "flutter_rust_bridge codegen..." -ForegroundColor Cyan
Push-Location $src
$env:RUSTC_BOOTSTRAP = '1' # cargo-expand требует nightly-фич; на stable — через RUSTC_BOOTSTRAP
# Инструменты собираем stable-тулчейном (1.75 может не собрать свежие tool-крейты); бинарь standalone.
if (-not (Get-Command cargo-expand -EA SilentlyContinue)) {
cargo +stable install cargo-expand --version $pins['CARGO_EXPAND_VERSION'] --locked
}
$frb = Join-Path $env:USERPROFILE '.cargo\bin\flutter_rust_bridge_codegen.exe'
if (-not (Test-Path $frb)) {
cargo +stable install flutter_rust_bridge_codegen --version $pins['FRB_VERSION'] --features uuid --locked
}
Push-Location flutter; flutter pub get; Pop-Location
& $frb --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart --c-output ./flutter/macos/Runner/bridge_generated.h
if (-not (Test-Path 'src/bridge_generated.rs')) { Pop-Location; throw "codegen не создал src/bridge_generated.rs" }
Write-Host " bridge_generated.rs создан." -ForegroundColor Green
Pop-Location
# --- vcpkg install (манифест из vcpkg.json; первый раз долго: ffmpeg/aom) ---
Write-Host "vcpkg install ($TRIPLET) — первый раз ОЧЕНЬ долго (ffmpeg/aom из исходников)..." -ForegroundColor Cyan
Push-Location $src