fix Generate Flutter Rust bridge
Build RustDesk Android / Build RustDesk Android ARM64 (push) Failing after 3m37s

This commit is contained in:
2026-09-13 15:51:59 +03:00
parent ac78ad6dd4
commit a06ddf4cc8
+69 -19
View File
@@ -706,25 +706,23 @@ jobs:
return "\n".join(body) + "\n"
replacements = {
"${{ env.CARGO_EXPAND_VERSION }}":
"${CARGO_EXPAND_VERSION}",
def replace_expression(body, expression, replacement):
# Match GitHub/Gitea expression syntax without placing a literal
# "${{ ... }}" token inside this workflow. Otherwise Gitea
# expands it before this Python code runs.
pattern = (
r"\$\{\{\s*"
+ re.escape(expression)
+ r"\s*\}\}"
)
"${{env.CARGO_EXPAND_VERSION}}":
"${CARGO_EXPAND_VERSION}",
body, count = re.subn(
pattern,
lambda _match: replacement,
body,
)
"${{ env.FLUTTER_RUST_BRIDGE_VERSION }}":
"${FLUTTER_RUST_BRIDGE_VERSION}",
"${{env.FLUTTER_RUST_BRIDGE_VERSION}}":
"${FLUTTER_RUST_BRIDGE_VERSION}",
"${{ matrix.job.flutter-version }}":
"${BRIDGE_FLUTTER_VERSION}",
"${{matrix.job.flutter-version}}":
"${BRIDGE_FLUTTER_VERSION}",
}
return body, count
for filename, step in (
("bridge-prepare.sh", "Install flutter rust bridge deps"),
@@ -732,8 +730,50 @@ jobs:
):
body = extract_run(step)
for old, new in replacements.items():
body = body.replace(old, new)
body, cargo_expand_count = replace_expression(
body,
"env.CARGO_EXPAND_VERSION",
"${CARGO_EXPAND_VERSION}",
)
body, frb_count = replace_expression(
body,
"env.FLUTTER_RUST_BRIDGE_VERSION",
"${FLUTTER_RUST_BRIDGE_VERSION}",
)
body, flutter_version_count = replace_expression(
body,
"matrix.job.flutter-version",
"${BRIDGE_FLUTTER_VERSION}",
)
if step == "Install flutter rust bridge deps":
if cargo_expand_count < 1:
raise SystemExit(
"Upstream bridge step no longer references "
"CARGO_EXPAND_VERSION"
)
if frb_count < 1:
raise SystemExit(
"Upstream bridge step no longer references "
"FLUTTER_RUST_BRIDGE_VERSION"
)
if flutter_version_count < 1:
raise SystemExit(
"Upstream bridge step no longer references "
"matrix.job.flutter-version"
)
# Fail explicitly if upstream introduces another expression in
# these run blocks that we do not yet translate.
if re.search(r"\$\{\{", body):
raise SystemExit(
f"Unresolved GitHub expression remains in {step}:\\n"
+ body
)
script = Path(filename)
@@ -749,6 +789,16 @@ jobs:
print(f"Generated {filename} from upstream {step!r}")
PY
echo "===== bridge-prepare.sh ====="
cat bridge-prepare.sh
echo
echo "===== bridge-generate.sh ====="
cat bridge-generate.sh
bash -n bridge-prepare.sh
bash -n bridge-generate.sh
./bridge-prepare.sh
./bridge-generate.sh