Co-locate the two cockpit-pod projects into a single repository:
- Console/ : TeslaConsole, the net48 WinForms operator console (decompiled
reconstruction) plus its differential + catalog test suite.
- Launcher/ : TeslaLauncher, the net6 pod-side Service + Agent rewrite.
Adds a combined TeslaSuite.sln, root README documenting the shared wire
contract (and its current duplication, the main follow-up), and a root
.gitignore. Histories were not preserved per request; this is a fresh start
from the current working state of both projects.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
190 lines
7.1 KiB
Batchfile
190 lines
7.1 KiB
Batchfile
@echo off
|
|
:: =============================================================================
|
|
:: TeslaLauncher — Unified Build Script
|
|
:: =============================================================================
|
|
:: Builds TeslaLauncherService.exe and TeslaLauncherAgent.exe (with integrated
|
|
:: TeslaSecureConfiguration protocol) from source.
|
|
::
|
|
:: Requirements:
|
|
:: .NET 6 SDK https://dotnet.microsoft.com/download/dotnet/6.0
|
|
:: Internet access for NuGet restore (System.IO.Ports 7.0.0)
|
|
::
|
|
:: Usage:
|
|
:: build.bat — build both components
|
|
:: build.bat /service — build Service only
|
|
:: build.bat /agent — build Agent only
|
|
::
|
|
:: Output:
|
|
:: TeslaLauncher\
|
|
:: Service\
|
|
:: TeslaLauncherService.exe
|
|
:: Agent\
|
|
:: TeslaLauncherAgent.exe
|
|
:: install.bat
|
|
:: =============================================================================
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
set ROOT=%~dp0
|
|
set BUILD_DIR=%ROOT%TeslaLauncher
|
|
set SVC_STAGE=%ROOT%_stage_svc
|
|
set AGT_STAGE=%ROOT%_stage_agt
|
|
|
|
:: ── Parse arguments ───────────────────────────────────────────────────────────
|
|
set BUILD_SERVICE=1
|
|
set BUILD_AGENT=1
|
|
set QUIET=0
|
|
|
|
for %%a in (%*) do (
|
|
if /i "%%~a"=="/service" set BUILD_AGENT=0
|
|
if /i "%%~a"=="/agent" set BUILD_SERVICE=0
|
|
if /i "%%~a"=="/q" set QUIET=1
|
|
)
|
|
|
|
echo.
|
|
echo ============================================================
|
|
echo Tesla Launcher v0.1 — Unified Build
|
|
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 6 SDK from:
|
|
echo https://dotnet.microsoft.com/download/dotnet/6.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.
|
|
|
|
:: ── 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 ───────────────────────────────────────────
|
|
if exist "%BUILD_DIR%\Service" rmdir /s /q "%BUILD_DIR%\Service"
|
|
if exist "%BUILD_DIR%\Agent" rmdir /s /q "%BUILD_DIR%\Agent"
|
|
|
|
:: ── Build Service ─────────────────────────────────────────────────────────────
|
|
if %BUILD_SERVICE%==0 goto :skip_service
|
|
|
|
echo [1/2] Building TeslaLauncherService...
|
|
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" ^
|
|
-c Release ^
|
|
-r win-x86 ^
|
|
--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 ───────────────────────────────────────────────────────────────
|
|
if %BUILD_AGENT%==0 goto :skip_agent
|
|
|
|
if %BUILD_SERVICE%==1 (echo [2/2] Building TeslaLauncherAgent...) else (echo [1/1] Building 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" ^
|
|
-c Release ^
|
|
-r win-x86 ^
|
|
--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
|
|
|
|
:: ── Summary ───────────────────────────────────────────────────────────────────
|
|
echo ============================================================
|
|
echo Build complete
|
|
echo ============================================================
|
|
echo.
|
|
if %BUILD_SERVICE%==1 echo Service : %BUILD_DIR%\Service\TeslaLauncherService.exe
|
|
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 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
|