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>
137 lines
4.6 KiB
Batchfile
137 lines
4.6 KiB
Batchfile
@echo off
|
|
:: =============================================================================
|
|
:: TeslaLauncher — Unified Build / Package Script
|
|
:: =============================================================================
|
|
:: 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 8 SDK https://dotnet.microsoft.com/download/dotnet/8.0
|
|
:: Internet access for NuGet restore (first build only)
|
|
::
|
|
:: Usage:
|
|
:: build.bat - build both components + package
|
|
:: build.bat /service - build Service only
|
|
:: build.bat /agent - build Agent only
|
|
::
|
|
:: Output:
|
|
:: TeslaLauncher\
|
|
:: 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 RID=win-x64
|
|
|
|
:: -- 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 - Build ^& Package (net8, %RID%)
|
|
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%\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] Publishing TeslaLauncherService (Session 0 Windows Service)...
|
|
echo.
|
|
dotnet publish "%ROOT%TeslaLauncherService.csproj" ^
|
|
-c Release ^
|
|
-r %RID% ^
|
|
--self-contained true ^
|
|
-p:PublishSingleFile=true ^
|
|
-o "%BUILD_DIR%\Service"
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo ERROR: Service build failed.
|
|
if "%QUIET%"=="0" pause
|
|
exit /b 1
|
|
)
|
|
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] Publishing TeslaLauncherAgent...) else (echo [1/1] Publishing TeslaLauncherAgent...)
|
|
echo.
|
|
dotnet publish "%ROOT%TeslaLauncherAgent.csproj" ^
|
|
-c Release ^
|
|
-r %RID% ^
|
|
--self-contained true ^
|
|
-p:PublishSingleFile=true ^
|
|
"-p:DefineConstants=WINFORMS" ^
|
|
-o "%BUILD_DIR%\Agent"
|
|
if errorlevel 1 (
|
|
echo.
|
|
echo ERROR: Agent build failed.
|
|
if "%QUIET%"=="0" pause
|
|
exit /b 1
|
|
)
|
|
echo.
|
|
echo Agent : %BUILD_DIR%\Agent\TeslaLauncherAgent.exe
|
|
echo.
|
|
|
|
:skip_agent
|
|
|
|
:: -- 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 ------------------------------------------------------------------
|
|
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 the pod (or stand-in) PC
|
|
echo 2. Run TeslaLauncher\install.bat as Administrator
|
|
echo.
|
|
if "%QUIET%"=="0" pause
|
|
exit /b 0
|