Skip to content

Commit 7c77652

Browse files
authored
bpo-47032: Ensure Windows install builds fail correctly with a non-zero exit code when part of the build fails (GH-31921)
1 parent 7088120 commit 7c77652

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Ensure Windows install builds fail correctly with a non-zero exit code when
2+
part of the build fails.

Tools/msi/build.bat

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,31 @@ if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable &
3030

3131
if defined BUILDX86 (
3232
call "%PCBUILD%build.bat" -p Win32 -d -e %REBUILD% %BUILDTEST%
33-
if errorlevel 1 goto :eof
33+
if errorlevel 1 exit /B %ERRORLEVEL%
3434
call "%PCBUILD%build.bat" -p Win32 -e %REBUILD% %BUILDTEST%
35-
if errorlevel 1 goto :eof
35+
if errorlevel 1 exit /B %ERRORLEVEL%
3636
)
3737
if defined BUILDX64 (
3838
call "%PCBUILD%build.bat" -p x64 -d -e %REBUILD% %BUILDTEST%
39-
if errorlevel 1 goto :eof
39+
if errorlevel 1 exit /B %ERRORLEVEL%
4040
call "%PCBUILD%build.bat" -p x64 -e %REBUILD% %BUILDTEST%
41-
if errorlevel 1 goto :eof
41+
if errorlevel 1 exit /B %ERRORLEVEL%
4242
)
4343
if defined BUILDARM64 (
4444
call "%PCBUILD%build.bat" -p ARM64 -d -e %REBUILD% %BUILDTEST%
45-
if errorlevel 1 goto :eof
45+
if errorlevel 1 exit /B %ERRORLEVEL%
4646
call "%PCBUILD%build.bat" -p ARM64 -e %REBUILD% %BUILDTEST%
47-
if errorlevel 1 goto :eof
47+
if errorlevel 1 exit /B %ERRORLEVEL%
4848
)
4949

5050
if defined BUILDDOC (
5151
call "%PCBUILD%..\Doc\make.bat" htmlhelp
52-
if errorlevel 1 goto :eof
52+
if errorlevel 1 exit /B %ERRORLEVEL%
5353
)
5454

5555
rem Build the launcher MSI separately
5656
%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86
57+
if errorlevel 1 exit /B %ERRORLEVEL%
5758

