diff --git a/.gitea/workflows/build-linux.yml b/.gitea/workflows/build-linux.yml index a3b7b850c..458578d85 100644 --- a/.gitea/workflows/build-linux.yml +++ b/.gitea/workflows/build-linux.yml @@ -172,25 +172,38 @@ 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). + # Second 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. 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" + + # Third bug: codegen emits `ffi.Pointer` (lowercase Dart bool, + # which isn't a NativeType) instead of `ffi.Pointer` (the + # FFI Bool marker type that satisfies Pointer's bound). Same for any + # `ffi.Pointer` variants if they appear (defensive). This also + # has to NOT touch `bool` outside Pointer<>. + sed -i 's/ffi\.Pointer/ffi.Pointer/g' flutter/lib/generated_bridge.dart + + # Fourth bug: the wire class's override of store_dart_post_cobject has + # parameter type `int` (web/stub form) but the active native parent + # in flutter_rust_bridge expects + # Pointer)>> + # The internal _lookup is `Void Function(Int)` so we pass ptr.address. + # Confine the substitution to the lines between `void + # store_dart_post_cobject(` and the closing `);` to avoid touching + # other functions. + sed -i '/void store_dart_post_cobject(/,/);/ { + s| int ptr,| ffi.Pointer)>> ptr,| + s| ptr,| ptr.address,| + }' flutter/lib/generated_bridge.dart + + echo "Applied flutter_rust_bridge 1.80.1 Linux-output workarounds (4 patches)" - name: Diagnose generated bridge files shell: bash