| #!/bin/bash |
| |
| # Copyright 2022 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| set -e |
| |
| # This script is used by infra to validate the package can be built and tests |
| # can pass. |
| |
| readonly REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/.. |
| |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/run_bazel.sh || exit $? |
| |
| help() { |
| echo |
| echo "Script used to validate the targets can be built." |
| echo |
| echo "Usage:" |
| echo " $(basename "$0") [<options>]" |
| echo |
| echo "Options:" |
| echo |
| echo " -o <output_base>" |
| echo " This is a bazel parameter. More about it can be found in" |
| echo " https://docs.bazel.build/versions/main/command-line-reference.html#flag--output_base" |
| echo |
| } |
| |
| build_targets() { |
| cd "${REPO_ROOT}" |
| run_bazel build --config=fuchsia_x64 //driver:pkg |
| run_bazel build --config=fuchsia_x64 //driver:test_pkg |
| } |
| |
| main() { |
| while getopts ":ho:" opt; do |
| case ${opt} in |
| 'h' | '?') |
| help |
| exit 1 |
| ;; |
| 'o') OUTPUT_BASE=$OPTARG ;; |
| esac |
| done |
| build_targets |
| } |
| main "$@" |