blob: 5b3fa0fd7325fb318eda13d41aa0be10ce9feb90 [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 by infra to validate the package can be built and tests
# can pass.
# TODO(akbiggs): Set up 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"
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
if [[ -z "$version_number" ]]; then
run_bazel build --config=fuchsia_x64 //src:test_artifact_release
else
run_bazel build --config=fuchsia_x64 //src:test_artifact_release --@rules_fuchsia//fuchsia/private:build_version="${version_number}"
fi
) || exit 1
}
main() {
while getopts ":ho:v:" opt; do
case ${opt} in
'h' | '?')
help
exit 1
;;
'o') output_base=$OPTARG ;;
'v') version_number=$OPTARG ;;
esac
done
generate_upload_manifest
}
main "$@"