maybe

maybe(repo_rule, name, kwargs)

Utility function for only adding a repository if it’s not already present.

This is to implement safe repositories.bzl macro documented in https://docs.bazel.build/versions/master/skylark/deploying.html#dependencies.

Parameters

repo_rule required.

repository rule function.

name required.

name of the repository to create.

kwargs optional.

remaining arguments that are passed to the repo_rule function.

patch

patch(ctx)

Implementation of patching an already extracted repository.

This rule is inteded to be used in the implementation function of a repository rule. It assuumes that the parameters patches, patch_tool, patch_args, patch_cmds and patch_cmds_win are present in ctx.attr.

Parameters

ctx required.

The repository context of the repository rule calling this utility function.

update_attrs

update_attrs(orig, keys, override)

Utility function for altering and adding the specified attributes to a particular repository rule invocation.

This is used to make a rule reproducible.

Parameters

orig required.

dict of actually set attributes (either explicitly or implicitly) by a particular rule invocation

keys required.

complete set of attributes defined on this rule

override required.

dict of attributes to override or add to orig

workspace_and_buildfile

workspace_and_buildfile(ctx)

Utility function for writing WORKSPACE and, if requested, a BUILD file.

This rule is inteded to be used in the implementation function of a repository rule. It assumes the parameters name, build_file, build_file_contents, workspace_file, and workspace_file_content to be present in ctx.attr, the latter four possibly with value None.

Parameters

ctx required.

The repository context of the repository rule calling this utility function.