diff options
author | Tobias Bosch <tbosch@google.com> | 2019-06-20 17:47:19 -0700 |
---|---|---|
committer | Tobias Bosch <tbosch@google.com> | 2019-06-25 14:47:26 +0000 |
commit | aa31116c1d7c2491245604f0564e0693f22dfd71 (patch) | |
tree | 4fd8fb92a9a459bb718f8d0c943a05632defbd08 /compiler_wrapper/main.go | |
parent | b9992bba3b4e752f10410c624a500762d090fa2b (diff) | |
download | toolchain-utils-aa31116c1d7c2491245604f0564e0693f22dfd71.tar.gz |
Allow to pass in the use_ccache via go build.
Removes usage of go build tags in favor of passing in
configuration via -ldflags -X ...
BUG=chromium:773875
TEST=unit test
Change-Id: I4e8a58e1679b2858e9d4620d6b9c7a35ad08a6ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1670987
Reviewed-by: George Burgess <gbiv@chromium.org>
Tested-by: Tobias Bosch <tbosch@google.com>
Diffstat (limited to 'compiler_wrapper/main.go')
-rw-r--r-- | compiler_wrapper/main.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/compiler_wrapper/main.go b/compiler_wrapper/main.go index 5323a301..9e131329 100644 --- a/compiler_wrapper/main.go +++ b/compiler_wrapper/main.go @@ -1,13 +1,11 @@ -// +build cros - -// This binary uses the following build tags: -// - cros: Whether the wrapper should be built for ChromeOS -// - nonhardened: For a non-hardened set of compiler flags -// - hardened: For a hardened set of compiler flags +// This binary requires the following linker variables: +// - main.UseCCache: Whether to use ccache. +// - main.ConfigName: Name of the configuration to use. +// See config.go for the supported values. // -// There is a bash script for every meaningful combination. -// E.g. ./build_cros_hardened_wrapper.sh will build the ChromeOS -// hardened compiler wrapper. +// The script ./build simplifies the call to `go build`. +// E.g. ./build --use_ccache=true --config=cros.hardened will build a +// binary that uses the ccache for ChromeOS with hardened flags. // // Test arguments: // - crosroot: Specifies the ChromeOS toolchain root directory (aka chroot). @@ -33,7 +31,10 @@ func main() { if err != nil { log.Fatal(err) } - cfg := getRealConfig() + cfg, err := getRealConfig() + if err != nil { + log.Fatal(err) + } if shouldForwardToOldWrapper(env, wrapperCmd) { err := forwardToOldWrapper(env, cfg, wrapperCmd) if err != nil { |