From 6fceac39d5e40a705cfaee2464423eb5cc1e6776 Mon Sep 17 00:00:00 2001 From: Mike Mueller Date: Tue, 5 May 2026 19:43:32 +0200 Subject: [PATCH] ci(linux): also prefix Int/Pointer inside NativeFunction<> template args --- .gitea/workflows/build-linux.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.gitea/workflows/build-linux.yml b/.gitea/workflows/build-linux.yml index 87f5f2b7c..a3b7b850c 100644 --- a/.gitea/workflows/build-linux.yml +++ b/.gitea/workflows/build-linux.yml @@ -172,6 +172,26 @@ jobs: fi echo "Stripped stray 'typedef bool = ...' line from generated_bridge.dart" + # Second flutter_rust_bridge_codegen 1.80.1 bug: inside + # `ffi.NativeFunction<...>` template arguments, inner FFI types + # `Int` and `Pointer` are emitted without the `ffi.` prefix that the + # parent file's `import 'dart:ffi' as ffi;` requires. Patch both the + # main bridge file (where the source class field declarations live) + # and the freezed part file (which copies those field types verbatim). + for f in flutter/lib/generated_bridge.dart flutter/lib/generated_bridge.freezed.dart; do + [ -f "$f" ] || continue + sed -i -E ' + s/([^A-Za-z0-9_.])Pointer ,)])/\1ffi.Int\2/g + ' "$f" + # Sanity check + if grep -nE '[<,( ]Int[ >,)]|[<,( ]Pointer<' "$f" >/dev/null; then + echo "WARNING: $f still has unprefixed FFI types after patch:" >&2 + grep -nE '[<,( ]Int[ >,)]|[<,( ]Pointer<' "$f" | head >&2 + fi + done + echo "Prefixed unqualified Int/Pointer in NativeFunction template args" + - name: Diagnose generated bridge files shell: bash run: |