5859
set BUILD_CMD="%D%bundle\snapshot.wixproj"
5960
if defined BUILDTEST (
@@ -68,15 +69,15 @@ if defined REBUILD (
6869

6970
if defined BUILDX86 (
7071
%MSBUILD% /p:Platform=x86 %BUILD_CMD%
71-
if errorlevel 1 goto :eof
72+
if errorlevel 1 exit /B %ERRORLEVEL%
7273
)
7374
if defined BUILDX64 (
7475
%MSBUILD% /p:Platform=x64 %BUILD_CMD%
75-
if errorlevel 1 goto :eof
76+
if errorlevel 1 exit /B %ERRORLEVEL%
7677
)
7778
if defined BUILDARM64 (
7879
%MSBUILD% /p:Platform=ARM64 %BUILD_CMD%
79-
if errorlevel 1 goto :eof
80+
if errorlevel 1 exit /B %ERRORLEVEL%
8081
)
8182

8283
exit /B 0

Tools/msi/buildrelease.bat

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,27 @@ if "%SKIPBUILD%" EQU "1" goto skipdoc
8282
if "%SKIPDOC%" EQU "1" goto skipdoc
8383

8484
call "%D%..\..\doc\make.bat" htmlhelp
85-
if errorlevel 1 goto :eof
85+
if errorlevel 1 exit /B %ERRORLEVEL%
8686
:skipdoc
8787

8888
if defined BUILDX86 (
8989
call :build x86
90-
if errorlevel 1 exit /B
90+
if errorlevel 1 exit /B %ERRORLEVEL%
9191
)
9292

9393
if defined BUILDX64 (
9494
call :build x64 "%PGO%"
95-
if errorlevel 1 exit /B
95+
if errorlevel 1 exit /B %ERRORLEVEL%
9696
)
9797

9898
if defined BUILDARM64 (
9999
call :build ARM64
100-
if errorlevel 1 exit /B
100+
if errorlevel 1 exit /B %ERRORLEVEL%
101101
)
102102

103103
if defined TESTTARGETDIR (
104104
call "%D%testrelease.bat" -t "%TESTTARGETDIR%"
105+
if errorlevel 1 exit /B %ERRORLEVEL%
105106
)
106107

107108
exit /B 0
@@ -136,19 +137,19 @@ if "%1" EQU "x86" (
136137
if exist "%BUILD%en-us" (
137138
echo Deleting %BUILD%en-us
138139
rmdir /q/s "%BUILD%en-us"
139-
if errorlevel 1 exit /B
140+
if errorlevel 1 exit /B %ERRORLEVEL%
140141
)
141142

142143
if exist "%D%obj\Debug_%OBJDIR_PLAT%" (
143144
echo Deleting "%D%obj\Debug_%OBJDIR_PLAT%"
144145
rmdir /q/s "%D%obj\Debug_%OBJDIR_PLAT%"
145-
if errorlevel 1 exit /B
146+
if errorlevel 1 exit /B %ERRORLEVEL%
146147
)
147148

148149
if exist "%D%obj\Release_%OBJDIR_PLAT%" (
149150
echo Deleting "%D%obj\Release_%OBJDIR_PLAT%"
150151
rmdir /q/s "%D%obj\Release_%OBJDIR_PLAT%"
151-
if errorlevel 1 exit /B
152+
if errorlevel 1 exit /B %ERRORLEVEL%
152153
)
153154

154155
if not "%CERTNAME%" EQU "" (
@@ -164,37 +165,37 @@ if not "%PGO%" EQU "" (
164165
if not "%SKIPBUILD%" EQU "1" (
165166
@echo call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %PGOOPTS% %CERTOPTS%
166167
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %PGOOPTS% %CERTOPTS%
167-
@if errorlevel 1 exit /B
168+
@if errorlevel 1 exit /B %ERRORLEVEL%
168169
@rem build.bat turns echo back on, so we disable it again
169170
@echo off
170171

171172
@echo call "%PCBUILD%build.bat" -d -e -p %BUILD_PLAT% -t %TARGET%
172173
@call "%PCBUILD%build.bat" -d -e -p %BUILD_PLAT% -t %TARGET%
173-
@if errorlevel 1 exit /B
174+
@if errorlevel 1 exit /B %ERRORLEVEL%
174175
@rem build.bat turns echo back on, so we disable it again
175176
@echo off
176177
)
177178

178179
if "%OUTDIR_PLAT%" EQU "win32" (
179180
%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI%
180-
if errorlevel 1 exit /B
181+
if errorlevel 1 exit /B %ERRORLEVEL%
181182
) else if not exist "%Py_OutDir%win32\en-us\launcher.msi" (
182183
%MSBUILD% "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI%
183-
if errorlevel 1 exit /B
184+
if errorlevel 1 exit /B %ERRORLEVEL%
184185
)
185186

186187
set BUILDOPTS=/p:Platform=%1 /p:BuildForRelease=true /p:DownloadUrl=%DOWNLOAD_URL% /p:DownloadUrlBase=%DOWNLOAD_URL_BASE% /p:ReleaseUri=%RELEASE_URI%
187188
if defined BUILDMSI (
188189
%MSBUILD% "%D%bundle\releaselocal.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=true
189-
if errorlevel 1 exit /B
190+
if errorlevel 1 exit /B %ERRORLEVEL%
190191
)
191192

192193
if defined BUILDZIP (
193194
if "%BUILD_PLAT%" EQU "ARM64" (
194195
echo Skipping embeddable ZIP generation for ARM64 platform
195196
) else (
196197
%MSBUILD% "%D%make_zip.proj" /t:Build %BUILDOPTS% %CERTOPTS% /p:OutputPath="%BUILD%en-us"
197-
if errorlevel 1 exit /B
198+
if errorlevel 1 exit /B %ERRORLEVEL%
198199
)
199200
)
200201

@@ -203,7 +204,7 @@ if defined BUILDNUGET (
203204
echo Skipping Nuget package generation for ARM64 platform
204205
) else (
205206
%MSBUILD% "%D%..\nuget\make_pkg.proj" /t:Build /p:Configuration=Release /p:Platform=%1 /p:OutputPath="%BUILD%en-us"
206-
if errorlevel 1 exit /B
207+
if errorlevel 1 exit /B %ERRORLEVEL%
207208
)
208209
)
209210

0 commit comments

Comments
 (0)