From: qmuntal Date: Tue, 11 Feb 2025 18:23:11 +0000 (+0000) Subject: make.bat,race.bat: simplify --dist-tool handling X-Git-Tag: go1.25rc1~1071 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=30f515898c9852f0529fe42b46c8b89d00e14949;p=gostls13.git make.bat,race.bat: simplify --dist-tool handling make.bat accepts the --dist-tool flag on multiple flag positions and also allows omitting the trailing dash. Doing so adds complexity and is not aligned with the make.bash and make.rc behavior. Remove that flexibility to simplify the code and make it more consistent. This also fixes a bug where dist.exe wouldn't be removed from cmd\dist when running make.bat --dist-tool. Also, there is no need for race.bat to invoke make.bat with --dist-tool. It uses it to get the GOHOSTARCH env value, but we can already get that from the built-in PROCESSOR_ARCHITECTURE env variable. Change-Id: Ia673562c1ae6aff9bd3ec7aa8cdd25ff187eeb79 Reviewed-on: https://go-review.googlesource.com/c/go/+/648615 Reviewed-by: Damien Neil Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui --- diff --git a/src/make.bat b/src/make.bat index 890829131b..6c683230ce 100644 --- a/src/make.bat +++ b/src/make.bat @@ -101,14 +101,14 @@ call .\env.bat del env.bat if x%vflag==x-v echo. -if x%1==x-dist-tool goto copydist -if x%2==x-dist-tool goto copydist -if x%3==x-dist-tool goto copydist -if x%4==x-dist-tool goto copydist -if x%1==x--dist-tool goto copydist -if x%2==x--dist-tool goto copydist -if x%3==x--dist-tool goto copydist -if x%4==x--dist-tool goto copydist +if x%1==x--dist-tool ( + mkdir "%GOTOOLDIR%" 2>NUL + if not x%2==x ( + copy cmd\dist\dist.exe "%2" + ) + move cmd\dist\dist.exe "%GOTOOLDIR%\dist.exe" + goto :eof +) :: Run dist bootstrap to complete make.bash. :: Bootstrap installs a proper cmd/dist, built with the new toolchain. @@ -123,11 +123,6 @@ goto :eof :: to avoid needing three copies in three different shell languages :: (make.bash, make.bat, make.rc). -:copydist -mkdir "%GOTOOLDIR%" 2>NUL -copy cmd\dist\dist.exe "%GOTOOLDIR%\" -goto :eof - :nogoenv set GO111MODULE=off set GOENV=off diff --git a/src/race.bat b/src/race.bat index 60fcfb90c7..206d4126ee 100644 --- a/src/race.bat +++ b/src/race.bat @@ -14,13 +14,7 @@ if not exist make.bat ( exit /b 1 ) -set GOROOT=%CD%\.. -call .\make.bat --dist-tool >NUL || exit /b 1 -.\cmd\dist\dist.exe env -w -p >env.bat || exit /b 1 -call .\env.bat -del env.bat - -if not %GOHOSTARCH% == amd64 ( +if not "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( echo Race detector is only supported on windows/amd64. exit /b 1 )