This commit is contained in:
2026-09-13 02:38:21 +03:00
parent ba63438575
commit 2d7a33e929
+126 -22
View File
@@ -440,50 +440,150 @@ jobs:
run: |
$ErrorActionPreference = "Stop"
if (-not (Test-Path "rustdesk\flutter\windows\CMakeLists.txt")) {
Write-Host "flutter/windows missing, restoring from Git..."
$repo = (Resolve-Path "rustdesk").Path
$windowsDir = Join-Path $repo "flutter\windows"
$windowsCmake = Join-Path $windowsDir "CMakeLists.txt"
if (-not (Test-Path $windowsCmake)) {
Write-Host "flutter/windows missing before build, restoring from Git..."
git `
-C rustdesk `
-C $repo `
restore `
--source=HEAD `
-- `
flutter/windows
if ($LASTEXITCODE -ne 0) {
throw "Unable to restore flutter/windows"
throw "Unable to restore flutter/windows before build"
}
}
if (-not (Test-Path "rustdesk\flutter\windows\CMakeLists.txt")) {
throw "flutter/windows/CMakeLists.txt is still missing"
if (-not (Test-Path $windowsCmake)) {
throw "flutter/windows/CMakeLists.txt is missing before build"
}
Write-Host "Windows Flutter project:"
Get-Item "rustdesk\flutter\windows\CMakeLists.txt"
Write-Host "===== Windows Flutter project before Rust build ====="
Get-Item $windowsCmake
Set-Location rustdesk
# Reproduce the Windows part of RustDesk 1.4.9 build.py manually.
# This lets us restore flutter/windows AFTER `flutter pub get` and
# BEFORE CMake is started.
python `
.\build.py `
--portable `
--flutter `
--skip-portable-pack `
--hwcodec `
--vram
Write-Host "`n===== Build virtual display dylib ====="
Push-Location (Join-Path $repo "libs\virtual_display\dylib")
try {
cargo build --locked --release
if ($LASTEXITCODE -ne 0) {
throw "virtual_display dylib build failed"
}
}
finally {
Pop-Location
}
Write-Host "`n===== Build RustDesk Rust library ====="
Push-Location $repo
try {
cargo build `
--locked `
--features "hwcodec,vram,flutter" `
--lib `
--release
if ($LASTEXITCODE -ne 0) {
throw "RustDesk Rust library build failed"
}
if (-not (Test-Path ".\target\release\librustdesk.dll")) {
throw "target\release\librustdesk.dll was not produced"
}
}
finally {
Pop-Location
}
Write-Host "`n===== Flutter pub get ====="
$flutterDir = Join-Path $repo "flutter"
Push-Location $flutterDir
try {
flutter pub get
if ($LASTEXITCODE -ne 0) {
throw "flutter pub get failed"
}
}
finally {
Pop-Location
}
Write-Host "`n===== Restore Windows project after pub get ====="
# The failing runs showed that flutter/windows existed before
# build.py, but CMake could no longer see it after Flutter's
# dependency-resolution phase. Restore it at the last possible
# point, then build with --no-pub so Flutter does not run pub get
# again before invoking CMake.
git `
-C $repo `
restore `
--source=HEAD `
-- `
flutter/windows
if ($LASTEXITCODE -ne 0) {
throw "RustDesk build failed"
throw "Unable to restore flutter/windows after flutter pub get"
}
$release = `
".\flutter\build\windows\x64\runner\Release"
if (-not (Test-Path $windowsCmake)) {
throw "flutter/windows/CMakeLists.txt is missing after restore"
}
if (-not (Test-Path "$release\rustdesk.exe")) {
Write-Host "Windows Flutter project immediately before CMake:"
Get-Item $windowsCmake
Write-Host "`n===== Flutter Windows release build ====="
Push-Location $flutterDir
try {
flutter build windows --release --no-pub
if ($LASTEXITCODE -ne 0) {
throw "Flutter Windows build failed"
}
}
finally {
Pop-Location
}
$release = Join-Path `
$repo `
"flutter\build\windows\x64\runner\Release"
if (-not (Test-Path (Join-Path $release "rustdesk.exe"))) {
throw "rustdesk.exe was not produced"
}
$packageDir = ".\dist\rustdesk"
# build.py normally copies this DLL into the Flutter Release bundle.
$virtualDisplayDll = Join-Path `
$repo `
"target\release\deps\dylib_virtual_display.dll"
if (-not (Test-Path $virtualDisplayDll)) {
throw "dylib_virtual_display.dll was not produced"
}
Copy-Item `
$virtualDisplayDll `
(Join-Path $release "dylib_virtual_display.dll") `
-Force
$packageDir = Join-Path $repo "dist\rustdesk"
Remove-Item `
$packageDir `
@@ -502,7 +602,11 @@ jobs:
-Recurse `
-Force
Write-Host "RustDesk main build OK"
Write-Host ""
Write-Host "====================================="
Write-Host "RustDesk main Windows build completed"
Write-Host "====================================="
Write-Host "Release: $release"
- name: Build WindowInjection.dll
shell: pwsh