blob: ed05104c560ff4097e0ec8a1d7063e26786c4fad [file]
#!/usr/bin/env bash
# Copyright 2026 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.
# Runs shac with pinned versions of shac and Go installed from CIPD, so that
# the checks in shac.star don't depend on whatever Go is installed on the
# machine. Presubmit runs this script via the shac recipe's `shac_path`
# property. Arguments are passed through to shac, e.g. `scripts/shac check`.
set -eu -o pipefail
GO_VERSION="version:3@1.27.1"
SHAC_VERSION="git_revision:63c0571f70f71c533d5ce623fb30a4d8813f24af"
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
TOOLS_DIR="$REPO_ROOT/.tools"
cipd ensure -log-level error -root "$TOOLS_DIR" -ensure-file - <<EOF
infra/3pp/tools/go/\${platform} $GO_VERSION
@Subdir shac
fuchsia/shac/\${platform} $SHAC_VERSION
EOF
export PATH="$TOOLS_DIR/bin:$PATH"
exec "$TOOLS_DIR/shac/shac" "$@"