blob: a2adca1381ffcf5030c4aa1f00ecef7bf2d6ae8a [file] [log] [blame]
#!/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 for debug symbol
# which can be used by infra.
readonly REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/..
readonly BAZELISK_TOOL="${REPO_ROOT}/third_party/sdk-integration/tools/bazel"
readonly CIPD_UPLOAD_MANIFEST_PATH="bazel-bin/src/debug_symbols_cipd_upload_manifest.json"
run_bazel() {
local bazel="${REPO_ROOT}/tools/bazel"
if [[ -z "$output_base" ]]; then
"$BAZELISK_TOOL" "$@"
else
"$BAZELISK_TOOL" --output_base "${output_base}" "$@"
fi
}
generate_upload_manifest() {
(
cd "${REPO_ROOT}"
run_bazel clean --expunge 1>&2
run_bazel build --config=fuchsia_x64 src:debug_symbol_cipd_release 1>&2
cat "$CIPD_UPLOAD_MANIFEST_PATH"
) || exit 1
}
main() {
while getopts ":ho:v:" opt; do
case ${opt} in
'h' | '?')
help
exit 1
;;
'o') output_base=$OPTARG ;;
esac
done
generate_upload_manifest
}
main "$@"