set BUILDX64=\r
set TARGET=Rebuild\r
set TESTTARGETDIR=\r
+set PGO=\r
\r
\r
:CheckOpts\r
if "%1" EQU "--build" (set TARGET=Build) && shift && goto CheckOpts\r
if "%1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts\r
if "%1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts\r
+if "%1" EQU "--pgo" (set PGO=%~2) && shift && shift && goto CheckOpts\r
+\r
+if "%1" NEQ "" echo Invalid option: "%1" && exit /B 1\r
\r
if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1)\r
\r
)\r
\r
if defined BUILDX64 (\r
- call :build x64\r
+ call :build x64 "%PGO%"\r
if errorlevel 1 exit /B\r
)\r
\r
set BUILD_PLAT=Win32\r
set OUTDIR_PLAT=win32\r
set OBJDIR_PLAT=x86\r
-) ELSE (\r
- call "%PCBUILD%env.bat" x86_amd64\r
+) else if "%~2" NEQ "" (\r
+ call "%PCBUILD%env.bat" amd64\r
+ set PGO=%~2\r
+ set BUILD=%PCBUILD%amd64-pgo\\r
+ set BUILD_PLAT=x64\r
+ set OUTDIR_PLAT=amd64\r
+ set OBJDIR_PLAT=x64\r
+) else (\r
+ call "%PCBUILD%env.bat" amd64\r
set BUILD=%PCBUILD%amd64\\r
set BUILD_PLAT=x64\r
set OUTDIR_PLAT=amd64\r
)\r
\r
if not "%SKIPBUILD%" EQU "1" (\r
- call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -d -t %TARGET% %CERTOPTS%\r
- if errorlevel 1 exit /B\r
- call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %CERTOPTS%\r
- if errorlevel 1 exit /B\r
+ @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -d -t %TARGET% %CERTOPTS%\r
+ @if errorlevel 1 exit /B\r
@rem build.bat turns echo back on, so we disable it again\r
@echo off\r
+ \r
+ if "%PGO%" EQU "" (\r
+ @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -t %TARGET% %CERTOPTS%\r
+ ) else (\r
+ @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -c PGInstrument -t %TARGET% %CERTOPTS%\r
+ @if errorlevel 1 exit /B\r
+ \r
+ @del "%BUILD%*.pgc"\r
+ if "%PGO%" EQU "default" (\r
+ "%BUILD%python.exe" -m test -q --pgo\r
+ ) else if "%PGO%" EQU "default2" (\r
+ "%BUILD%python.exe" -m test -r -q --pgo\r
+ "%BUILD%python.exe" -m test -r -q --pgo\r
+ ) else if "%PGO%" EQU "default10" (\r
+ for /L %%i in (0, 1, 9) do "%BUILD%python.exe" -m test -q -r --pgo\r
+ ) else if "%PGO%" EQU "pybench" (\r
+ "%BUILD%python.exe" "%PCBUILD%..\Tools\pybench\pybench.py"\r
+ ) else (\r
+ "%BUILD%python.exe" %PGO%\r
+ )\r
+ \r
+ @call "%PCBUILD%build.bat" -e -p %BUILD_PLAT% -c PGUpdate -t %TARGET% %CERTOPTS%\r
+ )\r
+ @if errorlevel 1 exit /B\r
+ @echo off\r
)\r
\r
"%BUILD%python.exe" "%D%get_wix.py"\r
\r
set BUILDOPTS=/p:Platform=%1 /p:BuildForRelease=true /p:DownloadUrl=%DOWNLOAD_URL% /p:DownloadUrlBase=%DOWNLOAD_URL_BASE% /p:ReleaseUri=%RELEASE_URI%\r
+if "%PGO%" NEQ "" set BUILDOPTS=%BUILDOPTS% /p:PGOBuildPath=%BUILD%\r
msbuild "%D%bundle\releaselocal.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=true\r
if errorlevel 1 exit /B\r
msbuild "%D%bundle\releaseweb.wixproj" /t:Rebuild %BUILDOPTS% %CERTOPTS% /p:RebuildAll=false\r
\r
:Help\r
echo buildrelease.bat [--out DIR] [-x86] [-x64] [--certificate CERTNAME] [--build] [--skip-build]\r
-echo [--skip-doc] [--download DOWNLOAD URL] [--test TARGETDIR] [-h]\r
+echo [--pgo COMMAND] [--skip-doc] [--download DOWNLOAD URL] [--test TARGETDIR]\r
+echo [-h]\r
echo.\r
echo --out (-o) Specify an additional output directory for installers\r
echo -x86 Build x86 installers\r
echo --build (-b) Incrementally build Python rather than rebuilding\r
echo --skip-build (-B) Do not build Python (just do the installers)\r
echo --skip-doc (-D) Do not build documentation\r
+echo --pgo Build x64 installers using PGO\r
echo --download Specify the full download URL for MSIs\r
echo --test Specify the test directory to run the installer tests\r
echo -h Display this help information\r
echo If no architecture is specified, all architectures will be built.\r
echo If --test is not specified, the installer tests are not run.\r
echo.\r
+echo For the --pgo option, any Python command line can be used as well as the\r
+echo following shortcuts:\r
+echo Shortcut Description\r
+echo default Test suite with --pgo\r
+echo default2 2x test suite with --pgo and randomized test order\r
+echo default10 10x test suite with --pgo and randomized test order\r
+echo pybench pybench script\r
+echo.\r
echo The following substitutions will be applied to the download URL:\r
echo Variable Description Example\r
echo {version} version number 3.5.0\r