Files
TeslaSuite/Launcher/build.bat
T
CydandClaude Fable 5 8730b9b966 XP11: single net40 binary runs on XP SP3 through Windows 11
Merge TeslaLauncherService (Session 0) + TeslaLauncherAgent (tray) into one
userland TeslaLauncher.exe. The split existed only to work around Vista+
Session 0 isolation; running everything in the auto-logged-in admin session
needs no service, no named pipe, and no flat<->wire conversion layer. The
original Elsewhen software was likewise a single binary.

net40 is the newest framework XP SP3 can install, and net40 assemblies load
in-place on the 4.8 runtime in Win10/11 -- one exe covers both.

- Contract: multi-target net48;net40. The net40 leg of PodRpcProtocol uses
  Newtonsoft.Json (STJ has no net40 target); JSON is shape-identical on the
  wire, and the request reader keeps date strings raw so Ping echoes
  byte-identically. Console keeps the untouched net48/STJ leg.
- MiniZip.cs: central-directory ZIP extractor (stored/deflate/ZIP64) since
  net40 has no ZipFile; zip-slip guarded.
- SecureConfig: RSACryptoServiceProvider instead of RSA.Create (net46+),
  no leaveOpen BinaryWriter/Reader, struct instead of ValueTuple, and no
  SetCompatibleTextRenderingDefault on the passcode thread (the merged app
  already has a form). netsh "interface ip" syntax was already XP-correct.
- Volume: nircmd -> CoreAudio (Vista+) -> winmm waveOutSetVolume (XP).
- Paths: CommonApplicationData resolved per-OS (XP has no C:\ProgramData);
  launcher log moved next to the key/config in the data dir.
- install.bat: dual-OS (cacls/icacls, netsh firewall/advfirewall, dism and
  UAC/notification steps skipped on XP, .NET 4.0 redist check, XP DHCP reset
  via netsh); no service registration -- HKLM Run key + auto-login on both;
  RegisterApplicationRestart supplies crash-restart on Vista+.
- Bench switches: /skipconfig, /port:NNNN.

Verified: Console + diff suite (103 tests) still green on the net48 leg;
E2E smoke test drove the net40 launcher over real TCP with the Console's own
PodManagerConnection (STJ client vs Newtonsoft server) -- Ping echo, volume,
app registry, launch/kill/watch, InstallProduct zip transfer + extract, and
uninstall orphan cleanup: 17/17 pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 18:59:06 -05:00

122 lines
5.0 KiB
Batchfile

