Skip to content

Commit

Permalink
Update crates_universe render script to run from Bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Feb 18, 2024
1 parent 04f1b5d commit bbd308c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crate_universe/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
5 changes: 5 additions & 0 deletions crate_universe/tools/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ filegroup(
],
visibility = ["//crate_universe:__subpackages__"],
)

sh_binary(
name = "vendor",
srcs = ["vendor.sh"],
)
8 changes: 7 additions & 1 deletion util/vendor.sh → crate_universe/tools/vendor.sh
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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 -o -name MODULE.bazel)"

for workspace in $workspaces
do
Expand Down

0 comments on commit bbd308c

Please sign in to comment.