summaryrefslogtreecommitdiffstats
path: root/PCbuild/build.bat
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2021-04-06 22:54:43 (GMT)
committerGitHub <noreply@github.com>2021-04-06 22:54:43 (GMT)
commit748283819043c60b1cb272c2cc9ab5b457afb03a (patch)
tree2196786e4df24aa8c9361036794b80ad0f50f01b /PCbuild/build.bat
parent0fdf11e8e901a5f47149232557a7f9726b8177c9 (diff)
downloadcpython-748283819043c60b1cb272c2cc9ab5b457afb03a.zip
cpython-748283819043c60b1cb272c2cc9ab5b457afb03a.tar.gz
cpython-748283819043c60b1cb272c2cc9ab5b457afb03a.tar.bz2
bpo-43567: Improved generated code refresh on Windows (GH-25120)
Generated files are now refreshed automatically on regular build, or may be forcibly regenerated by calling `build.bat --regen`.
Diffstat (limited to 'PCbuild/build.bat')
-rw-r--r--PCbuild/build.bat27
1 files changed, 17 insertions, 10 deletions
diff --git a/PCbuild/build.bat b/PCbuild/build.bat
index 5a41ca5..d333cea 100644
--- a/PCbuild/build.bat
+++ b/PCbuild/build.bat
@@ -34,7 +34,7 @@ echo. automatically by the pythoncore project)
echo. --pgo Build with Profile-Guided Optimization. This flag
echo. overrides -c and -d
echo. --test-marker Enable the test marker within the build.
-echo. --regen Regenerate all opcodes, grammar and tokens
+echo. --regen Regenerate all opcodes, grammar and tokens.
echo.
echo.Available flags to avoid building certain modules.
echo.These flags have no effect if '-e' is not given:
@@ -116,8 +116,14 @@ rem Setup the environment
call "%dir%find_msbuild.bat" %MSBUILD%
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
+call "%dir%find_python.bat" %PYTHON%
+if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3)
+set PythonForBuild=%PYTHON%
+
if "%kill%"=="true" call :Kill
-if ERRORLEVEL 1 exit /B 3
+if ERRORLEVEL 1 exit /B %ERRORLEVEL%
+
+if "%regen%"=="true" goto :Regen
if "%do_pgo%"=="true" (
set conf=PGInstrument
@@ -147,6 +153,15 @@ echo on
@echo off
exit /B %ERRORLEVEL%
+:Regen
+echo on
+%MSBUILD% "%dir%\pythoncore.vcxproj" /t:Regen %verbose%^
+ /p:Configuration=%conf% /p:Platform=%platf%^
+ /p:ForceRegen=true
+
+@echo off
+exit /B %ERRORLEVEL%
+
:Build
rem Call on MSBuild to do the work, echo the command.
rem Passing %1-9 is not the preferred option, but argument parsing in
@@ -160,14 +175,6 @@ echo on
/p:UseTestMarker=%UseTestMarker% %GITProperty%^
%1 %2 %3 %4 %5 %6 %7 %8 %9
-@if not ERRORLEVEL 1 @if "%Regen%"=="true" (
- %MSBUILD% "%dir%regen.vcxproj" /t:%target% %parallel% %verbose%^
- /p:IncludeExternals=%IncludeExternals%^
- /p:Configuration=%conf% /p:Platform=%platf%^
- /p:UseTestMarker=%UseTestMarker% %GITProperty%^
- %1 %2 %3 %4 %5 %6 %7 %8 %9
-)
-
@echo off
exit /b %ERRORLEVEL%