@echo off
:: =============================================================================
:: TeslaLauncher - Unified Build / Package Script (XP11 single binary)
:: =============================================================================
:: Publishes TeslaLauncher.exe as a framework-dependent net40 build and
:: assembles the installable TeslaLauncher\ package next to install.bat.
::
:: net40 is deliberate: it is the newest .NET Framework that installs on
:: Windows XP SP3, and net40 assemblies run in-place on the 4.8 runtime built
:: into Windows 10/11 - so this ONE exe covers XP SP3 through Windows 11.
:: - XP SP3 pods additionally need the .NET Framework 4.0 redistributable
:: (dotNetFx40_Full_x86_x64.exe); drop it into assets\dotnet40\ to have
:: install.bat run it automatically when missing.
:: - Windows 10/11 pods need nothing extra.
::
:: Requirements:
:: .NET SDK (6.0+) to drive the build https://dotnet.microsoft.com/download
:: Internet access for NuGet restore (first build only)
::
:: Usage:
:: build.bat - build + package
:: build.bat /q - no pause on exit
::
:: Output (under dist\, parity with Console\dist\):
:: dist\TeslaLauncher\
:: install.bat
:: App\TeslaLauncher.exe (+ Newtonsoft.Json.dll, TeslaConsoleLaunchLib.dll)
:: dx9201006\ openal\ UltraVNC\ dotnet40\ (redist, mirrored from assets\)
:: dist\TeslaLauncher-podpkg.zip (the deployable package)
::
:: NOTE: the project references ..\Contract\Tesla.Contract.csproj, so it is
:: published IN PLACE (not staged into a temp folder) - the project reference
:: must be able to resolve relative to this directory.
:: =============================================================================
setlocal enabledelayedexpansion
set ROOT=%~dp0
set BUILD_DIR=%ROOT%dist\TeslaLauncher
set ZIP=%ROOT%dist\TeslaLauncher-podpkg.zip
set QUIET=0
for %%a in (%*) do (
if /i "%%~a"=="/q" set QUIET=1
)
echo.
echo ============================================================
echo Tesla Launcher v4.11.4.1 - Build ^& Package (net40 single binary)
echo Output : %BUILD_DIR%
echo ============================================================
echo.
:: -- Verify .NET SDK ----------------------------------------------------------
where dotnet >nul 2>&1
if errorlevel 1 (
echo ERROR: dotnet not found.
echo Install the .NET 8 SDK from:
echo https://dotnet.microsoft.com/download/dotnet/8.0
if "%QUIET%"=="0" pause
exit /b 1
)
for /f "tokens=*" %%v in ('dotnet --version 2^>^&1') do set SDK_VER=%%v
echo SDK : %SDK_VER%
echo.
:: -- Clean prior package output ----------------------------------------------
if exist "%BUILD_DIR%\App" rmdir /s /q "%BUILD_DIR%\App"
if exist "%BUILD_DIR%\Service" rmdir /s /q "%BUILD_DIR%\Service"
if exist "%BUILD_DIR%\Agent" rmdir /s /q "%BUILD_DIR%\Agent"
if exist "%BUILD_DIR%\dx9201006" rmdir /s /q "%BUILD_DIR%\dx9201006"
if exist "%BUILD_DIR%\openal" rmdir /s /q "%BUILD_DIR%\openal"
if exist "%BUILD_DIR%\UltraVNC" rmdir /s /q "%BUILD_DIR%\UltraVNC"
if exist "%BUILD_DIR%\dotnet40" rmdir /s /q "%BUILD_DIR%\dotnet40"
:: -- Build --------------------------------------------------------------------
echo [1/1] Publishing TeslaLauncher (net40 single binary)...
echo.
dotnet publish "%ROOT%TeslaLauncher.csproj" ^
-c Release ^
-o "%BUILD_DIR%\App"
if errorlevel 1 (
echo.
echo ERROR: build failed.
if "%QUIET%"=="0" pause
exit /b 1
)
echo.
echo Launcher : %BUILD_DIR%\App\TeslaLauncher.exe
echo.
:: -- Copy shared assets into the package --------------------------------------
:: Mirror each redist folder under assets\ into the package root so install.bat's
:: paths (%ROOT%\dx9201006\ etc.) resolve.
if exist "%ROOT%install.bat" copy /y "%ROOT%install.bat" "%BUILD_DIR%\" >nul
if exist "%ROOT%assets\dx9201006" xcopy /y /s /i /q "%ROOT%assets\dx9201006" "%BUILD_DIR%\dx9201006" >nul
if exist "%ROOT%assets\openal" xcopy /y /s /i /q "%ROOT%assets\openal" "%BUILD_DIR%\openal" >nul
if exist "%ROOT%assets\UltraVNC" xcopy /y /s /i /q "%ROOT%assets\UltraVNC" "%BUILD_DIR%\UltraVNC" >nul
if exist "%ROOT%assets\dotnet40" xcopy /y /s /i /q "%ROOT%assets\dotnet40" "%BUILD_DIR%\dotnet40" >nul
:: -- Zip the package ----------------------------------------------------------
echo Zipping package...
if exist "%ZIP%" del /q "%ZIP%"
powershell -NoProfile -Command "Compress-Archive -Path '%BUILD_DIR%' -DestinationPath '%ZIP%' -Force"
:: -- Summary ------------------------------------------------------------------
echo ============================================================
echo Build complete
echo ============================================================
echo.
echo Launcher : %BUILD_DIR%\App\TeslaLauncher.exe
echo.
echo Package : %BUILD_DIR%
echo Zip : %ZIP%
echo.
echo Next steps:
echo 1. Copy TeslaLauncher-podpkg.zip to the pod (XP SP3 or Win10/11) and extract
echo 2. Run TeslaLauncher\install.bat as Administrator
echo.
if "%QUIET%"=="0" pause
exit /b 0