forked from UltimateDoomBuilder/UltimateDoomBuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_git_generic.cmd
executable file
·201 lines (167 loc) · 6.52 KB
/
build_git_generic.cmd
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
@ECHO OFF
ECHO.
ECHO. This build script requires the following software to be installed:
ECHO. - Git command-line client
ECHO. - Microsoft Visual Studio 2019 or newer
ECHO. - Microsoft HTML Help compiler
ECHO. - 7zip
ECHO.
ECHO. You have to commit your work before using this script.
ECHO. Results will be in the 'GIT_Build' directory.
ECHO. Files in the 'GIT_Build' directory may be overwritten.
ECHO.
ECHO.
SET STUDIODIR=c:\Program Files (x86)\Microsoft Visual Studio\2019\Community
SET HHWDIR=c:\Program Files (x86)\HTML Help Workshop
SET SEVENZIPDIR=c:\Program Files\7-Zip
SET ISSDIR=c:\Program Files (x86)\Inno Setup 6
IF NOT DEFINED PLATFORM SET PLATFORM=x86
SET DB_OUTDIR="%CD%\GIT_Build"
IF DEFINED BUILD_RELEASE SET DB_OUTDIR="%CD%\Release"
ECHO %DB_OUTDIR%
CALL "%STUDIODIR%\Common7\Tools\vsdevcmd.bat" %PLATFORM%
ECHO.
ECHO Building for platform %PLATFORM%
ECHO.
MKDIR %DB_OUTDIR%
git.exe checkout "Source/Core/Properties/AssemblyInfo.cs" > NUL
git.exe checkout "Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs" > NUL
ECHO.
ECHO Writing GIT log file...
ECHO.
IF EXIST "%DB_OUTDIR%\Changelog.xml" DEL /F /Q "%DB_OUTDIR%\Changelog.xml" > NUL
(
echo [OB]?xml version="1.0" encoding="UTF-8"?[CB]
echo [OB]log[CB]
git.exe log master --since=2012-04-17 --pretty=format:"[OB]logentry commit=\"%%h\"[CB]%%n[OB]author[CB]%%an[OB]/author[CB]%%n[OB]date[CB]%%aI[OB]/date[CB]%%n[OB]msg[CB]%%B[OB]/msg[CB]%%n[OB]/logentry[CB]"
echo [OB]/log[CB]
) >"%DB_OUTDIR%\Changelog.xml"
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "%DB_OUTDIR%\Changelog.xml" GOTO FILEFAIL
ECHO.
ECHO Compiling HTML Help file...
ECHO.
IF EXIST "Build\Refmanual.chm" DEL /F /Q "Build\Refmanual.chm" > NUL
"%HHWDIR%\hhc" Help\Refmanual.hhp
IF %ERRORLEVEL% NEQ 1 GOTO ERRORFAIL
IF NOT EXIST "Build\Refmanual.chm" GOTO FILEFAIL
ECHO.
ECHO Looking up current repository revision numbers...
ECHO.
IF EXIST "setenv.bat" DEL /F /Q "setenv.bat" > NUL
IF DEFINED EXPERIMENTALNAME (
VersionFromGIT.exe "Source\Core\Properties\AssemblyInfo.cs" "Source\Plugins\BuilderModes\Properties\AssemblyInfo.cs" -O "setenv.bat" -N %EXPERIMENTALNAME%
) ELSE (
VersionFromGIT.exe "Source\Core\Properties\AssemblyInfo.cs" "Source\Plugins\BuilderModes\Properties\AssemblyInfo.cs" -O "setenv.bat"
)
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "setenv.bat" GOTO FILEFAIL
CALL "setenv.bat"
DEL /F /Q "setenv.bat"
ECHO.
ECHO Cleaning solutions...
ECHO.
msbuild.exe Builder.sln /t:Clean
msbuild.exe Source/Tools/Updater/Updater.csproj /t:Clean
ECHO.
ECHO Compiling Updater...
ECHO.
IF EXIST "Build\Updater.exe" DEL /F /Q "Build\Updater.exe" > NUL
IF EXIST "Source\Tools\Updater\obj" RD /S /Q "Source\Tools\Updater\obj"
msbuild "Source\Tools\Updater\Updater.csproj" /t:Rebuild /p:Configuration=Release /p:Platform=%PLATFORM% /v:minimal
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Updater.exe" GOTO FILEFAIL
VersionFromEXE.exe "Build\Updater.exe" "setenv.bat"
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "setenv.bat" GOTO FILEFAIL
CALL "setenv.bat"
DEL /F /Q "setenv.bat"
ECHO.
ECHO Compiling Doom Builder...
ECHO.
IF DEFINED EXPERIMENTALNAME (
echo ##### BUILDING EXPERIMENTAL VERSION %EXPERIMENTALNAME%
msbuild.exe Builder.sln /t:Rebuild /p:Configuration=Release /p:Platform=%PLATFORM% /v:minimal /p:DefineConstants="TRACE;NO_UPDATER"
) ELSE (
msbuild.exe Builder.sln /t:Rebuild /p:Configuration=Release /p:Platform=%PLATFORM% /v:minimal
)
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "Build\Builder.exe" GOTO FILEFAIL
IF NOT EXIST "Build\BuilderNative.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\AutomapMode.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\BuilderEffects.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\BuilderModes.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\ColorPicker.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\CommentsPanel.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\NodesViewer.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\SoundPropagationMode.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\StairSectorBuilder.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\TagExplorer.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\TagRange.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\ThreeDFloorMode.dll" GOTO FILEFAIL
IF NOT EXIST "Build\Plugins\VisplaneExplorer.dll" GOTO FILEFAIL
ECHO.
ECHO Creating changelog...
ECHO.
ChangelogMaker.exe "%DB_OUTDIR%\Changelog.xml" "Build" "m-x-d>MaxED" %REVISIONNUMBER%
IF %ERRORLEVEL% NEQ 0 GOTO LOGFAIL
ECHO.
ECHO Packing release...
ECHO.
IF NOT DEFINED BUILD_RELEASE GOTO PACKGIT
set DEL_PATHSPEC="%DB_OUTDIR%\UltimateDoomBuilder-Setup*-%PLATFORM%.exe"
IF EXIST %DEL_PATHSPEC% DEL /F /Q %DEL_PATHSPEC% > NUL
"%ISSDIR%\iscc.exe" /DUDB_arch=%PLATFORM% "Setup\UDBuilder_setup.iss"
IF %ERRORLEVEL% NEQ 0 GOTO ERRORFAIL
IF NOT EXIST "%DB_OUTDIR%\Setup.exe" GOTO FILEFAIL
REN "%DB_OUTDIR%\Setup.exe" "UltimateDoomBuilder-Setup-R%REVISIONNUMBER%-%PLATFORM%.exe"
REM GOTO BUILDDONE
:PACKGIT
SET DEL_PATHSPEC="%DB_OUTDIR%\UltimateDoomBuilder*-%PLATFORM%.7z"
IF EXIST %DEL_PATHSPEC% DEL /F /Q %DEL_PATHSPEC% > NUL
IF EXIST "%DB_OUTDIR%\UDB_Updater-%PLATFORM%.7z" DEL /F /Q "%DB_OUTDIR%\UDB_Updater-%PLATFORM%.7z" > NUL
"%SEVENZIPDIR%\7z" a %DB_OUTDIR%\udb.7z .\Build\* -xr!*.xml -xr!JetBrains.Profiler.Core.Api.dll -xr!ScintillaNET.3.5.pdb -x!Setup -x!OpenGLDebug.log -x!Builder.vshost.* -x!.gitignore -x!UDBScript\Scripts\*.js
"%SEVENZIPDIR%\7z" a %DB_OUTDIR%\UDB_Updater-%PLATFORM%.7z .\Build\Updater.exe .\Build\Updater.ini
IF %ERRORLEVEL% NEQ 0 GOTO PACKFAIL
IF NOT EXIST %DB_OUTDIR%\udb.7z GOTO FILEFAIL
IF NOT EXIST %DB_OUTDIR%\UDB_Updater-%PLATFORM%.7z GOTO FILEFAIL
REN "%DB_OUTDIR%\udb.7z" UltimateDoomBuilder-r%REVISIONNUMBER%-%PLATFORM%.7z
IF EXIST "Build\Changelog.txt" DEL /F /Q "Build\Changelog.txt" > NUL
@ECHO %REVISIONNUMBER%> %DB_OUTDIR%\Version.txt
@ (ECHO %REVISIONNUMBER% && ECHO %EXEREVISIONNUMBER%) > %DB_OUTDIR%\Versions.txt
git.exe checkout "Source\Core\Properties\AssemblyInfo.cs" > NUL
git.exe checkout "Source\Plugins\BuilderModes\Properties\AssemblyInfo.cs" > NUL
:BUILDDONE
ECHO.
ECHO. BUILD DONE !
ECHO.
ECHO. Revision: %REVISIONNUMBER% (%REVISIONHASH%)
ECHO.
PAUSE > NUL
GOTO LEAVE
:ERRORFAIL
ECHO.
ECHO. BUILD FAILED (Tool returned error %ERRORLEVEL%)
ECHO.
PAUSE > NUL
GOTO LEAVE
:PACKFAIL
ECHO.
ECHO. PACKAGING FAILED (7zip returned error %ERRORLEVEL%)
ECHO.
PAUSE > NUL
GOTO LEAVE
:FILEFAIL
ECHO.
ECHO. BUILD FAILED (Output file was not built)
ECHO.
PAUSE > NUL
GOTO LEAVE
:LOGFAIL
ECHO.
ECHO. CHANGELOG GENERATION FAILED (Tool returned error %ERRORLEVEL%)
ECHO.
PAUSE > NUL
GOTO LEAVE
:LEAVE
exit