| #!/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 to generate the CIPD upload manifest file which can be |
| # used by infra. |
| |
| source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/run_bazel.sh || exit $? |
| |
| readonly REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/.. |
| readonly CIPD_UPLOAD_MANIFEST_PATH="bazel-bin/driver/cipd_upload_manifest.json" |
| |
| help() { |
| echo |
| echo "Script used to generate cipd_manifest.json which is used to upload packages." |
| echo |
| echo "Usage:" |
| echo " $(basename "$0") [<options>]" |
| echo |
| echo "Options:" |
| echo |
| echo " -h" |
| echo " Prints this help message" |
| 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 |
| } |
| |
| generate_upload_manifest() { |
| ( |
| cd "${REPO_ROOT}" |
| run_bazel build --config=fuchsia_x64 driver:artifact_cipd_release 1>&2 |
| cat "$CIPD_UPLOAD_MANIFEST_PATH" |
| ) || exit 1 |
| } |
| |
| main() { |
| while getopts ":ho:" opt; do |
| case ${opt} in |
| 'h' | '?') |
| help |
| exit 1 |
| ;; |
| 'o') OUTPUT_BASE=$OPTARG ;; |
| esac |
| done |
| |
| generate_upload_manifest |
| } |
| |
| main "$@" |