fx update-bazel-vendor-dir

Update the Bazel vendor directory to include all necessary Bazel deps.

usage: fx update-bazel-vendor-dir [--no-build]

Options:
  --no-build    Do not build prerequisite targets before running `bazel vendor`.

Versions of vendored repositories are based on the content of:
  - //build/bazel/toplevel.MODULE.bazel (for //third_party/bazel_vendor/fuchsia_in_tree)
  - //build/bazel_sdk/tests/MODULE.bazel (for //third_party/bazel_vendor/bazel_sdk_in_tree
    and //third_party/bazel_vendor/bazel_sdk_oot)

All workspaces share the merged BCR registry at
//third_party/bazel_registries/bcr.bazel.build.

If any of the direct or transitive dependencies in those MODULE.bazel files
are updated to newer versions, make sure to rerun this script to update the
Bazel vendor directories, otherwise the build will fail.

NOTE: It's possible for transitive dependencies to change when local
repositories (e.g. rules_fuchsia) update their dependencies, which will
require a rerun of this script.

NOTE: When new dependencies are introduced (either added directly with a
bazel_dep in toplevel.MODULE.bazel, or picked up by a newer version of an
existing dependency), you can add it to the Bazel vendor directory in two
ways:

  1. Add a `--repo='@@canonical_repo_name'` below, to download this
     dependency from upstream (Bazel Central Registry, BCR). Please follow
     the OSRB process [0] if it is the first time this repository is added
     to fuchsia.git.

  2. Or, manually create a stub directory with necessary Bazel targets
     stubbed out at `//third_party/canonical_repo_name`, and add
     `--stub-repo='@@canonical_repo_name'` below. Contents of stub repos
     stay untouched by this script.

[0] https://fuchsia.dev/fuchsia-src/contribute/governance/policy/osrb-process

NOTE: Files or directories from vendored repositories that are not needed by
the build (e.g. large prebuilt binaries) can be dropped by adding an
`--exclude='<glob>'` below. The glob is relative to the Bazel vendor
directory.


update-bazel-vendor-dir source code