ci(linux): also prefix Int/Pointer inside NativeFunction<> template args
This commit is contained in:
@@ -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: |
|
||||
|
||||
Reference in New Issue
Block a user