Codegen: указать --llvm-path для ffigen (LLVM на S:)

ffigen внутри flutter_rust_bridge_codegen не находил libclang.dll
(дефолтные пути вроде C:/Program Files/llvm), LLVM у нас на S:\dev\LLVM.
Передаём --llvm-path <корень LLVM> из LIBCLANG_PATH.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 15:21:25 +03:00
parent 040406883f
commit a09ae6b913
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -49,7 +49,8 @@ cargo +stable install cargo-expand --version 1.0.95 --locked
cargo +stable install flutter_rust_bridge_codegen --version 1.80.1 --features uuid --locked cargo +stable install flutter_rust_bridge_codegen --version 1.80.1 --features uuid --locked
pushd flutter && flutter pub get && popd pushd flutter && flutter pub get && popd
RUSTC_BOOTSTRAP=1 flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs \ RUSTC_BOOTSTRAP=1 flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs \
--dart-output ./flutter/lib/generated_bridge.dart --c-output ./flutter/macos/Runner/bridge_generated.h --dart-output ./flutter/lib/generated_bridge.dart --c-output ./flutter/macos/Runner/bridge_generated.h \
--llvm-path S:/dev/LLVM # ffigen ищет libclang.dll в дефолтных путях, LLVM у нас на S:
``` ```
Пины FRB_VERSION/CARGO_EXPAND_VERSION — в `upstream.txt`. Шаг встроен в `build-windows.ps1` перед build.py. Пины FRB_VERSION/CARGO_EXPAND_VERSION — в `upstream.txt`. Шаг встроен в `build-windows.ps1` перед build.py.
RUSTC_BOOTSTRAP=1 нужен, т.к. cargo-expand требует nightly-фич, а тулчейн 1.75 stable. RUSTC_BOOTSTRAP=1 нужен, т.к. cargo-expand требует nightly-фич, а тулчейн 1.75 stable.
+3 -1
View File
@@ -110,7 +110,9 @@ if (-not (Test-Path $frb)) {
cargo +stable install flutter_rust_bridge_codegen --version $pins['FRB_VERSION'] --features uuid --locked cargo +stable install flutter_rust_bridge_codegen --version $pins['FRB_VERSION'] --features uuid --locked
} }
Push-Location flutter; flutter pub get; Pop-Location 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 # ffigen (внутри codegen) ищет libclang.dll в дефолтных путях -> явно указываем корень LLVM (S:\dev\LLVM).
$llvmRoot = (Split-Path $env:LIBCLANG_PATH) -replace '\\','/'
& $frb --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart --c-output ./flutter/macos/Runner/bridge_generated.h --llvm-path $llvmRoot
$frbRc = $LASTEXITCODE $frbRc = $LASTEXITCODE
# Проверяем ОБЕ стороны: rust + dart (+ freezed). rust-файл создаётся до dart, поэтому одного его мало. # Проверяем ОБЕ стороны: rust + dart (+ freezed). rust-файл создаётся до dart, поэтому одного его мало.
$genOk = ($frbRc -eq 0) -and (Test-Path 'src/bridge_generated.rs') -and (Test-Path 'flutter/lib/generated_bridge.dart') -and (Test-Path 'flutter/lib/generated_bridge.freezed.dart') $genOk = ($frbRc -eq 0) -and (Test-Path 'src/bridge_generated.rs') -and (Test-Path 'flutter/lib/generated_bridge.dart') -and (Test-Path 'flutter/lib/generated_bridge.freezed.dart')