fix Generate Flutter Rust bridge
Build RustDesk Android / Build RustDesk Android ARM64 (push) Failing after 3m37s
Build RustDesk Android / Build RustDesk Android ARM64 (push) Failing after 3m37s
This commit is contained in:
1 file changed
+69
-19
@@ -706,25 +706,23 @@ jobs:
|
|||||||
|
|
||||||
return "\n".join(body) + "\n"
|
return "\n".join(body) + "\n"
|
||||||
|
|
||||||
replacements = {
|
def replace_expression(body, expression, replacement):
|
||||||
"${{ env.CARGO_EXPAND_VERSION }}":
|
# Match GitHub/Gitea expression syntax without placing a literal
|
||||||
"${CARGO_EXPAND_VERSION}",
|
# "${{ ... }}" 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}}":
|
body, count = re.subn(
|
||||||
"${CARGO_EXPAND_VERSION}",
|
pattern,
|
||||||
|
lambda _match: replacement,
|
||||||
|
body,
|
||||||
|
)
|
||||||
|
|
||||||
"${{ env.FLUTTER_RUST_BRIDGE_VERSION }}":
|
return body, count
|
||||||
"${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}",
|
|
||||||
}
|
|
||||||
|
|
||||||
for filename, step in (
|
for filename, step in (
|
||||||
("bridge-prepare.sh", "Install flutter rust bridge deps"),
|
("bridge-prepare.sh", "Install flutter rust bridge deps"),
|
||||||
@@ -732,8 +730,50 @@ jobs:
|
|||||||
):
|
):
|
||||||
body = extract_run(step)
|
body = extract_run(step)
|
||||||
|
|
||||||
for old, new in replacements.items():
|
body, cargo_expand_count = replace_expression(
|
||||||
body = body.replace(old, new)
|
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)
|
script = Path(filename)
|
||||||
|
|
||||||
@@ -749,6 +789,16 @@ jobs:
|
|||||||
print(f"Generated {filename} from upstream {step!r}")
|
print(f"Generated {filename} from upstream {step!r}")
|
||||||
PY
|
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-prepare.sh
|
||||||
./bridge-generate.sh
|
./bridge-generate.sh
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user