Update crates_universe render script to run from Bazel (#2492)

This commit is contained in:
UebelAndre 2024-02-19 09:45:55 -08:00 committed by GitHub
parent 184da7d4ec
commit b1fc85232d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 2 deletions

View File

@ -38,5 +38,5 @@ A lot of crates are vendored into this repo, e.g. in examples and tests. To
re-vendor them all, a bash script is provided:
```sh
./util/vendor.sh
bazel run //crate_universe/tools:vendor
```

View File

@ -5,3 +5,8 @@ filegroup(
],
visibility = ["//crate_universe:__subpackages__"],
)
sh_binary(
name = "vendor",
srcs = ["vendor.sh"],
)

View File

@ -1,5 +1,7 @@
#!/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.
@ -15,7 +17,11 @@ vendor_workspace() {
popd >/dev/null
}
workspaces="$(find -type f -name WORKSPACE.bazel -o -name WORKSPACE -o -name MODULE.bazel)"
if [[ -n "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
cd "${BUILD_WORKSPACE_DIRECTORY:-}"
fi
workspaces="$(find . -type f -name WORKSPACE.bazel -o -name MODULE.bazel)"
for workspace in $workspaces
do