diff --git a/Misc/NEWS.d/next/Build/2026-02-22-13-35-20.gh-issue-145110.KgWofW.rst b/Misc/NEWS.d/next/Build/2026-02-22-13-35-20.gh-issue-145110.KgWofW.rst new file mode 100644 index 00000000000000..035d0c141d36ed --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-02-22-13-35-20.gh-issue-145110.KgWofW.rst @@ -0,0 +1,2 @@ +Fix targets "Clean" and "CLeanAll" in case of PGO builds on Windows. Patch by +Chris Eibl. diff --git a/PCbuild/build.bat b/PCbuild/build.bat index 8c24309be262ba..8fb2f096c93c0e 100644 --- a/PCbuild/build.bat +++ b/PCbuild/build.bat @@ -66,6 +66,7 @@ setlocal set platf=x64 set conf=Release set target=Build +set clean=false set dir=%~dp0 set parallel=/m set verbose=/nologo /v:m /clp:summary @@ -119,6 +120,9 @@ if "%UseJIT%" NEQ "true" set IncludeLLVM=false if "%IncludeExternals%"=="true" call "%dir%get_externals.bat" +if /I "%target%"=="Clean" set clean=true +if /I "%target%"=="CleanAll" set clean=true + if "%do_pgo%" EQU "true" if "%platf%" EQU "x64" ( if "%PROCESSOR_ARCHITEW6432%" NEQ "AMD64" if "%PROCESSOR_ARCHITECTURE%" NEQ "AMD64" ( echo.ERROR: Cannot cross-compile with PGO @@ -159,15 +163,20 @@ if "%do_pgo%"=="true" ( rem %VARS% are evaluated eagerly, which would lose the ERRORLEVEL rem value if we didn't split it out here. if "%do_pgo%"=="true" if ERRORLEVEL 1 exit /B %ERRORLEVEL% + +rem In case of a PGO build, we switch the conf here to PGUpdate +rem to get it cleaned or built as well. if "%do_pgo%"=="true" ( del /s "%dir%\*.pgc" del /s "%dir%\..\Lib\*.pyc" - echo on - call "%dir%\..\python.bat" %pgo_job% - @echo off - call :Kill set conf=PGUpdate - set target=Build + if "%clean%"=="false" ( + echo on + call "%dir%\..\python.bat" %pgo_job% + @echo off + call :Kill + set target=Build + ) ) goto :Build