Fix Launcher packaging for net8/x64; doc + gitignore updates

build.bat was broken by the contract extraction: it staged the loose Launcher
.cs files into temp folders and published from there, but the projects now have
a ProjectReference to ..\Contract\Tesla.Contract.csproj which cannot resolve from
a temp dir. Publish the projects IN PLACE instead, and target net8 / win-x64
(self-contained single-file) to match the runtime/arch uplift. The resulting
TeslaLauncher\ package (Service\ + Agent\ + install.bat) installs on a pod with
no .NET runtime prerequisite.

- Launcher/README.md: correct net6->net8, x86->x64, BinaryFormatter->framed JSON,
  and note wire types now come from ../Contract.
- Launcher/.gitignore: ignore the TeslaLauncher-*.zip deployment package.
- Console/.gitignore: ignore the published TeslaConsole-app\ package + its zip
  (framework-dependent net48 console build for running against a test pod).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-06-30 08:30:13 -05:00
co-authored by Claude Opus 4.8
parent b9d8027cf6
commit a7aafaa9e9
4 changed files with 69 additions and 107 deletions
+37 -90
View File
@@ -1,36 +1,39 @@
@echo off
:: =============================================================================
:: TeslaLauncher — Unified Build Script
:: TeslaLauncher — Unified Build / Package Script
:: =============================================================================
:: Builds TeslaLauncherService.exe and TeslaLauncherAgent.exe (with integrated
:: TeslaSecureConfiguration protocol) from source.
:: Publishes TeslaLauncherService.exe and TeslaLauncherAgent.exe as
:: self-contained single-file win-x64 executables (net8) and assembles the
:: installable TeslaLauncher\ package next to install.bat.
::
:: Requirements:
:: .NET 6 SDK https://dotnet.microsoft.com/download/dotnet/6.0
:: Internet access for NuGet restore (System.IO.Ports 7.0.0)
:: .NET 8 SDK https://dotnet.microsoft.com/download/dotnet/8.0
:: Internet access for NuGet restore (first build only)
::
:: Usage:
:: build.bat build both components
:: build.bat /service build Service only
:: build.bat /agent build Agent only
:: build.bat - build both components + package
:: build.bat /service - build Service only
:: build.bat /agent - build Agent only
::
:: Output:
:: TeslaLauncher\
:: Service\
:: TeslaLauncherService.exe
:: Agent\
:: TeslaLauncherAgent.exe
:: install.bat
:: Service\TeslaLauncherService.exe
:: Agent\TeslaLauncherAgent.exe
:: [oalinst.exe, dx9201006\] (if vendored under assets\)
::
:: NOTE: the projects reference ..\Contract\Tesla.Contract.csproj, so they are
:: 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%TeslaLauncher
set SVC_STAGE=%ROOT%_stage_svc
set AGT_STAGE=%ROOT%_stage_agt
set RID=win-x64
:: ── Parse arguments ───────────────────────────────────────────────────────────
:: -- Parse arguments ----------------------------------------------------------
set BUILD_SERVICE=1
set BUILD_AGENT=1
set QUIET=0
@@ -43,17 +46,17 @@ for %%a in (%*) do (
echo.
echo ============================================================
echo Tesla Launcher v0.1 — Unified Build
echo Tesla Launcher v0.1 - Build ^& Package (net8, %RID%)
echo Output : %BUILD_DIR%
echo ============================================================
echo.
:: ── Verify .NET SDK ───────────────────────────────────────────────────────────
:: -- Verify .NET SDK ----------------------------------------------------------
where dotnet >nul 2>&1
if errorlevel 1 (
echo ERROR: dotnet not found.
echo Install the .NET 6 SDK from:
echo https://dotnet.microsoft.com/download/dotnet/6.0
echo Install the .NET 8 SDK from:
echo https://dotnet.microsoft.com/download/dotnet/8.0
if "%QUIET%"=="0" pause
exit /b 1
)
@@ -61,99 +64,63 @@ for /f "tokens=*" %%v in ('dotnet --version 2^>^&1') do set SDK_VER=%%v
echo SDK : %SDK_VER%
echo.
:: ── Verify source files ───────────────────────────────────────────────────────
call :check_file "TeslaLauncherService.cs" || goto :err_missing
call :check_file "TeslaLauncherService.csproj" || goto :err_missing
call :check_file "TeslaLauncherAgent.cs" || goto :err_missing
call :check_file "TeslaLauncherAgent.csproj" || goto :err_missing
call :check_file "LaunchModels_Shared.cs" || goto :err_missing
call :check_file "SecureConfig.cs" || goto :err_missing
:: ── Clean and prepare build output ───────────────────────────────────────────
:: -- Clean prior package output ----------------------------------------------
if exist "%BUILD_DIR%\Service" rmdir /s /q "%BUILD_DIR%\Service"
if exist "%BUILD_DIR%\Agent" rmdir /s /q "%BUILD_DIR%\Agent"
:: ── Build Service ─────────────────────────────────────────────────────────────
:: -- Build Service ------------------------------------------------------------
if %BUILD_SERVICE%==0 goto :skip_service
echo [1/2] Building TeslaLauncherService...
echo [1/2] Publishing TeslaLauncherService (Session 0 Windows Service)...
echo.
if exist "%SVC_STAGE%" rmdir /s /q "%SVC_STAGE%"
mkdir "%SVC_STAGE%"
copy /y "%ROOT%TeslaLauncherService.cs" "%SVC_STAGE%\" >nul
copy /y "%ROOT%TeslaLauncherService.csproj" "%SVC_STAGE%\" >nul
copy /y "%ROOT%LaunchModels_Shared.cs" "%SVC_STAGE%\" >nul
copy /y "%ROOT%SecureConfig.cs" "%SVC_STAGE%\" >nul
copy /y "%ROOT%app.ico" "%SVC_STAGE%\" >nul
dotnet publish "%SVC_STAGE%\TeslaLauncherService.csproj" ^
dotnet publish "%ROOT%TeslaLauncherService.csproj" ^
-c Release ^
-r win-x86 ^
-r %RID% ^
--self-contained true ^
-p:PublishSingleFile=true ^
-o "%BUILD_DIR%\Service"
if errorlevel 1 (
echo.
echo ERROR: Service build failed.
rmdir /s /q "%SVC_STAGE%" 2>nul
if "%QUIET%"=="0" pause
exit /b 1
)
rmdir /s /q "%SVC_STAGE%"
echo.
echo Service : %BUILD_DIR%\Service\TeslaLauncherService.exe
echo.
:skip_service
:: ── Build Agent ───────────────────────────────────────────────────────────────
:: -- Build Agent --------------------------------------------------------------
if %BUILD_AGENT%==0 goto :skip_agent
if %BUILD_SERVICE%==1 (echo [2/2] Building TeslaLauncherAgent...) else (echo [1/1] Building TeslaLauncherAgent...)
if %BUILD_SERVICE%==1 (echo [2/2] Publishing TeslaLauncherAgent...) else (echo [1/1] Publishing TeslaLauncherAgent...)
echo.
if exist "%AGT_STAGE%" rmdir /s /q "%AGT_STAGE%"
mkdir "%AGT_STAGE%"
copy /y "%ROOT%TeslaLauncherAgent.cs" "%AGT_STAGE%\" >nul
copy /y "%ROOT%TeslaLauncherAgent.csproj" "%AGT_STAGE%\" >nul
copy /y "%ROOT%LaunchModels_Shared.cs" "%AGT_STAGE%\" >nul
copy /y "%ROOT%SecureConfig.cs" "%AGT_STAGE%\" >nul
copy /y "%ROOT%app.ico" "%AGT_STAGE%\" >nul
dotnet publish "%AGT_STAGE%\TeslaLauncherAgent.csproj" ^
dotnet publish "%ROOT%TeslaLauncherAgent.csproj" ^
-c Release ^
-r win-x86 ^
-r %RID% ^
--self-contained true ^
-p:PublishSingleFile=true ^
"-p:DefineConstants=WINFORMS" ^
-o "%BUILD_DIR%\Agent"
if errorlevel 1 (
echo.
echo ERROR: Agent build failed.
rmdir /s /q "%AGT_STAGE%" 2>nul
if "%QUIET%"=="0" pause
exit /b 1
)
rmdir /s /q "%AGT_STAGE%"
echo.
echo Agent : %BUILD_DIR%\Agent\TeslaLauncherAgent.exe
echo.
:skip_agent
:: ── Copy shared assets into build output ─────────────────────────────────────
if exist "%ROOT%install.bat" copy /y "%ROOT%install.bat" "%BUILD_DIR%\" >nul
if exist "%ROOT%assets\oalinst.exe" copy /y "%ROOT%assets\oalinst.exe" "%BUILD_DIR%\" >nul
if exist "%ROOT%assets\dx9201006\" xcopy /y /s /i /q "%ROOT%assets\dx9201006" "%BUILD_DIR%\dx9201006" >nul
:: -- Copy shared assets into the package --------------------------------------
if exist "%ROOT%install.bat" copy /y "%ROOT%install.bat" "%BUILD_DIR%\" >nul
if exist "%ROOT%assets\oalinst.exe" copy /y "%ROOT%assets\oalinst.exe" "%BUILD_DIR%\" >nul
if exist "%ROOT%assets\dx9201006\" xcopy /y /s /i /q "%ROOT%assets\dx9201006" "%BUILD_DIR%\dx9201006" >nul
:: ── Summary ───────────────────────────────────────────────────────────────────
:: -- Summary ------------------------------------------------------------------
echo ============================================================
echo Build complete
echo ============================================================
@@ -162,28 +129,8 @@ if %BUILD_SERVICE%==1 echo Service : %BUILD_DIR%\Service\TeslaLauncherServic
if %BUILD_AGENT%==1 echo Agent : %BUILD_DIR%\Agent\TeslaLauncherAgent.exe
echo.
echo Next steps:
echo 1. Copy the TeslaLauncher\ folder to each cockpit PC
echo 1. Copy the TeslaLauncher\ folder to the pod (or stand-in) PC
echo 2. Run TeslaLauncher\install.bat as Administrator
echo.
if "%QUIET%"=="0" pause
exit /b 0
:: ── Helpers ───────────────────────────────────────────────────────────────────
:check_file
if not exist "%ROOT%%~1" (
echo ERROR: Required source file not found: %~1
exit /b 1
)
exit /b 0
:err_missing
echo.
echo Make sure all source files are in the same folder as build.bat:
echo TeslaLauncherService.cs / .csproj
echo TeslaLauncherAgent.cs / .csproj
echo LaunchModels_Shared.cs
echo SecureConfig.cs
echo install.bat
echo.
if "%QUIET%"=="0" pause
exit /b 1