1#!/usr/bin/env bash 2 3set -euo pipefail 4 5# A script to re-vendor all vendors crates in this repository. 6# This should be ran whenever any crate rendering changes. 7 8vendor_workspace() { 9 workspace="$1" 10 echo "Vendoring all targets in workspace $workspace" 11 pushd $workspace >/dev/null 12 targets="$(bazel query 'kind("crates_vendor", //...)' 2>/dev/null)" 13 for target in $targets 14 do 15 bazel run $target 16 done 17 popd >/dev/null 18} 19 20if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then 21 cd "${BUILD_WORKSPACE_DIRECTORY:-}" 22fi 23 24workspaces="$(find . -type f -name WORKSPACE.bazel -o -name MODULE.bazel)" 25 26for workspace in $workspaces 27do 28 vendor_workspace "$(dirname "$workspace")" 29done 30