Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4468bed

Browse files
committed
Issue #28573: Avoid setting up env too many times during build
1 parent 6bf87d3 commit 4468bed

2 files changed

Lines changed: 10 additions & 37 deletions

File tree

PCbuild/build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ if "%do_pgo%"=="true" (
120120
@echo off
121121
call :Kill
122122
set conf=PGUpdate
123+
set target=Build
123124
)
124125
goto Build
125-
126126
:Kill
127127
echo on
128128
msbuild "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^

Tools/msi/buildrelease.bat

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set BUILDX86=
3535
set BUILDX64=
3636
set TARGET=Rebuild
3737
set TESTTARGETDIR=
38-
set PGO=default
38+
set PGO=-m test -q --pgo
3939
set BUILDNUGET=1
4040
set BUILDZIP=1
4141

@@ -109,14 +109,12 @@ exit /B 0
109109
@echo off
110110

111111
if "%1" EQU "x86" (
112-
call "%PCBUILD%env.bat" x86
113112
set PGO=
114113
set BUILD=%PCBUILD%win32\
115114
set BUILD_PLAT=Win32
116115
set OUTDIR_PLAT=win32
117116
set OBJDIR_PLAT=x86
118117
) else (
119-
call "%PCBUILD%env.bat" amd64
120118
set BUILD=%PCBUILD%amd64\
121119
set PGO=%~2
122120
set BUILD_PLAT=x64
@@ -143,37 +141,18 @@ if not "%CERTNAME%" EQU "" (
143141
)
144142

145143
if not "%SKIPBUILD%" EQU "1" (
146-
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -d -t %TARGET% %CERTOPTS%
147-
@if errorlevel 1 exit /B
148-
@rem build.bat turns echo back on, so we disable it again
149-
@echo off
150-
151144
if "%PGO%" EQU "" (
152-
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %CERTOPTS%
145+
set PGOOPTS=
153146
) else (
154-
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -c PGInstrument -t %TARGET% %CERTOPTS%
155-
@if errorlevel 1 exit /B
156-
157-
@del "%BUILD%*.pgc"
158-
if "%PGO%" EQU "default" (
159-
"%BUILD%python.exe" -m test -q --pgo
160-
) else if "%PGO%" EQU "default2" (
161-
"%BUILD%python.exe" -m test -r -q --pgo
162-
"%BUILD%python.exe" -m test -r -q --pgo
163-
) else if "%PGO%" EQU "default10" (
164-
for /L %%i in (0, 1, 9) do "%BUILD%python.exe" -m test -q -r --pgo
165-
) else if "%PGO%" EQU "pybench" (
166-
"%BUILD%python.exe" "%PCBUILD%..\Tools\pybench\pybench.py"
167-
) else (
168-
"%BUILD%python.exe" %PGO%
169-
)
170-
171-
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -c PGUpdate -t Build %CERTOPTS%
147+
set PGOOPTS=--pgo --pgojob "%PGO%"
172148
)
149+
@call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %CERTOPTS% %PGOOPTS%
173150
@if errorlevel 1 exit /B
151+
@rem build.bat turns echo back on, so we disable it again
174152
@echo off
175153
)
176154

155+
call "%PCBUILD%env.bat"
177156
if "%OUTDIR_PLAT%" EQU "win32" (
178157
msbuild "%D%launcher\launcher.wixproj" /p:Platform=x86 %CERTOPTS% /p:ReleaseUri=%RELEASE_URI%
179158
if errorlevel 1 exit /B
@@ -222,24 +201,18 @@ echo --build (-b) Incrementally build Python rather than rebuilding
222201
echo --skip-build (-B) Do not build Python (just do the installers)
223202
echo --skip-doc (-D) Do not build documentation
224203
echo --pgo Specify PGO command for x64 installers
225-
echo --skip-pgo Build x64 installers using PGO
204+
echo --skip-pgo Build x64 installers without using PGO
226205
echo --skip-nuget Do not build Nuget packages
227206
echo --skip-zip Do not build embeddable package
228-
echo --pgo Build x64 installers using PGO
229207
echo --download Specify the full download URL for MSIs
230208
echo --test Specify the test directory to run the installer tests
231209
echo -h Display this help information
232210
echo.
233211
echo If no architecture is specified, all architectures will be built.
234212
echo If --test is not specified, the installer tests are not run.
235213
echo.
236-
echo For the --pgo option, any Python command line can be used as well as the
237-
echo following shortcuts:
238-
echo Shortcut Description
239-
echo default Test suite with --pgo
240-
echo default2 2x test suite with --pgo and randomized test order
241-
echo default10 10x test suite with --pgo and randomized test order
242-
echo pybench pybench script
214+
echo For the --pgo option, any Python command line can be used, or 'default' to
215+
echo use the default task (-m test --pgo).
243216
echo.
244217
echo The following substitutions will be applied to the download URL:
245218
echo Variable Description Example

0 commit comments

Comments
 (0)