-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.cmd
More file actions
134 lines (117 loc) · 3.85 KB
/
build.cmd
File metadata and controls
134 lines (117 loc) · 3.85 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@echo off
setlocal EnableDelayedExpansion
:: ============================================================
:: build.cmd -- UE5CEDumper build wrapper
::
:: NOTE: All builds are ALWAYS clean (no cache).
:: CMake build/ dir and dotnet bin/obj are removed before each build.
::
:: Usage:
:: build Build Release (all targets)
:: build debug Build Debug
:: build release Build Release
:: build publish Build Publish (optimized single-file)
:: build clean Clean dist/ folder too
:: build dll Build DLL only
:: build ui Build UI only
:: build test Build + run tests
:: build publish clean Publish with clean
:: ============================================================
set "MODE=Release"
set "TARGET=All"
set "CLEAN="
set "HAS_ARGS=0"
:: Parse arguments
:parse_args
if "%~1"=="" goto :run
set "HAS_ARGS=1"
set "ARG=%~1"
:: Case-insensitive matching
for %%A in ("%ARG%") do set "UPPER=%%~A"
call :to_upper UPPER
if "!UPPER!"=="DEBUG" ( set "MODE=Debug" & shift & goto :parse_args )
if "!UPPER!"=="RELEASE" ( set "MODE=Release" & shift & goto :parse_args )
if "!UPPER!"=="PUBLISH" ( set "MODE=Publish" & shift & goto :parse_args )
if "!UPPER!"=="CLEAN" ( set "CLEAN=-Clean" & shift & goto :parse_args )
if "!UPPER!"=="DLL" ( set "TARGET=DLL" & shift & goto :parse_args )
if "!UPPER!"=="UI" ( set "TARGET=UI" & shift & goto :parse_args )
if "!UPPER!"=="TEST" ( set "TARGET=Test" & shift & goto :parse_args )
if "!UPPER!"=="ALL" ( set "TARGET=All" & shift & goto :parse_args )
if "!UPPER!"=="/?" goto :usage
if "!UPPER!"=="-H" goto :usage
if "!UPPER!"=="--HELP" goto :usage
:: Unknown arg -- show error and usage
echo.
echo ERROR: Unknown argument '%~1'
goto :usage_error
:run
set "LOG=%~dp0build_log.txt"
echo.
echo UE5CEDumper Build
echo Mode: %MODE% Target: %TARGET% Clean: %CLEAN%
echo Log: %LOG%
:: Show hint when no arguments provided (default Release build)
if "!HAS_ARGS!"=="0" (
echo Hint: No arguments -- using defaults. Available options:
echo build debug Debug build
echo build dll DLL only
echo build ui UI only
echo build test Run tests
echo build publish Optimized single-file
echo build clean Clean first
echo build --help Full usage
)
echo.
:: Use -File instead of -Command to avoid encoding issues at the
:: cmd.exe -> PowerShell -> Tee-Object -> cmd.exe pipe boundary.
:: Logging is handled inside build.ps1 via Start-Transcript.
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0build.ps1" -Mode %MODE% -Target %TARGET% %CLEAN% -LogFile "%LOG%"
set "EC=%ERRORLEVEL%"
if %EC% neq 0 (
echo.
echo BUILD FAILED [exit code %EC%] -- see %LOG%
echo.
) else (
echo.
echo BUILD SUCCEEDED -- log: %LOG%
echo.
)
exit /b %EC%
:usage_error
call :print_usage
exit /b 1
:usage
call :print_usage
exit /b 0
:print_usage
echo.
echo Usage: build [mode] [target] [options]
echo.
echo Modes:
echo debug Unoptimized, debug symbols (fast iteration)
echo release Optimized build (default)
echo publish Optimized single-file exe (distribution)
echo.
echo Targets:
echo all Build everything (default)
echo dll C++ DLL only
echo ui C# Avalonia UI only
echo test Build + run unit tests
echo.
echo Options:
echo clean Remove all build artifacts first
echo.
echo Examples:
echo build Release build, all targets
echo build debug Debug build
echo build publish clean Clean + publish
echo build dll Build DLL only
echo build test Run tests
echo.
goto :eof
:to_upper
:: Convert variable to uppercase
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
set "%1=!%1:%%a=%%a!"
)
goto :eof