implementation function when you create a module extension.
Members
- download
- download_and_extract
- execute
- extension_metadata
- extract
- facts
- file
- getenv
- is_dev_dependency
- modules
- os
- path
- read
- report_progress
- root_module_has_non_dev_dependency
- tag_sort_key
- watch
- which
download
success, a flag which is true if the download completed successfully, and if successful, a hash of the file with the fields sha256 and integrity, as well as size_bytes, which contains the size of the downloaded file in bytes as an integer. If the value of the success field is false, the error field will be set with a message indicating why the download failed. The message in the error field is for debugging purposes only and should not be relied upon as a stable API (the format of the string can change between patch versions of Bazel). When sha256 or integrity is user specified, setting an explicit canonical_id is highly recommended. e.g. get_default_canonical_id
Parameters
download_and_extract
success, a flag which is true if the download completed successfully, and if successful, a hash of the file with the fields sha256 and integrity, as well as the size_bytes of the downloaded file in bytes as an integer. If the value of the success field is false, the error field will be set with a message indicating why the download failed. The message in the error field is for debugging purposes only and should not be relied upon as a stable API (the format of the string can change between patch versions of Bazel). When sha256 or integrity is user specified, setting an explicit canonical_id is highly recommended. e.g. get_default_canonical_id
Parameters
execute
timeout (in seconds, default 600 seconds). This method returns an exec_result structure containing the output of the command. The environment map can be used to override some environment variables to be passed to the process.
Parameters
extension_metadata
Parameters
extract
Parameters
facts
facts
parameter of extension_metadata or else
{}.
This is useful for extensions that want to preserve universally true facts such as the
hashes of artifacts in an immutable repository.
Note that the returned value may have been created by a different version of the
extension, which may have used a different schema.
file
Parameters
getenv
name as a string if exists, or default if it doesn’t.
When building incrementally, any change to the value of the variable named by name will cause this repository to be re-fetched.
Parameters
May return
None.
is_dev_dependency
devDependency = True.
Parameters
modules
os
path
repository_ctx, a relative path will resolve relative to the repository directory. If it is a module_ctx, a relative path will resolve relative to a temporary working directory for this module extension. If the path is a label, it will resolve to the path of the corresponding file. Note that remote repositories and module extensions are executed during the analysis phase and thus cannot depends on a target result (the label should point to a non-generated file). If path is a path, it will return that path as is.
Parameters
read
Parameters
report_progress
Parameters
root_module_has_non_dev_dependency
tag_sort_key
sort_key object for the given tag, which can be compared with other sort_key objects to determine the relative order of tags, even across tag classes. Tags are ordered by their position within a module file and by the BFS ordering of modules in the dependency graph. This can be used with sorted() to recover the original order of tags: sorted(tags, key=lambda tag: module_ctx.tag_sort_key(tag))
Parameters
watch
path.readdir() instead.
Note that attempting to watch paths inside the repo currently being fetched, or inside the working directory of the current module extension, will result in an error. A module extension attempting to watch a path outside the current Bazel workspace will also result in an error.
Parameters
which
path of the corresponding program or None if there is no such program in the path.
Parameters
May return
None.