Skip to main content
Methods available in MODULE.bazel files.

Members

archive_override

Specifies that this dependency should come from an archive file (zip, gzip, etc) at a certain location, instead of from a registry. This directive only takes effect in the root module; in other words, if a module is used as a dependency by others, its own overrides are ignored.

Parameters

bazel_dep

Declares a direct dependency on another Bazel module.

Parameters

flag_alias

No-op for pre-Bazel 9.0 backward compatibility. See Bazel 9.0 docs for real functionality.

Parameters

git_override

Specifies that a dependency should come from a certain commit of a Git repository. This directive only takes effect in the root module; in other words, if a module is used as a dependency by others, its own overrides are ignored.

Parameters

include

Includes the contents of another MODULE.bazel-like file. Effectively, include() behaves as if the included file is textually placed at the location of the include() call, except that variable bindings (such as those used for use_extension) are only ever visible in the file they occur in, not in any included or including files. Only the root module may use include(); it is an error if a bazel_dep’s MODULE file uses include(). Only files in the main repo may be included. include() allows you to segment the root module file into multiple parts, to avoid having an enormous MODULE.bazel file or to better manage access control for individual semantic segments.

Parameters

inject_repo

Injects one or more new repos into the given module extension. This is ignored if the current module is not the root module or --ignore\_dev\_dependency is enabled. Use override_repo instead to override an existing repo.

Parameters

local_path_override

Specifies that a dependency should come from a certain directory on local disk. This directive only takes effect in the root module; in other words, if a module is used as a dependency by others, its own overrides are ignored.

Parameters

module

Declares certain properties of the Bazel module represented by the current Bazel repo. These properties are either essential metadata of the module (such as the name and version), or affect behavior of the current module and its dependents. It should be called at most once, and if called, it must be the very first directive in the MODULE.bazel file. It can be omitted only if this module is the root module (as in, if it’s not going to be depended on by another module).

Parameters

multiple_version_override

Specifies that a dependency should still come from a registry, but multiple versions of it should be allowed to coexist. See the documentation for more details. This directive only takes effect in the root module; in other words, if a module is used as a dependency by others, its own overrides are ignored.

Parameters

override_repo

Overrides one or more repos defined by the given module extension with the given repos visible to the current module. This is ignored if the current module is not the root module or --ignore\_dev\_dependency is enabled. Use inject_repo instead to add a new repo.

Parameters

register_execution_platforms

Specifies already-defined execution platforms to be registered when this module is selected. Should be absolute target patterns (ie. beginning with either @ or //). See toolchain resolution for more information.

Parameters

register_toolchains

Specifies already-defined toolchains to be registered when this module is selected. Should be absolute target patterns (ie. beginning with either @ or //). See toolchain resolution for more information.

Parameters

single_version_override

Specifies that a dependency should still come from a registry, but its version should be pinned, or its registry overridden, or a list of patches applied. This directive only takes effect in the root module; in other words, if a module is used as a dependency by others, its own overrides are ignored.

Parameters

use_extension

Returns a proxy object representing a module extension; its methods can be invoked to create module extension tags.

Parameters

use_repo

Imports one or more repos generated by the given module extension into the scope of the current module.

Parameters

use_repo_rule

Returns a proxy value that can be directly invoked in the MODULE.bazel file as a repository rule, one or more times. Repos created in such a way are only visible to the current module, under the name declared using the name attribute on the proxy. The implicit Boolean dev_dependency attribute can also be used on the proxy to denote that a certain repo is only to be created when the current module is the root module.

Parameters