This is the multi-page printable view of this section. Click here to print.
Bzl
Bazel rules related to Bazel itself
- 1: Bzl
- 1.1: al_alias_map
- 1.2: al_bzl_generate_repository
- 1.3: al_bzl_library_map
- 1.4: al_bzl_target_doc
- 1.5: al_genquery_write_to_source_file
1 - Bzl
Bazel code
1.1 - al_alias_map
al_alias_map
load("@com_alwaldend_src//tools/bzl/main/bzl:al_alias_map.bzl", "al_alias_map")
al_alias_map(aliases, visibility)
Generate aliases from an alias map
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| aliases | alias map, keys are names, values are alias arguments | none |
| visibility | default visibility | ["//:__subpackages__"] |
1.2 - al_bzl_generate_repository
al_bzl_generate_repository
load("@com_alwaldend_src//tools/bzl/main/bzl:al_bzl_generate_repository.bzl", "al_bzl_generate_repository")
al_bzl_generate_repository(name, files, repo_mapping)
Generate a repository
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this repository. | Name | required | |
| files | Files to generate, keys are paths, values are file contents | Dictionary: String -> String | optional | {} |
| repo_mapping | In WORKSPACE context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.For example, an entry "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target).This attribute is not supported in MODULE.bazel context (when invoking a repository rule inside a module extension’s implementation function). |
Dictionary: String -> String | optional |
1.3 - al_bzl_library_map
al_bzl_library_map
load("@com_alwaldend_src//tools/bzl/main/bzl:al_bzl_library_map.bzl", "al_bzl_library_map")
al_bzl_library_map(name, visibility, libs, deps, **kwargs)
Create bzl_library targets from a map
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| name | combined bzl_library target name | none |
| visibility | - |
None |
| libs | bzl_library names | {} |
| deps | other al_bzl_library_map targets | [] |
| kwargs | bzl_library kwargs | none |
1.4 - al_bzl_target_doc
al_bzl_target_doc
load("@com_alwaldend_src//tools/bzl/main/bzl:al_bzl_target_doc.bzl", "al_bzl_target_doc")
al_bzl_target_doc(name, visibility, subpackages)
Document bazel targets
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| name | target name | none |
| visibility | - |
none |
| subpackages | list of subpackages | [] |
1.5 - al_genquery_write_to_source_file
al_genquery_write_to_source_file
load("@com_alwaldend_src//tools/bzl/main/bzl:al_genquery_write_to_source_file.bzl", "al_genquery_write_to_source_file")
al_genquery_write_to_source_file(name, expression, scope, var_name, out_file)
Write genquery result to a bzl file
Example:
al_genquery_write_to_source_file(
name = "al_bzl_libs",
expression = """
filter(
"^//",
attr(
"srcs",
".{3,}",
kind(
"bzl_library",
deps("//bzl")
)
)
)
""",
out_file = "al_bzl_libs.bzl",
scope = ["//bzl"],
var_name = "AL_BZL_LIBS",
)
PARAMETERS
| Name | Description | Default Value |
|---|---|---|
| name | name prefix | none |
| expression | genquery expression | none |
| scope | genquery scope | none |
| var_name | variable name in the generated .bzl file | none |
| out_file | output bzl file | none |