ci(linux): revert fix for ubunutu
build-linux / build-linux-x64 (push) Failing after 9m32s
build-windows / build-windows-x64 (push) Successful in 1h9m44s

This commit is contained in:
2026-05-05 22:08:50 +02:00
parent c4bb9e1b5d
commit b83b2a1ec7
+4 -63
View File
@@ -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<ffi.Int Function(ffi.Pointer<ffi.Int>)>;
# 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<NativeFunction<Bool ...>> 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.Pointer</g
s/([^A-Za-z0-9_.])Int([> ,)])/\1ffi.Int\2/g
' "$f"
done
# Third bug: codegen emits `ffi.Pointer<bool>` (lowercase Dart bool,
# which isn't a NativeType) instead of `ffi.Pointer<ffi.Bool>` (the
# FFI Bool marker type that satisfies Pointer's bound). Same for any
# `ffi.Pointer<bool*>` variants if they appear (defensive). This also
# has to NOT touch `bool` outside Pointer<>.
sed -i 's/ffi\.Pointer<bool>/ffi.Pointer<ffi.Bool>/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<NativeFunction<Bool Function(Int64, Pointer<Void>)>>
# 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<ffi.NativeFunction<ffi.Bool Function(ffi.Int64, ffi.Pointer<ffi.Void>)>> 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: |