skia2/infra/bots/build_task_drivers.sh
Kevin Lubick 5fb37db69f [bazel] Use bazel to build task drivers
One very important, but agonizing to discover, change was
to go_repositories.bzl. Without it, we see cryptic errors like:
external/org_chromium_go_luci/cipd/api/cipd/v1/BUILD.bazel:22:17: no such package '@org_chromium_go_luci//go.chromium.org/luci/cipd/api/cipd/v1': BUILD file not found in directory 'go.chromium.org/luci/cipd/api/cipd/v1' of external repository @org_chromium_go_luci. Add a BUILD file to a directory to mark it as a package. and referenced by '@org_chromium_go_luci//cipd/api/cipd/v1:api_go_proto'

The rest of these changes are very similar to
https://skia-review.googlesource.com/c/buildbot/+/514074
which also has justification for the use of task drivers,
even in a Bazel-driven world.

All the BUILD.bazel files under infra/bots/task_drivers were
generated by Gazelle.

Note that the infra/bots/BUILD.bazel can happily build and
package up the task drivers from the infra repo. The old
build_task_drivers tasks did this too, because we have some
task drivers that are used in both repos.

Change-Id: I13c46c62bc7a6a4bfe7935b28efbfb34caabb6f2
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/515296
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-03-03 16:12:18 +00:00

27 lines
1.0 KiB
Bash
Executable File

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