Windows installer

Improve the installer, fix context menu on Windows, add CI workflows
This commit is contained in:
2026-08-24 14:47:14 +03:00
Unverified
parent fe79950ef1
commit cc7cf74dce
99 changed files with 10065 additions and 402 deletions
+78
View File
@@ -0,0 +1,78 @@
@echo off
setlocal EnableExtensions
if /I "%1"=="sync" (
call "%~dp0sync-windows-vm.cmd" %2
exit /b %ERRORLEVEL%
)
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" arm64
if errorlevel 1 exit /b 1
call "%~dp0ensure-windows-arm64-jdk.cmd"
if errorlevel 1 exit /b 1
set "FROMCHAT_PACKAGING_JDK=%JAVA_HOME%"
set "PATH=%JAVA_HOME%\bin;C:\WINDOWS\system32\config\systemprofile\.cargo\bin;%PATH%"
cd /d C:\FromChat\app
if exist gradle\gradle-daemon-jvm.properties del /f gradle\gradle-daemon-jvm.properties
if /I "%1"=="rust" (
call "%~dp0sync-windows-vm.cmd" rust
if errorlevel 1 exit /b 1
cd app\desktop\windows-setup
cargo build --release --workspace
exit /b %ERRORLEVEL%
)
if /I "%1"=="beta" (
call "%~dp0sync-windows-vm.cmd" all
if errorlevel 1 exit /b 1
if exist gradle\gradle-daemon-jvm.properties del /f gradle\gradle-daemon-jvm.properties
if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
if exist app\desktop\build\compose\tmp\main\runtime rmdir /s /q app\desktop\build\compose\tmp\main\runtime
if exist app\desktop\build\compose\binaries\main\app rmdir /s /q app\desktop\build\compose\binaries\main\app
if not exist app\desktop\build\prebuilt\windows-x64\app\FromChat\FromChat.exe (
echo WARNING: No x64 prebuilt at app\desktop\build\prebuilt\windows-x64\app\FromChat
echo Installer will be ARM64-only. Run scripts\stage-windows-x64-prebuilt.cmd first.
)
)
gradlew.bat :app:desktop:packageBetaWindows -PbetaDesktop --no-daemon
if errorlevel 1 exit /b 1
call "%~dp0copy-installers-to-desktop.cmd" beta
exit /b %ERRORLEVEL%
)
if /I "%1"=="install" (
call "%~dp0build-windows-vm.cmd" beta
if errorlevel 1 exit /b 1
call "%~dp0run-beta-installer.cmd"
exit /b %ERRORLEVEL%
)
if /I "%1"=="pack" (
call "%~dp0sync-windows-vm.cmd" rust
if errorlevel 1 exit /b 1
if exist gradle\gradle-daemon-jvm.properties del /f gradle\gradle-daemon-jvm.properties
gradlew.bat :app:desktop:packSetupOnly --no-daemon
if errorlevel 1 exit /b 1
call "%~dp0copy-installers-to-desktop.cmd"
exit /b %ERRORLEVEL%
)
if /I "%1"=="gradle" (
call "%~dp0sync-windows-vm.cmd" gradle
if errorlevel 1 exit /b 1
if exist gradle\gradle-daemon-jvm.properties del /f gradle\gradle-daemon-jvm.properties
gradlew.bat :app:desktop:packageReleaseWindows --no-daemon
if errorlevel 1 exit /b 1
call "%~dp0copy-installers-to-desktop.cmd"
exit /b %ERRORLEVEL%
)
echo Usage: build-windows-vm.cmd sync [all^|rust^|scripts^|gradle]
echo build-windows-vm.cmd rust ^(sync windows-setup, then cargo build^)
echo build-windows-vm.cmd beta ^(debug app + beta setup EXE, no ProGuard^)
echo build-windows-vm.cmd install ^(beta build + upgrade install + launch^)
echo Place x64 app-image: scripts\stage-windows-x64-prebuilt.cmd ^<path^>
echo build-windows-vm.cmd pack ^(sync, rust, packSetupOnly — fast UI loop^)
echo build-windows-vm.cmd gradle ^(sync, full packageReleaseWindows, copy to Desktop^)
exit /b 1
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail
VERSION="${1:?usage: ci-set-version.sh <version>}"
VERSION_CODE="$(printf '%s' "$VERSION" | sed 's/[^0-9]//g')"
if [[ -z "$VERSION_CODE" ]]; then
VERSION_CODE=1
fi
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
GRADLE_FILE="$ROOT/build.gradle.kts"
sed -i.bak "s/extra\\[\"versionName\"\\] = \"[^\"]*\"/extra[\"versionName\"] = \"$VERSION\"/" "$GRADLE_FILE"
sed -i.bak "s/extra\\[\"versionCode\"\\] = [0-9]*/extra[\"versionCode\"] = $VERSION_CODE/" "$GRADLE_FILE"
rm -f "$GRADLE_FILE.bak"
echo "versionName=$VERSION versionCode=$VERSION_CODE"
+123
View File
@@ -0,0 +1,123 @@
@echo off
setlocal EnableExtensions EnableDelayedExpansion
rem Copy packaged Windows installer to the logged-in user's Desktop.
rem prlctl exec runs as SYSTEM, so do not rely on %%USERPROFILE%%.
rem
rem copy-installers-to-desktop.cmd — release setup only
rem copy-installers-to-desktop.cmd beta — beta2 setup only (cleans desktop)
set "DIST=C:\FromChat\app\app\desktop\build\distributions\release"
set "WIN_DESKTOP="
set "MODE=%~1"
if not exist "%DIST%\" (
echo WARNING: Release output folder missing: %DIST%
exit /b 0
)
for /f "skip=1 tokens=1" %%U in ('query user 2^>nul') do (
if not defined LOGON set "LOGON=%%U"
)
if defined LOGON set "WIN_DESKTOP=C:\Users\%LOGON%\Desktop"
if not exist "%WIN_DESKTOP%\" (
for /d %%D in ("C:\Users\*") do (
if not defined WIN_DESKTOP (
echo %%~nxD | findstr /i /x "Public Default DefaultAccount WsiAccount" >nul
if errorlevel 1 if exist "%%D\Desktop\" set "WIN_DESKTOP=%%D\Desktop"
)
)
)
if not defined WIN_DESKTOP (
echo ERROR: Could not resolve Windows user Desktop path
exit /b 1
)
call :kill_running_installers
if /I "%MODE%"=="beta" (
call :clean_desktop_installers
set "COPIED=0"
for %%F in ("%DIST%\FromChat-Setup-*-beta2.exe") do (
if exist "%%F" (
call :copy_installer "%%~fF" "%WIN_DESKTOP%"
if errorlevel 1 exit /b 1
set "COPIED=1"
)
)
if "!COPIED!"=="0" (
echo ERROR: No FromChat-Setup-*-beta2.exe found in %DIST%
exit /b 1
)
exit /b 0
)
for %%F in ("%DIST%\FromChat-Portable-*.exe") do (
if exist "%%F" (
del /F /Q "%%F" >nul 2>&1
echo Removed stale portable build output: %%~nxF
)
)
for %%F in ("%WIN_DESKTOP%\FromChat-Portable-*.exe") do (
if exist "%%F" (
del /F /Q "%%F" >nul 2>&1
echo Removed stale portable artifact: %%~nxF
)
)
set "COPIED=0"
for %%F in ("%DIST%\FromChat-Setup-*.exe") do (
echo %%~nxF | findstr /i /c:"beta" >nul
if errorlevel 1 (
if exist "%%F" (
call :copy_installer "%%~fF" "%WIN_DESKTOP%"
if errorlevel 1 exit /b 1
set "COPIED=1"
)
)
)
if "!COPIED!"=="0" (
echo WARNING: No release FromChat-Setup-*.exe found in %DIST%
)
exit /b 0
:clean_desktop_installers
echo Cleaning Desktop installer clutter...
for %%F in ("%WIN_DESKTOP%\FromChat-Setup*.exe") do (
if exist "%%F" (
del /F /Q "%%F" >nul 2>&1
echo Removed %%~nxF
)
)
for %%F in ("%WIN_DESKTOP%\FromChat-Portable*.exe") do (
if exist "%%F" (
del /F /Q "%%F" >nul 2>&1
echo Removed %%~nxF
)
)
exit /b 0
:kill_running_installers
echo Stopping running FromChat installer processes...
powershell -NoProfile -Command ^
"$names = @('fromchat-setup','FromChat-Installer','FromChat-Setup*','FromChat-Portable*');" ^
"foreach ($n in $names) { Get-Process -Name $n -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue }" ^
2>nul
ping -n 2 127.0.0.1 >nul
exit /b 0
:copy_installer
set "SRC=%~1"
set "DEST_DIR=%~2"
copy /Y "%SRC%" "%DEST_DIR%\" >nul 2>&1
if errorlevel 1 (
echo ERROR: Failed to copy %~nx1 to %DEST_DIR% — close the running installer and retry
exit /b 1
)
echo Copied %~nx1 -^> %DEST_DIR%
exit /b 0
+68
View File
@@ -0,0 +1,68 @@
@echo off
setlocal EnableExtensions EnableDelayedExpansion
rem Ensure a native Windows ARM64 JDK is available for Gradle/jpackage builds.
rem x64 JDKs under emulation package x64 Skiko/JavaFX natives and break the desktop app.
if /I not "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
if /I not "%PROCESSOR_ARCHITEW6432%"=="ARM64" (
exit /b 0
)
)
set "JDK_ROOT=C:\Program Files\Eclipse Adoptium"
set "JDK_HOME="
set "JDK_FALLBACK=%LOCALAPPDATA%\Programs\Eclipse Adoptium\jdk-21-arm64"
for /d %%D in ("%JDK_ROOT%\jdk-*-arm64") do (
if exist "%%D\bin\java.exe" set "JDK_HOME=%%D"
)
for /d %%D in ("%JDK_ROOT%\jdk-*aarch64*") do (
if exist "%%D\bin\java.exe" set "JDK_HOME=%%D"
)
if not defined JDK_HOME (
for /d %%D in ("%JDK_ROOT%\jdk-*") do (
if not defined JDK_HOME if exist "%%D\bin\java.exe" (
"%%D\bin\java.exe" -XshowSettings:properties -version 2>&1 | findstr /i /c:"os.arch = aarch64" >nul
if not errorlevel 1 set "JDK_HOME=%%D"
)
)
)
if defined JDK_HOME goto :verify
echo Installing Temurin JDK 21 for Windows ARM64...
set "TMP_ZIP=%TEMP%\fromchat-temurin21-arm64.zip"
set "TMP_DIR=%TEMP%\fromchat-temurin21-arm64"
set "JDK_HOME=%JDK_ROOT%\jdk-21.0.12.101-hotspot-arm64"
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$zip='%TMP_ZIP%'; $tmp='%TMP_DIR%'; $dest='%JDK_HOME%'; $fallback='%JDK_FALLBACK%';" ^
"try { New-Item -ItemType Directory -Force -Path $dest | Out-Null } catch { $dest = $fallback; New-Item -ItemType Directory -Force -Path $dest | Out-Null };" ^
"Invoke-WebRequest -Uri 'https://api.adoptium.net/v3/binary/latest/21/ga/windows/aarch64/jdk/hotspot/normal/eclipse?project=jdk' -OutFile $zip;" ^
"if (Test-Path $tmp) { Remove-Item -Recurse -Force $tmp };" ^
"Expand-Archive -Path $zip -DestinationPath $tmp -Force;" ^
"$inner = Get-ChildItem $tmp -Directory | Select-Object -First 1;" ^
"Copy-Item -Path (Join-Path $inner.FullName '*') -Destination $dest -Recurse -Force"
if not exist "%JDK_HOME%\bin\java.exe" set "JDK_HOME=%JDK_FALLBACK%"
if not exist "%JDK_HOME%\bin\java.exe" (
echo ERROR: Failed to install ARM64 JDK under %JDK_ROOT%
exit /b 1
)
:verify
"%JDK_HOME%\bin\java.exe" -XshowSettings:properties -version 2>&1 | findstr /i /c:"os.arch = aarch64" >nul
if errorlevel 1 (
echo ERROR: %JDK_HOME% is not an ARM64 JDK ^(os.arch must be aarch64^).
exit /b 1
)
set "JAVA_HOME=%JDK_HOME%"
set "FROMCHAT_PACKAGING_JDK=%JDK_HOME%"
set "PATH=%JDK_HOME%\bin;%PATH%"
echo Using ARM64 JDK: %JDK_HOME%
endlocal & set "JAVA_HOME=%JAVA_HOME%" & set "FROMCHAT_PACKAGING_JDK=%FROMCHAT_PACKAGING_JDK%" & set "PATH=%PATH%"
exit /b 0
+99
View File
@@ -0,0 +1,99 @@
$ErrorActionPreference = "Stop"
function Ensure-Jdk17 {
$adoptium = "C:\Program Files\Eclipse Adoptium"
$jdkHome = Get-ChildItem $adoptium -Directory -ErrorAction SilentlyContinue |
Where-Object { $_.Name -like "jdk-17*" } |
Sort-Object Name -Descending |
Select-Object -First 1
if ($jdkHome) { return $jdkHome.FullName }
Write-Host "Downloading Temurin JDK 17..."
$msi = Join-Path $env:TEMP "temurin-jdk17.msi"
Invoke-WebRequest `
-Uri "https://api.adoptium.net/v3/installer/latest/17/ga/windows/x64/jdk/hotspot/normal/eclipse?project=jdk" `
-OutFile $msi `
-UseBasicParsing
Write-Host "Installing Temurin JDK 17..."
$args = @("/i", $msi, "/qn", "ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome")
$p = Start-Process msiexec.exe -ArgumentList $args -Wait -PassThru
if ($p.ExitCode -ne 0 -and $p.ExitCode -ne 3010) { throw "JDK 17 installer exit code $($p.ExitCode)" }
$jdkHome = Get-ChildItem $adoptium -Directory | Where-Object { $_.Name -like "jdk-17*" } | Sort-Object Name -Descending | Select-Object -First 1
if (-not $jdkHome) { throw "JDK 17 install failed" }
return $jdkHome.FullName
}
function Ensure-Jdk21 {
$adoptium = "C:\Program Files\Eclipse Adoptium"
$jdkHome = Get-ChildItem $adoptium -Directory -ErrorAction SilentlyContinue |
Where-Object { $_.Name -like "jdk-21*" } |
Sort-Object Name -Descending |
Select-Object -First 1
if ($jdkHome) { return $jdkHome.FullName }
Write-Host "Downloading Temurin JDK 21..."
$msi = Join-Path $env:TEMP "temurin-jdk21.msi"
Invoke-WebRequest `
-Uri "https://api.adoptium.net/v3/installer/latest/21/ga/windows/x64/jdk/hotspot/normal/eclipse?project=jdk" `
-OutFile $msi `
-UseBasicParsing
Write-Host "Installing Temurin JDK 21..."
$args = @("/i", $msi, "/qn", "ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome")
$p = Start-Process msiexec.exe -ArgumentList $args -Wait -PassThru
if ($p.ExitCode -ne 0 -and $p.ExitCode -ne 3010) { throw "JDK 21 installer exit code $($p.ExitCode)" }
$jdkHome = Get-ChildItem $adoptium -Directory | Where-Object { $_.Name -like "jdk-21*" } | Sort-Object Name -Descending | Select-Object -First 1
if (-not $jdkHome) { throw "JDK 21 install failed" }
return $jdkHome.FullName
}
function Ensure-Rust {
$cargo = Join-Path $env:USERPROFILE ".cargo\bin\cargo.exe"
if (Test-Path $cargo) { return $cargo }
Write-Host "Downloading rustup..."
$rustup = Join-Path $env:TEMP "rustup-init.exe"
Invoke-WebRequest -Uri "https://win.rustup.rs/x86_64" -OutFile $rustup -UseBasicParsing
Write-Host "Installing Rust..."
$p = Start-Process $rustup -ArgumentList @("-y", "--default-toolchain", "stable", "--profile", "minimal") -Wait -PassThru
if ($p.ExitCode -ne 0) { throw "rustup exit code $($p.ExitCode)" }
if (-not (Test-Path $cargo)) { throw "cargo not found after rustup" }
return $cargo
}
function Ensure-VsBuildTools {
$link = Get-Command link.exe -ErrorAction SilentlyContinue
if ($link) { return $link.Source }
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vswhere) {
$installPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath 2>$null
if ($installPath) {
$candidate = Join-Path $installPath "VC\Tools\MSVC"
if (Test-Path $candidate) { return $installPath }
}
}
Write-Host "Downloading VS Build Tools..."
$bootstrapper = Join-Path $env:TEMP "vs_BuildTools.exe"
Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vs_BuildTools.exe" -OutFile $bootstrapper -UseBasicParsing
Write-Host "Installing VS Build Tools (this may take several minutes)..."
$args = @(
"--quiet", "--wait", "--norestart",
"--add", "Microsoft.VisualStudio.Workload.VCTools",
"--includeRecommended"
)
$p = Start-Process $bootstrapper -ArgumentList $args -Wait -PassThru
if ($p.ExitCode -ne 0 -and $p.ExitCode -ne 3010) {
throw "VS Build Tools exit code $($p.ExitCode)"
}
$link = Get-Command link.exe -ErrorAction SilentlyContinue
if (-not $link) {
throw "link.exe still not found after VS Build Tools install"
}
return $link.Source
}
$javaHome17 = Ensure-Jdk17
Write-Host "JAVA_HOME_17=$javaHome17"
$javaHome21 = Ensure-Jdk21
Write-Host "JAVA_HOME_21=$javaHome21"
$cargo = Ensure-Rust
Write-Host "CARGO=$cargo"
$link = Ensure-VsBuildTools
Write-Host "LINK=$link"
Write-Host "OK"
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -euo pipefail
VERSION="${1:?usage: package-ios-ipa.sh <version> <output-dir>}"
OUT_DIR="${2:?usage: package-ios-ipa.sh <version> <output-dir>}"
VERSION_CODE="$(printf '%s' "$VERSION" | sed 's/[^0-9]//g')"
[[ -z "$VERSION_CODE" ]] && VERSION_CODE=1
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
IOS_PROJECT_DIR="$ROOT/app/ios"
BUILD_DIR="$ROOT/build/ios"
PLIST_PATH="$IOS_PROJECT_DIR/iosApp/Info.plist"
IPA_NAME="FromChat-$VERSION-ios.ipa"
IPA_PATH="$OUT_DIR/$IPA_NAME"
export DEVELOPER_DIR="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}"
if [[ ! -d "$DEVELOPER_DIR" ]]; then
DEVELOPER_DIR="$(xcode-select -p)"
export DEVELOPER_DIR
fi
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $VERSION_CODE" "$PLIST_PATH" || true
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION" "$PLIST_PATH" || true
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR" "$OUT_DIR"
xcodebuild \
-project "$IOS_PROJECT_DIR/iosApp.xcodeproj" \
-scheme iosApp \
-configuration Release \
-sdk iphoneos \
-destination 'generic/platform=iOS' \
-derivedDataPath "$BUILD_DIR" \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
clean build
APP_BUNDLE_PATH="$(find "$BUILD_DIR/Build/Products/Release-iphoneos" -name '*.app' -type d | head -n 1)"
if [[ -z "$APP_BUNDLE_PATH" ]]; then
echo "iOS .app bundle not found" >&2
exit 1
fi
PAYLOAD_STAGE="$BUILD_DIR/ipa_stage"
rm -rf "$PAYLOAD_STAGE"
mkdir -p "$PAYLOAD_STAGE/Payload"
cp -R "$APP_BUNDLE_PATH" "$PAYLOAD_STAGE/Payload/"
( cd "$PAYLOAD_STAGE" && zip -qr "$IPA_PATH" Payload )
rm -rf "$PAYLOAD_STAGE"
git -C "$ROOT" checkout -- "$PLIST_PATH" >/dev/null 2>&1 || true
echo "Wrote $IPA_PATH"
+54
View File
@@ -0,0 +1,54 @@
@echo off
setlocal EnableExtensions EnableDelayedExpansion
set "WIN_DESKTOP="
for /f "skip=1 tokens=1" %%U in ('query user 2^>nul') do (
if not defined LOGON set "LOGON=%%U"
)
if defined LOGON set "WIN_DESKTOP=C:\Users\%LOGON%\Desktop"
if not exist "%WIN_DESKTOP%\" (
for /d %%D in ("C:\Users\*") do (
if not defined WIN_DESKTOP (
echo %%~nxD | findstr /i /x "Public Default DefaultAccount WsiAccount" >nul
if errorlevel 1 if exist "%%D\Desktop\" set "WIN_DESKTOP=%%D\Desktop"
)
)
)
if not defined WIN_DESKTOP (
echo ERROR: Could not resolve Desktop path
exit /b 1
)
set "INSTALLER="
for /f "delims=" %%F in ('dir /b /od "%WIN_DESKTOP%\FromChat-Setup-*-beta2.exe" 2^>nul') do set "INSTALLER=%WIN_DESKTOP%\%%F"
if not defined INSTALLER (
set "DIST=C:\FromChat\app\app\desktop\build\distributions\release"
for /f "delims=" %%F in ('dir /b /od "%DIST%\FromChat-Setup-*-beta2.exe" 2^>nul') do set "INSTALLER=%DIST%\%%F"
)
if not exist "%INSTALLER%" (
echo ERROR: No FromChat-Setup-*-beta2.exe on Desktop or in dist folder
exit /b 1
)
echo Launching installer: %INSTALLER%
set "TASK=FromChatBetaInstall"
schtasks /delete /tn "%TASK%" /f >nul 2>&1
for /f "tokens=1-2 delims=:" %%H in ("%TIME%") do set "ST=%%H:%%M"
set "ST=%ST: =0%"
if defined LOGON (
schtasks /create /tn "%TASK%" /tr "\"%INSTALLER%\" --upgrade --launch" /sc once /st %ST% /ru "%LOGON%" /it /f
) else (
schtasks /create /tn "%TASK%" /tr "\"%INSTALLER%\" --upgrade --launch" /sc once /st %ST% /f
)
schtasks /run /tn "%TASK%" >nul
ping -n 3 127.0.0.1 >nul
schtasks /delete /tn "%TASK%" /f >nul 2>&1
echo Installer started.
exit /b 0
+19
View File
@@ -0,0 +1,19 @@
@echo off
setlocal EnableExtensions
if "%~1"=="" (
echo Usage: stage-windows-x64-prebuilt.cmd ^<path-to-FromChat-app-image^>
echo Example: stage-windows-x64-prebuilt.cmd C:\Downloads\FromChat
exit /b 1
)
set "SRC=%~1"
if not exist "%SRC%\FromChat.exe" (
echo Expected FromChat.exe in %SRC%
exit /b 1
)
cd /d "%~dp0.."
set "DEST=app\desktop\build\prebuilt\windows-x64\app\FromChat"
if exist app\desktop\build\prebuilt\windows-x64 rmdir /s /q app\desktop\build\prebuilt\windows-x64
mkdir "%DEST%"
xcopy /E /I /Y "%SRC%\*" "%DEST%\"
echo Staged x64 app image at %DEST%
exit /b 0
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail
VM_NAME="${FROMCHAT_WINDOWS_VM:-Windows 11}"
SCOPE="${1:-all}"
if ! command -v prlctl >/dev/null 2>&1; then
echo "prlctl not found — run sync-windows-vm.cmd inside the VM instead" >&2
exit 1
fi
prlctl exec "$VM_NAME" cmd /c "C:\\FromChat\\app\\scripts\\sync-windows-vm.cmd ${SCOPE}"
+51
View File
@@ -0,0 +1,51 @@
@echo off
setlocal EnableExtensions
rem Sync Mac workspace share -> local VM copy.
rem Uses /E (not /MIR) so VM-only build caches (target, build, .gradle) are never deleted.
set "SRC=C:\Mac\Home\Desktop\FromChat\app"
set "DEST=C:\FromChat\app"
if not exist "%SRC%\" (
echo ERROR: Mac share not found at %SRC%
echo Enable Parallels shared folders or adjust SRC in sync-windows-vm.cmd
exit /b 1
)
if not exist "%DEST%\" mkdir "%DEST%"
set "OPTS=/E /R:2 /W:2 /NP /NFL /NDL"
set "CACHE=/XD target build .gradle node_modules .git"
set "SKIP=/XF gradle-daemon-jvm.properties"
if /I "%~1"=="rust" (
echo Syncing app\desktop\windows-setup ^(keeping target\^)...
robocopy "%SRC%\app\desktop\windows-setup" "%DEST%\app\desktop\windows-setup" %OPTS% /XD target
goto :finish
)
if /I "%~1"=="scripts" (
echo Syncing scripts...
robocopy "%SRC%\scripts" "%DEST%\scripts" %OPTS%
goto :finish
)
if /I "%~1"=="gradle" (
echo Syncing app tree for Gradle ^(keeping build caches^)...
robocopy "%SRC%" "%DEST%" %OPTS% %CACHE% %SKIP%
goto :finish
)
echo Syncing full app tree ^(preserving target, build, .gradle^)...
robocopy "%SRC%" "%DEST%" %OPTS% %CACHE% %SKIP%
goto :finish
:finish
set "RC=%ERRORLEVEL%"
rem Robocopy: 0-7 = success (0 = nothing to copy, 1+ = copied files)
if %RC% GEQ 8 (
echo robocopy failed with exit code %RC%
exit /b %RC%
)
exit /b 0