From c1e026a5f6f24b4638740f0a602119d22c2c5fef Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sat, 28 Oct 2017 09:00:35 -0400 Subject: [PATCH] build: quiet make.bash, make.bat, make.rc The signal-to-noise ratio is too low. Stop printing the name of every package. Can still get the old output with make.bash -v. Change-Id: Ib2c82e037166e6d2ddc31ae2a4d29af5becce574 Reviewed-on: https://go-review.googlesource.com/74351 Run-TryBot: Russ Cox Reviewed-by: Ian Lance Taylor Reviewed-by: David Crawshaw --- src/cmd/dist/build.go | 40 ++++++++++++++++++++++++++++++--------- src/cmd/dist/buildtool.go | 10 +++++++--- src/make.bash | 22 ++++++++++++++++----- src/make.bat | 21 ++++++++++++++++---- src/make.rc | 19 ++++++++++++++----- 5 files changed, 86 insertions(+), 26 deletions(-) diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 10035ccf8d..7334fca7fd 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1103,7 +1103,7 @@ func cmdbootstrap() { os.Setenv("GOOS", goos) timelog("build", "go_bootstrap") - xprintf("##### Building go_bootstrap.\n") + xprintf("Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.\n") for _, dir := range buildlist { installed[dir] = make(chan struct{}) } @@ -1111,7 +1111,9 @@ func cmdbootstrap() { go install(dir) } <-installed["cmd/go"] - xprintf("\n") + if vflag > 0 { + xprintf("\n") + } gogcflags = os.Getenv("GO_GCFLAGS") // we were using $BOOT_GO_GCFLAGS until now goldflags = os.Getenv("GO_LDFLAGS") @@ -1139,7 +1141,10 @@ func cmdbootstrap() { // toolchain2 = mk(new toolchain, toolchain1, go_bootstrap) // timelog("build", "toolchain2") - xprintf("\n##### Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") + if vflag > 0 { + xprintf("\n") + } + xprintf("Building Go toolchain2 using go_bootstrap and Go toolchain1.\n") os.Setenv("CC", defaultcc) if goos == oldgoos && goarch == oldgoarch { // Host and target are same, and we have historically @@ -1171,7 +1176,10 @@ func cmdbootstrap() { // toolchain3 = mk(new toolchain, toolchain2, go_bootstrap) // timelog("build", "toolchain3") - xprintf("\n##### Building Go toolchain3 using go_bootstrap and Go toolchain2.\n") + if vflag > 0 { + xprintf("\n") + } + xprintf("Building Go toolchain3 using go_bootstrap and Go toolchain2.\n") goInstall(append([]string{"-a"}, toolchain...)...) if debug { run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") @@ -1183,19 +1191,28 @@ func cmdbootstrap() { if goos == oldgoos && goarch == oldgoarch { // Common case - not setting up for cross-compilation. timelog("build", "toolchain") - xprintf("\n##### Building packages and commands for %s/%s\n", goos, goarch) + if vflag > 0 { + xprintf("\n") + } + xprintf("Building packages and commands for %s/%s.\n", goos, goarch) } else { // GOOS/GOARCH does not match GOHOSTOS/GOHOSTARCH. // Finish GOHOSTOS/GOHOSTARCH installation and then // run GOOS/GOARCH installation. timelog("build", "host toolchain") - xprintf("\n##### Building packages and commands for host, %s/%s\n", goos, goarch) + if vflag > 0 { + xprintf("\n") + } + xprintf("Building packages and commands for host, %s/%s.\n", goos, goarch) goInstall("std", "cmd") checkNotStale(goBootstrap, "std", "cmd") checkNotStale(cmdGo, "std", "cmd") timelog("build", "target toolchain") - xprintf("\n##### Building packages and commands for target, %s/%s\n", goos, goarch) + if vflag > 0 { + xprintf("\n") + } + xprintf("Building packages and commands for target, %s/%s.\n", goos, goarch) goos = oldgoos goarch = oldgoarch os.Setenv("GOOS", goos) @@ -1236,7 +1253,10 @@ func cmdbootstrap() { } func goInstall(args ...string) { - installCmd := []string{pathf("%s/go_bootstrap", tooldir), "install", "-v", "-gcflags=" + gogcflags, "-ldflags=" + goldflags} + installCmd := []string{pathf("%s/go_bootstrap", tooldir), "install", "-gcflags=" + gogcflags, "-ldflags=" + goldflags} + if vflag > 0 { + installCmd = append(installCmd, "-v") + } // Force only one process at a time on vx32 emulation. if gohostos == "plan9" && os.Getenv("sysname") == "vx32" { @@ -1383,7 +1403,9 @@ func cmdbanner() { } func banner() { - xprintf("\n") + if vflag > 0 { + xprintf("\n") + } xprintf("---\n") xprintf("Installed Go for %s/%s in %s\n", goos, goarch, goroot) xprintf("Installed commands in %s\n", gobin) diff --git a/src/cmd/dist/buildtool.go b/src/cmd/dist/buildtool.go index 4292e638bb..98d0b20596 100644 --- a/src/cmd/dist/buildtool.go +++ b/src/cmd/dist/buildtool.go @@ -106,7 +106,7 @@ func bootstrapBuildTools() { if goroot_bootstrap == "" { goroot_bootstrap = pathf("%s/go1.4", os.Getenv("HOME")) } - xprintf("##### Building Go toolchain1 using %s.\n", goroot_bootstrap) + xprintf("Building Go toolchain1 using %s.\n", goroot_bootstrap) mkzbootstrap(pathf("%s/src/cmd/internal/objabi/zbootstrap.go", goroot)) @@ -183,7 +183,9 @@ func bootstrapBuildTools() { "install", "-gcflags=-l", "-tags=math_big_pure_go compiler_bootstrap", - "-v", + } + if vflag > 0 { + cmd = append(cmd, "-v") } if tool := os.Getenv("GOBOOTSTRAP_TOOLEXEC"); tool != "" { cmd = append(cmd, "-toolexec="+tool) @@ -202,7 +204,9 @@ func bootstrapBuildTools() { } } - xprintf("\n") + if vflag > 0 { + xprintf("\n") + } } var ssaRewriteFileSubstring = filepath.FromSlash("src/cmd/compile/internal/ssa/rewrite") diff --git a/src/make.bash b/src/make.bash index 9827abd331..f3614f8e5b 100755 --- a/src/make.bash +++ b/src/make.bash @@ -125,10 +125,20 @@ rm -f ./runtime/runtime_defs.go # Finally! Run the build. -echo '##### Building Go bootstrap tool.' -echo cmd/dist -export GOROOT="$(cd .. && pwd)" +verbose=false +vflag="" +if [ "$1" = "-v" ]; then + verbose=true + vflag=-v + shift +fi + export GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4} +echo "Building Go cmd/dist using $GOROOT_BOOTSTRAP." +if $verbose; then + echo cmd/dist +fi +export GOROOT="$(cd .. && pwd)" for go_exe in $(type -ap go); do if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then goroot=$(GOROOT='' $go_exe env GOROOT) @@ -156,7 +166,9 @@ if [ "$FAIL" = true ]; then exit 1 fi -echo +if $verbose; then + echo +fi if [ "$1" = "--dist-tool" ]; then # Stop after building dist tool. @@ -177,7 +189,7 @@ fi # Run dist bootstrap to complete make.bash. # Bootstrap installs a proper cmd/dist, built with the new toolchain. # Throw ours, built with Go 1.4, away after bootstrap. -./cmd/dist/dist bootstrap $buildall -v $GO_DISTFLAGS "$@" +./cmd/dist/dist bootstrap $buildall $vflag $GO_DISTFLAGS "$@" rm -f ./cmd/dist/dist # DO NOT ADD ANY NEW CODE HERE. diff --git a/src/make.bat b/src/make.bat index 101fc4bb1a..be164e8df1 100644 --- a/src/make.bat +++ b/src/make.bat @@ -41,6 +41,8 @@ :: unless invoked with --no-local. if x%1==x--no-local goto nolocal if x%2==x--no-local goto nolocal +if x%3==x--no-local goto nolocal +if x%4==x--no-local goto nolocal setlocal :nolocal @@ -58,12 +60,17 @@ del /F ".\pkg\runtime\runtime_defs.go" 2>NUL cd .. set GOROOT=%CD% cd src +set vflag= +if x%1==x-v set vflag=-v +if x%2==x-v set vflag=-v +if x%3==x-v set vflag=-v +if x%4==x-v set vflag=-v -echo ##### Building Go bootstrap tool. -echo cmd/dist if not exist ..\bin\tool mkdir ..\bin\tool if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4 if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail +echo Building Go cmd/dist using %GOROOT_BOOTSTRAP% +if x%vflag==x-v echo cmd/dist setlocal set GOROOT=%GOROOT_BOOTSTRAP% set GOOS= @@ -76,21 +83,27 @@ if errorlevel 1 goto fail if errorlevel 1 goto fail call env.bat del env.bat -echo. +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 set buildall=-a if x%1==x--no-clean set buildall= if x%2==x--no-clean set buildall= +if x%3==x--no-clean set buildall= +if x%4==x--no-clean set buildall= if x%1==x--no-banner set buildall=%buildall% --no-banner if x%2==x--no-banner set buildall=%buildall% --no-banner +if x%3==x--no-banner set buildall=%buildall% --no-banner +if x%4==x--no-banner set buildall=%buildall% --no-banner :: Run dist bootstrap to complete make.bash. :: Bootstrap installs a proper cmd/dist, built with the new toolchain. :: Throw ours, built with Go 1.4, away after bootstrap. -.\cmd\dist\dist bootstrap %buildall% -v +.\cmd\dist\dist bootstrap %vflag% %buildall% if errorlevel 1 goto fail del .\cmd\dist\dist.exe goto end diff --git a/src/make.rc b/src/make.rc index 7704b12417..7ae6221b38 100755 --- a/src/make.rc +++ b/src/make.rc @@ -41,8 +41,13 @@ rm -f ./runtime/runtime_defs.go # Determine the host compiler toolchain. eval `{grep '^(CC|LD|O)=' /$objtype/mkfile} -echo '##### Building Go bootstrap tool.' -echo cmd/dist +vflag=() +if(~ $1 -v) { + vflag=(-v) + shift +} + + GOROOT = `{cd .. && pwd} if(! ~ $#GOROOT_BOOTSTRAP 1) GOROOT_BOOTSTRAP = $home/go1.4 @@ -66,11 +71,15 @@ if(~ $GOROOT_BOOTSTRAP $GOROOT){ echo 'Set $GOROOT_BOOTSTRAP to a working Go tree >= Go 1.4.' >[1=2] exit bootstrap } -rm -f cmd/dist/dist + +echo 'Building Go cmd/dist using '^$GOROOT_BOOTSTRAP +if(~ $#vflag 1) + echo cmd/dist GOROOT=$GOROOT_BOOTSTRAP GOOS='' GOARCH='' $GOROOT_BOOTSTRAP/bin/go build -o cmd/dist/dist ./cmd/dist eval `{./cmd/dist/dist env -9} -echo +if(~ $#vflag 1) + echo if(~ $1 --dist-tool){ # Stop after building dist tool. @@ -89,7 +98,7 @@ if(~ $1 --no-clean) { # Run dist bootstrap to complete make.bash. # Bootstrap installs a proper cmd/dist, built with the new toolchain. # Throw ours, built with Go 1.4, away after bootstrap. -./cmd/dist/dist bootstrap -v $buildall $* +./cmd/dist/dist bootstrap $vflag $buildall $* rm -f ./cmd/dist/dist # DO NOT ADD ANY NEW CODE HERE. -- 2.48.1