#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then # Running inside bazel echo "Ejecting content to the working tree, hold on tight" >&2 elif ! command -v bazel &>/dev/null; then echo "Install bazel via `just hack/bazelisk`" >&2 exit 1 else echo "This script should be ran via a Bazel target." exit 1 fi src_path=$(realpath "$1") out_path="$2" cd "${BUILD_WORKSPACE_DIRECTORY}" echo "Starting Copy to directory: ${src_path}" rsync --no-perms -vh -r "$src_path/" $out_path --delete-before echo "Copy to ${out_path} completed"