Merge repin scripts (#2769)
We have two of these, and they do overlapping but not equal things.
Unify to one, and merge in the missing functionality.
diff --git a/crate_universe/tools/BUILD.bazel b/crate_universe/tools/BUILD.bazel
index cc897fb..1677d9e 100644
--- a/crate_universe/tools/BUILD.bazel
+++ b/crate_universe/tools/BUILD.bazel
@@ -5,8 +5,3 @@
],
visibility = ["//crate_universe:__subpackages__"],
)
-
-sh_binary(
- name = "vendor",
- srcs = ["vendor.sh"],
-)
diff --git a/crate_universe/tools/vendor.sh b/crate_universe/tools/vendor.sh
deleted file mode 100755
index 62f7d1e..0000000
--- a/crate_universe/tools/vendor.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bash
-
-set -euo pipefail
-
-# A script to re-vendor all vendors crates in this repository.
-# This should be ran whenever any crate rendering changes.
-
-vendor_workspace() {
- workspace="$1"
- echo "Vendoring all targets in workspace $workspace"
- pushd $workspace >/dev/null
- set +e
- targets="$(bazel query 'kind("crates_vendor", //...)' 2>/dev/null)"
- set -e
- for target in $targets
- do
- bazel run $target
- done
- popd >/dev/null
-}
-
-if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
- cd "${BUILD_WORKSPACE_DIRECTORY:-}"
-fi
-
-workspaces="$(find . -type f -name WORKSPACE.bazel -o -name MODULE.bazel | sort)"
-
-for workspace in $workspaces
-do
- vendor_workspace "$(dirname "$workspace")"
-done
diff --git a/util/repin_all.sh b/util/repin_all.sh
index 5f29c18..b048067 100755
--- a/util/repin_all.sh
+++ b/util/repin_all.sh
@@ -5,9 +5,9 @@
cd "$(dirname "${BASH_SOURCE[0]}")"/..
# Re-generates all files which may need to be re-generated after changing crate_universe.
-bazel run //crate_universe/3rdparty:crates_vendor
-bazel run //test/3rdparty:crates_vendor
-bazel run //tools/rust_analyzer/3rdparty:crates_vendor
+for target in $(bazel query 'kind("crates_vendor", //...)'); do
+ bazel run "${target}"
+done
for d in examples/crate_universe/vendor_*; do
(cd "${d}" && CARGO_BAZEL_REPIN=true bazel run :crates_vendor)