]> granicus.if.org Git - python/commitdiff
Enabled --pgo option for building 64-bit PGO enabled releases.
authorSteve Dower <steve.dower@microsoft.com>
Wed, 14 Oct 2015 17:40:09 +0000 (10:40 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Wed, 14 Oct 2015 17:40:09 +0000 (10:40 -0700)
Tools/msi/buildrelease.bat
Tools/msi/msi.props

index ea251347150616c95c7738b766f69c226641b1af..ca08df8403234786d02c80ea21043f304af9b3f0 100644 (file)
@@ -34,6 +34,7 @@ set BUILDX86=
 set BUILDX64=\r
 set TARGET=Rebuild\r
 set TESTTARGETDIR=\r
+set PGO=\r
 \r
 \r
 :CheckOpts\r
@@ -52,6 +53,9 @@ if "%1" EQU "-b" (set TARGET=Build) && shift && goto CheckOpts
 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
@@ -81,7 +85,7 @@ if defined BUILDX86 (
 )\r
 \r
 if defined BUILDX64 (\r
-    call :build x64\r
+    call :build x64 "%PGO%"\r
     if errorlevel 1 exit /B\r
 )\r
 \r
@@ -101,8 +105,15 @@ if "%1" EQU "x86" (
     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
@@ -128,17 +139,41 @@ if not "%CERTNAME%" EQU "" (
 )\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
@@ -158,7 +193,8 @@ exit /B 0
 \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
@@ -166,6 +202,7 @@ echo    -x64                Build x64 installers
 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
@@ -173,6 +210,14 @@ echo.
 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
index 5b605e95e9220086cea1dc137b863c7cea32d290..1e2d3e28f57ae74312410e169b37a237dc089a47 100644 (file)
         </LinkerBindInputPaths>
     </ItemDefinitionGroup>
     <ItemGroup>
-        <LinkerBindInputPaths Include="$(BuildPath);$(PySourcePath)Doc\build\htmlhelp">
+        <LinkerBindInputPaths Include="$(PGOBuildPath);$(BuildPath)">
+            <BindName></BindName>
+        </LinkerBindInputPaths>
+        <LinkerBindInputPaths Include="$(PySourcePath)Doc\build\htmlhelp">
             <BindName></BindName>
         </LinkerBindInputPaths>
         <LinkerBindInputPaths Include="$(PySourcePath)">