MODULE.bazel does, how to declare dependencies, and how to find modules in the Bazel Central Registry.
What is a Bazel Module
The Bazel documentation defines a module as a project that can have multiple versions, each publishing metadata about its dependencies. This is similar to most programming languages which use a well-known file to declare a package and its dependencies. A Bazel module defines the root of a Bazel workspace and is identified by the presence of aMODULE.bazel file. If you’re familiar with files like package.json, or pyproject.toml, MODULE.bazel serves a similar purpose for Bazel.
Some tools still rely on the older
WORKSPACE or WORKSPACE.bazel file to appear in the workspace root, such as bazel-watcher. As a workaround, leave an empty file at this path with a comment explaining why it still exists.Bazel Central Registry
Bazel hosts a “Central Registry” of third-party modules that extend Bazel’s abilities or provide build instructions for libraries. These may be browsed at https://registry.bazel.build.
Understanding the Bazel Module Configuration
Since our starter repo is for Shell scripts, you see a dependency on that module, which provides the plugin (”rules”) for shell scripts:MODULE.bazel as well. For example, this is where you could refer to some third-party packages used in the language. Later 100-series courses will show how to interact with language-specific package managers.
