| 1 |
#!/bin/bash |
| 2 |
# Copyright 2022 Google LLC |
| 3 |
# |
| 4 |
# Use of this source code is governed by a BSD-style license that can be |
| 5 |
# found in the LICENSE file. |
| 6 |
# |
| 7 |
# Takes two arguments. |
| 8 |
# First argument is the output directory where executables are to be placed. |
| 9 |
# Second (optional) argument is the target platform. These are formatted as os_arch |
| 10 |
# https://github.com/bazelbuild/rules_go/blob/e9a7054ff11a520e3b8aceb76a3ba44bb8da4c94/go/toolchain/toolchains.bzl#L22 |
| 11 |
|
| 12 |
set -x -e |
| 13 |
|
| 14 |
# Navigate to the root of the infra checkout. |
| 15 |
cd $(dirname ${BASH_SOURCE[0]}) |
| 16 |
cd ../.. |
| 17 |
|
| 18 |
PLATFORM=${2:-linux_amd64} # use linux_amd64 if not specified |
| 19 |
|
| 20 |
# Build the executables and extract them to the folder in the first argument. |
| 21 |
bazelisk build //infra/bots:all_task_drivers \ |
| 22 |
--platforms=@rules_go//go/toolchain:${PLATFORM} \ |
| 23 |
--config=linux_rbe --jobs=100 |
| 24 |
|
| 25 |
tar -xf bazel-bin/infra/bots/built_task_drivers.tar -C ${1} |
| 26 |
# Bazel outputs are write-protected, so we make sure everybody can write them. This way there |
| 27 |
# are no expected errors in deleting them later. |
| 28 |
chmod 0777 ${1}/* |