]> Cypherpunks repositories - gostls13.git/commitdiff
make.bat,race.bat: simplify --dist-tool handling
authorqmuntal <quimmuntal@gmail.com>
Tue, 11 Feb 2025 18:23:11 +0000 (18:23 +0000)
committerQuim Muntal <quimmuntal@gmail.com>
Wed, 12 Feb 2025 07:09:26 +0000 (23:09 -0800)
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 <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/make.bat
src/race.bat

index 890829131ba3170076159673f5cc21192f82a366..6c683230ce17146caf0f56bd96ff4716b971f365 100644 (file)
@@ -101,14 +101,14 @@ call .\env.bat
 del env.bat\r
 if x%vflag==x-v echo.\r
 \r
-if x%1==x-dist-tool goto copydist\r
-if x%2==x-dist-tool goto copydist\r
-if x%3==x-dist-tool goto copydist\r
-if x%4==x-dist-tool goto copydist\r
-if x%1==x--dist-tool goto copydist\r
-if x%2==x--dist-tool goto copydist\r
-if x%3==x--dist-tool goto copydist\r
-if x%4==x--dist-tool goto copydist\r
+if x%1==x--dist-tool (\r
+       mkdir "%GOTOOLDIR%" 2>NUL\r
+       if not x%2==x (\r
+               copy cmd\dist\dist.exe "%2"\r
+       )\r
+       move cmd\dist\dist.exe "%GOTOOLDIR%\dist.exe"\r
+       goto :eof\r
+)\r
 \r
 :: Run dist bootstrap to complete make.bash.\r
 :: Bootstrap installs a proper cmd/dist, built with the new toolchain.\r
@@ -123,11 +123,6 @@ goto :eof
 :: to avoid needing three copies in three different shell languages\r
 :: (make.bash, make.bat, make.rc).\r
 \r
-:copydist\r
-mkdir "%GOTOOLDIR%" 2>NUL\r
-copy cmd\dist\dist.exe "%GOTOOLDIR%\"\r
-goto :eof\r
-\r
 :nogoenv\r
 set GO111MODULE=off\r
 set GOENV=off\r
index 60fcfb90c76275edd8161801a6148c37e008944f..206d4126eea64804f3cb0035c64827b3fe3f1f27 100644 (file)
@@ -14,13 +14,7 @@ if not exist make.bat (
     exit /b 1\r
 )\r
 \r
-set GOROOT=%CD%\..\r
-call .\make.bat --dist-tool >NUL || exit /b 1\r
-.\cmd\dist\dist.exe env -w -p >env.bat || exit /b 1\r
-call .\env.bat\r
-del env.bat\r
-\r
-if not %GOHOSTARCH% == amd64 (\r
+if not "%PROCESSOR_ARCHITECTURE%"=="AMD64" (\r
     echo Race detector is only supported on windows/amd64.\r
     exit /b 1\r
 )\r