diff --git a/.gitea/workflows/build-linux.yml b/.gitea/workflows/build-linux.yml index 458578d85..eb26182f6 100644 --- a/.gitea/workflows/build-linux.yml +++ b/.gitea/workflows/build-linux.yml @@ -26,10 +26,10 @@ env: jobs: build-x64: name: build-linux-x64 - # Distro-agnostic: any Linux runner provisioned by ci/runners/linux/provision.sh - # carries `self-hosted`, `Linux`, `X64`. To target a specific distro - # (e.g. force Debian 13), append its label: [self-hosted, Linux, X64, debian-13]. - runs-on: [self-hosted, Linux, X64] + # Pinned to ubuntu-22.04 because flutter_rust_bridge_codegen 1.80.1 emits + # broken Dart on Debian 13 (matches upstream rustdesk's bridge.yml host). + # provision.sh tags Ubuntu 22.04 hosts with the `ubuntu-22.04` label. + runs-on: [self-hosted, Linux, X64, ubuntu-22.04] timeout-minutes: 240 env: VCPKG_ROOT: /opt/vcpkg @@ -146,65 +146,6 @@ jobs: (cd flutter && git checkout -- pubspec.yaml) (cd flutter && /opt/flutter/bin/flutter pub get) - # ============================================================ - # CRITICAL FIX for flutter_rust_bridge_codegen 1.80.1 on Linux - # ============================================================ - # flutter_rust_bridge_codegen 1.80.1 emits a stray - # typedef bool = ffi.NativeFunction)>; - # line near the end of generated_bridge.dart on Linux (the Windows - # generation does not hit this codepath). That typedef shadows - # dart:core.bool for the whole library AND every part file (notably - # generated_bridge.freezed.dart), corrupting every `bool` reference in - # the codebase. Symptoms include: - # - "Type 'Int' not found" / "Type 'Pointer' not found" in .freezed.dart - # - "value of type 'bool' can't be assigned to NativeFunction<...>" - # in every model file - # - the wire class's `int ptr` mismatching its parent's - # Pointer> type - # - # Drop the line. References to `bool` then resolve to dart:core.bool - # as every line of source code actually intends. - sed -i '/^typedef bool = /d' flutter/lib/generated_bridge.dart - if grep -n '^typedef bool = ' flutter/lib/generated_bridge.dart >/dev/null; then - echo "ERROR: stray 'typedef bool' still present in generated_bridge.dart" >&2 - grep -n '^typedef bool = ' flutter/lib/generated_bridge.dart >&2 - exit 1 - fi - echo "Stripped stray 'typedef bool = ...' line from generated_bridge.dart" - - # 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" - done - - # 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 run: |