Improve build scripts and move them to scripts/

This commit is contained in:
Kamil Trzciński 2022-11-26 13:54:20 +01:00
parent 5d653a3342
commit 43abc56a41
9 changed files with 100 additions and 28 deletions

2
scripts/build.bat Normal file
View file

@ -0,0 +1,2 @@
powershell -ExecutionPolicy UnRestricted -File "%~dp0\build.ps1"
timeout /t 5

31
scripts/build.ps1 Normal file
View file

@ -0,0 +1,31 @@
cd "$PSScriptRoot/.."
$configuration = "Release"
if ($args[0]) {
$configuration = $args[0]
}
$path = "build-$configuration"
if ($args[1]) {
$path = $args[1]
}
$majorVer = Get-Content VERSION
$lastVer = git tag --sort version:refname --list "$majorVer.*" | Select -last 1
echo "Configuration: $configuration"
echo "BuildPath: $path"
echo "Major: $majorVer"
echo "lastVer: $lastVer"
if ($lastVer -ne "") {
$nextVer = $lastVer.Split('.')
$lastItem = $nextVer.Length-1
$nextVer[$lastItem] = [int]$nextVer[$lastItem] + 1
$nextVer = $nextVer -Join '.'
} else {
$nextVer="$majorVer.0"
}
dotnet --list-sdks -or winget install Microsoft.DotNet.SDK.6
dotnet build --configuration "$configuration" "/property:Version=$nextVer" --output "$path"

15
scripts/run_loop.bat Normal file
View file

@ -0,0 +1,15 @@
if not "%1"=="am_admin" (powershell start -verb runas '%0' 'am_admin,%1' & exit /b)
if "%2"=="" (echo missing name & timeout /t 3 & exit /b)
cd "%~dp0"
:retry
taskkill /F /IM "%1.exe"
del %1\bin\Debug\net6.0-windows\%1.exe
dotnet build
%1\bin\Debug\net6.0-windows\%1.exe
timeout /t 3
goto retry

20
scripts/test_debug.bat Normal file
View file

@ -0,0 +1,20 @@
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
:retry
cd "%~dp0"
set configuration=Debug
taskkill /F /IM FanControl.exe
taskkill /F /IM PerformanceOverlay.exe
taskkill /F /IM PowerControl.exe
taskkill /F /IM SteamController.exe
powershell -ExecutionPolicy UnRestricted -File "%~dp0\build.ps1" "%configuration%"
start ..\build-%configuration%\FanControl.exe
start ..\build-%configuration%\PerformanceOverlay.exe
start ..\build-%configuration%\PowerControl.exe
start ..\build-%configuration%\SteamController.exe
timeout /t 5

20
scripts/test_release.bat Normal file
View file

@ -0,0 +1,20 @@
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
:retry
cd "%~dp0"
set configuration=Debug
taskkill /F /IM FanControl.exe
taskkill /F /IM PerformanceOverlay.exe
taskkill /F /IM PowerControl.exe
taskkill /F /IM SteamController.exe
powershell -ExecutionPolicy UnRestricted -File "%~dp0\build.ps1" "%configuration%"
start ..\build-%configuration%\FanControl.exe
start ..\build-%configuration%\PerformanceOverlay.exe
start ..\build-%configuration%\PowerControl.exe
start ..\build-%configuration%\SteamController.exe
timeout /t 5