]> Cypherpunks repositories - gostls13.git/commitdiff
build: keep environment variable changes local during Windows build
authorAlex Brainman <alex.brainman@gmail.com>
Wed, 15 Feb 2012 23:26:01 +0000 (10:26 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Wed, 15 Feb 2012 23:26:01 +0000 (10:26 +1100)
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5673048

src/all.bat
src/make.bat

index 7792cf17462ba76729194ee58f24792de07604b7..980f937efc94bd1a77f688ec2626651c19b500bf 100644 (file)
@@ -3,20 +3,19 @@
 :: license that can be found in the LICENSE file.
 @echo off
 
+setlocal
+
 if exist make.bat goto ok
 echo all.bat must be run from go\src
 :: cannot exit: would kill parent command interpreter
 goto end
 :ok
 
-set GOOLDPATH=%PATH%
-
-call make.bat --no-banner
+call make.bat --no-banner --no-local
 if %GOBUILDFAIL%==1 goto end
 call run.bat --no-rebuild
 if %GOBUILDFAIL%==1 goto end
 go tool dist banner
 
 :end
-set PATH=%GOOLDPATH%
 if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%
index 6618bc4ed98283a2fc6a0d04f96a06c1ade7eca3..e6921aa7916ff353efb7f167cc981e28b8fc834a 100644 (file)
@@ -3,6 +3,13 @@
 :: license that can be found in the LICENSE file.
 @echo off
 
+:: Keep environment variables within this script
+:: unless invoked with --no-local.
+if x%1==x--no-local goto nolocal
+if x%2==x--no-local goto nolocal
+setlocal
+:nolocal
+
 set GOBUILDFAIL=0
 
 if exist make.bat goto ok
@@ -48,13 +55,11 @@ goto mainbuild
 
 :localbuild
 echo # Building tools for local system. %GOHOSTOS%/%GOHOSTARCH%
-set oldGOOS=%GOOS%
-set oldGOARCH=%GOARCH%
+setlocal
 set GOOS=%GOHOSTOS%
 set GOARCH=%GOHOSTARCH%
 %GOTOOLDIR%\go_bootstrap install -v std
-set GOOS=%oldGOOS%
-set GOARCH=%oldGOARCH%
+endlocal
 if errorlevel 1 goto fail
 echo .
 
@@ -65,7 +70,7 @@ if errorlevel 1 goto fail
 del %GOTOOLDIR%\go_bootstrap.exe
 echo .
 
-if "x%1"=="x--no-banner" goto nobanner
+if x%1==x--no-banner goto nobanner
 %GOTOOLDIR%\dist banner
 :nobanner