-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild.bat
More file actions
84 lines (72 loc) · 2.3 KB
/
Build.bat
File metadata and controls
84 lines (72 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
@echo off
setlocal enabledelayedexpansion
echo ============================================
echo PleaseTweakWindows - WPF Build Script
echo ============================================
echo.
:: Check .NET SDK
dotnet --version >nul 2>&1
if errorlevel 1 (
echo ERROR: .NET SDK not found. Install .NET 9 SDK from https://dotnet.microsoft.com/download
exit /b 1
)
:: Verify .NET 9
for /f "tokens=1 delims=." %%v in ('dotnet --version') do set DOTNET_MAJOR=%%v
if !DOTNET_MAJOR! LSS 9 (
echo ERROR: .NET 9 or later is required. Found:
dotnet --version
exit /b 1
)
set PROJECT=src\PleaseTweakWindows\PleaseTweakWindows.csproj
set TESTS=src\PleaseTweakWindows.Tests\PleaseTweakWindows.Tests.csproj
echo [1/4] Running tests...
dotnet test %TESTS% -c Release --verbosity quiet
if errorlevel 1 (
echo ERROR: Tests failed.
exit /b 1
)
echo Tests passed.
echo.
echo [2/4] Building Release...
dotnet build %PROJECT% -c Release --verbosity quiet
if errorlevel 1 (
echo ERROR: Build failed.
exit /b 1
)
echo Build succeeded.
echo.
echo [3/4] Publishing single-file EXE...
dotnet publish %PROJECT% ^
-c Release ^
-r win-x64 ^
--self-contained true ^
-p:PublishSingleFile=true ^
-p:IncludeNativeLibrariesForSelfExtract=true ^
-o dist\publish
if errorlevel 1 (
echo ERROR: Publish failed.
exit /b 1
)
echo Publish succeeded.
echo.
echo [4/4] Creating distribution package...
if exist dist\PleaseTweakWindows rd /s /q dist\PleaseTweakWindows
mkdir dist\PleaseTweakWindows
:: Copy EXE (scripts are embedded; the EXE is self-contained)
copy dist\publish\PleaseTweakWindows.exe dist\PleaseTweakWindows\ >nul
:: Copy docs if present
if exist README.md copy README.md dist\PleaseTweakWindows\ >nul
if exist LICENSE copy LICENSE dist\PleaseTweakWindows\ >nul
:: Create ZIP
echo Creating ZIP archive...
pushd dist
if exist PleaseTweakWindows.zip del PleaseTweakWindows.zip
powershell -NoProfile -Command "Compress-Archive -Path 'PleaseTweakWindows\*' -DestinationPath 'PleaseTweakWindows.zip'"
popd
echo.
echo ============================================
echo BUILD COMPLETE
echo ============================================
echo EXE: dist\PleaseTweakWindows\PleaseTweakWindows.exe
echo ZIP: dist\PleaseTweakWindows.zip
echo ============================================