| #!/bin/bash |
| # Copyright 2024 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. |
| |
| # This script generates the ctf_releases.gni file. It is intended to be |
| # called by a git-hook after prebuilts are downloaded. |
| # |
| # The ctf_releases.gni file is used by the build to determine which |
| # CTF releases were downloaded from CIPD as prebuilts so that they can |
| # be run as tests against the current platform image. |
| |
| set -e |
| |
| script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" |
| FUCHSIA_DIR="$(dirname $(dirname $(dirname $(dirname "${script_dir}"))))" |
| |
| PREBUILT_DIR="${FUCHSIA_DIR}/prebuilt/ctf" |
| DESTINATION="${FUCHSIA_DIR}/sdk/ctf/build/internal/ctf_releases.gni" |
| |
| YEAR=$(date +%Y) |
| |
| echo \ |
| "# Copyright ${YEAR} 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. |
| |
| # This file is autogenerated by create_ctf_releases_gni.sh |
| # Do not edit manually |
| |
| ctf_releases = [" \ |
| > "${DESTINATION}" |
| |
| echo "Finding CTF releases..." |
| for release in $(ls ${PREBUILT_DIR}); do |
| if [ -d "${PREBUILT_DIR}/${release}/linux-x64" ]; then |
| echo " Have release for ${release}... adding" |
| echo " \"${release}\"," >> "${DESTINATION}" |
| else |
| echo " No release for ${release}... skipping" |
| fi |
| |
| done |
| |
| echo "]" >> "${DESTINATION}" |
| |
| echo "Wrote output to ${DESTINATION}" |