diff --git a/.gitea/workflows/build-windows.yml b/.gitea/workflows/build-windows.yml index b2e34520f..7cc6beb8c 100644 --- a/.gitea/workflows/build-windows.yml +++ b/.gitea/workflows/build-windows.yml @@ -13,6 +13,9 @@ on: env: RUST_VERSION: "1.75" LLVM_VERSION: "15.0.6" + # Where provision.ps1 installs LLVM. ffigen and flutter_rust_bridge_codegen need + # the install root (they append bin\libclang.dll themselves). + LLVM_HOME: 'C:\tools\llvm-15.0.6' FLUTTER_VERSION: "3.24.5" VCPKG_COMMIT_ID: "120deac3062162151622ca4860575a33844ba10b" CARGO_EXPAND_VERSION: "1.0.95" @@ -121,13 +124,27 @@ jobs: - name: Generate Rust <-> Dart bridge shell: bash + 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: | # Belt-and-suspenders: also prepend cargo-tools to PATH here, in case # GITHUB_PATH propagation from the previous step doesn't take effect. export PATH="/c/cargo-tools/bin:$PATH" command -v flutter_rust_bridge_codegen || { echo "tool not on PATH; PATH=$PATH"; exit 1; } + + if [ ! -f "${LIBCLANG_PATH}/libclang.dll" ]; then + echo "libclang.dll not found at ${LIBCLANG_PATH}" + ls "${LIBCLANG_PATH}" || true + exit 1 + fi + pushd flutter && flutter pub get && popd flutter_rust_bridge_codegen \ + --llvm-path "${LLVM_HOME}" \ --rust-input ./src/flutter_ffi.rs \ --dart-output ./flutter/lib/generated_bridge.dart \ --c-output ./flutter/macos/Runner/bridge_generated.h