From 9f131e71137e49c4ff150892e485104a78f1ff13 Mon Sep 17 00:00:00 2001 From: Mike Mueller Date: Mon, 4 May 2026 22:00:39 +0200 Subject: [PATCH] ci(windows): split build into cargo + flutter; restore flutter/windows between --- .gitea/workflows/build-windows.yml | 52 ++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build-windows.yml b/.gitea/workflows/build-windows.yml index 0042cf6e2..cbdb66400 100644 --- a/.gitea/workflows/build-windows.yml +++ b/.gitea/workflows/build-windows.yml @@ -212,11 +212,57 @@ jobs: fi fi - - name: Build RustDesk (build.py --portable --hwcodec --flutter --vram) + # The monolithic `python build.py` invocation that the upstream GitHub + # workflow uses runs cargo and `flutter build windows` back-to-back. On this + # self-hosted runner, *something* during the ~14min cargo build wipes out + # flutter/windows, which then makes the subsequent flutter build fail with + # "source directory does not exist" -- even though the diagnostic step + # immediately above confirms the dir is fully present at that moment. + # Splitting the build into discrete steps lets us restore flutter/windows + # right before flutter needs it, after cargo has finished. + + - name: Cargo build (virtual_display dylib + main lib) shell: pwsh run: | - python .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack - Move-Item -Force .\flutter\build\windows\x64\runner\Release .\rustdesk + $features = "hwcodec,vram,flutter" + + Push-Location libs\virtual_display\dylib + cargo build --release + if ($LASTEXITCODE -ne 0) { throw "cargo build (virtual_display) failed" } + Pop-Location + + cargo build --features $features --lib --release + if ($LASTEXITCODE -ne 0) { throw "cargo build (rustdesk lib) failed" } + if (-not (Test-Path target\release\librustdesk.dll)) { + throw "target\release\librustdesk.dll missing after cargo build" + } + + - name: Restore flutter/windows if cargo build wiped it + shell: bash + run: | + if [ ! -d flutter/windows ]; then + echo "flutter/windows missing after cargo build -- restoring from git" + git status --porcelain | grep -E "flutter/windows" | head -10 || true + git checkout HEAD -- flutter/windows + fi + test -d flutter/windows && echo "flutter/windows present: $(find flutter/windows -type f | wc -l) files" + test -f flutter/windows/CMakeLists.txt || { echo "CMakeLists.txt missing"; exit 1; } + + - name: Flutter build windows + shell: pwsh + run: | + Push-Location flutter + flutter build windows --release + if ($LASTEXITCODE -ne 0) { throw "flutter build windows failed" } + Pop-Location + + # Mirror what build.py's build_flutter_windows() does after flutter build: + # copy the virtual_display dylib next to rustdesk.exe. + Copy-Item -Force ` + target\release\deps\dylib_virtual_display.dll ` + flutter\build\windows\x64\runner\Release\ + + Move-Item -Force flutter\build\windows\x64\runner\Release rustdesk - name: Bundle usbmmidd_v2 + printer driver shell: pwsh