1
0
mirror of https://github.com/golang/go synced 2024-11-22 14:54:46 -07:00
go/src/buildall.bash
Dmitri Shuralyov 77863e4243 src/buildall.bash: mention no longer being used by Go build system
The buildall.bash script was initially added in 2015 (in CL 9438),
documented as used in the implementation of the new compile-only
builders at the time.

That description was updated as the builder implementation changed
from "linux-amd64-compilesmoke" to "all-compile" and most recently
to "misc-compile", which it still mentions today.

The build system stopped using it in CL 464955 and there are no plans
to use it again in the future, so update the description so that it's
not misleading. Notably, adding additional checks to this script does
not mean they will be caught by builders.

Updates #31916.
Updates #58163.

Change-Id: I17558b1c150a3ad95105de14511c51791287991b
Reviewed-on: https://go-review.googlesource.com/c/go/+/513755
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-07-27 17:32:27 +00:00

93 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright 2015 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Usage: buildall.bash [-e] [pattern]
#
# buildall.bash builds the standard library for all Go-supported
# architectures.
#
# Originally the Go build system used it as a smoke test to quickly
# flag portability issues in builders named "misc-compile" or "all-compile".
# As of CL 464955, the build system uses make.bash -compile-only instead,
# so this script no longer runs in any automated fashion.
#
# Options:
# -e: stop at first failure
if [ ! -f run.bash ]; then
echo 'buildall.bash must be run from $GOROOT/src' 1>&2
exit 1
fi
sete=false
if [ "$1" = "-e" ]; then
sete=true
shift
fi
if [ "$sete" = true ]; then
set -e
fi
pattern="$1"
if [ "$pattern" = "" ]; then
pattern=.
fi
./make.bash || exit 1
GOROOT="$(cd .. && pwd)"
gettargets() {
../bin/go tool dist list | sed -e 's|/|-|' |
egrep -v '^(android|ios)' # need C toolchain even for cross-compiling
echo linux-arm-arm5
}
selectedtargets() {
gettargets | grep -E "$pattern"
}
# put linux first in the target list to get all the architectures up front.
linux_targets() {
selectedtargets | grep 'linux' | sort
}
non_linux_targets() {
selectedtargets | grep -v 'linux' | sort
}
# Note words in $targets are separated by both newlines and spaces.
targets="$(linux_targets) $(non_linux_targets)"
failed=false
for target in $targets
do
echo ""
echo "### Building $target"
export GOOS=$(echo $target | sed 's/-.*//')
export GOARCH=$(echo $target | sed 's/.*-//')
unset GOARM
if [ "$GOARCH" = "arm5" ]; then
export GOARCH=arm
export GOARM=5
fi
# Build and vet everything.
# cmd/go/internal/work/exec.go enables the same vet flags during go test of std cmd
# and should be kept in sync with any vet flag changes here.
if ! "$GOROOT/bin/go" build std cmd || ! "$GOROOT/bin/go" vet -unsafeptr=false std cmd; then
failed=true
if $sete; then
exit 1
fi
fi
done
if [ "$failed" = "true" ]; then
echo "" 1>&2
echo "Build(s) failed." 1>&2
exit 1
fi