ci(linux): also prefix Int/Pointer inside NativeFunction<> template args
build-linux / build-linux-x64 (push) Failing after 4m21s
build-windows / build-windows-x64 (push) Successful in 1h9m40s

This commit is contained in:
2026-05-05 19:43:32 +02:00
parent 72770c513c
commit 6fceac39d5
+20
View File
@@ -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.Pointer</g
s/([^A-Za-z0-9_.])Int([> ,)])/\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: |