Commit 32cb495b authored by Alex Brainman's avatar Alex Brainman

build: keep environment variable changes local during Windows build

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5673048
parent 79db6ada
...@@ -3,20 +3,19 @@ ...@@ -3,20 +3,19 @@
:: license that can be found in the LICENSE file. :: license that can be found in the LICENSE file.
@echo off @echo off
setlocal
if exist make.bat goto ok if exist make.bat goto ok
echo all.bat must be run from go\src echo all.bat must be run from go\src
:: cannot exit: would kill parent command interpreter :: cannot exit: would kill parent command interpreter
goto end goto end
:ok :ok
set GOOLDPATH=%PATH% call make.bat --no-banner --no-local
call make.bat --no-banner
if %GOBUILDFAIL%==1 goto end if %GOBUILDFAIL%==1 goto end
call run.bat --no-rebuild call run.bat --no-rebuild
if %GOBUILDFAIL%==1 goto end if %GOBUILDFAIL%==1 goto end
go tool dist banner go tool dist banner
:end :end
set PATH=%GOOLDPATH%
if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL% if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%
...@@ -3,6 +3,13 @@ ...@@ -3,6 +3,13 @@
:: license that can be found in the LICENSE file. :: license that can be found in the LICENSE file.
@echo off @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 set GOBUILDFAIL=0
if exist make.bat goto ok if exist make.bat goto ok
...@@ -48,13 +55,11 @@ goto mainbuild ...@@ -48,13 +55,11 @@ goto mainbuild
:localbuild :localbuild
echo # Building tools for local system. %GOHOSTOS%/%GOHOSTARCH% echo # Building tools for local system. %GOHOSTOS%/%GOHOSTARCH%
set oldGOOS=%GOOS% setlocal
set oldGOARCH=%GOARCH%
set GOOS=%GOHOSTOS% set GOOS=%GOHOSTOS%
set GOARCH=%GOHOSTARCH% set GOARCH=%GOHOSTARCH%
%GOTOOLDIR%\go_bootstrap install -v std %GOTOOLDIR%\go_bootstrap install -v std
set GOOS=%oldGOOS% endlocal
set GOARCH=%oldGOARCH%
if errorlevel 1 goto fail if errorlevel 1 goto fail
echo . echo .
...@@ -65,7 +70,7 @@ if errorlevel 1 goto fail ...@@ -65,7 +70,7 @@ if errorlevel 1 goto fail
del %GOTOOLDIR%\go_bootstrap.exe del %GOTOOLDIR%\go_bootstrap.exe
echo . echo .
if "x%1"=="x--no-banner" goto nobanner if x%1==x--no-banner goto nobanner
%GOTOOLDIR%\dist banner %GOTOOLDIR%\dist banner
:nobanner :nobanner
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment