This is the multi-page printable view of this section. Click here to print.
Bazel macros
- 1: al_alias_map
- 2: al_apply_patches
- 3: al_bzl_library_map
- 4: al_combine_files
- 5: al_compile_pip_requirements_combined
- 6: al_drawio_run_binary
- 7: al_genquery_write_to_source_file
- 8: al_genrule
- 9: al_genrule_src
- 10: al_genrule_with_wheels
- 11: al_go_checkers
- 12: al_install_file
- 13: al_lua_library
- 14: al_md_data
- 15: al_pkg_tar_combined
- 16: al_py_binary_shell
- 17: al_py_checker
- 18: al_py_checkers
- 19: al_readme
- 20: al_run_tool
- 21: al_sh_library
- 22: al_template_files
- 23: al_txt_data
1 - al_alias_map
al_alias_map
load("@com-alwaldend-git-src//bzl/macros: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 | ["//visibility:public"] |
2 - al_apply_patches
al_apply_patches
load("@com-alwaldend-git-src//bzl/macros:al_apply_patches.bzl", "al_apply_patches") al_apply_patches(name, src, patches, visibility, **kwargs)
Create a genrule applying patches
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | genrule name | none |
src | source archive label | none |
patches | patches label | none |
visibility | visibility | ["//visibility:public"] |
kwargs | other genrule kwargs | none |
3 - al_bzl_library_map
al_bzl_library_map
load("@com-alwaldend-git-src//bzl/macros: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 |
4 - al_combine_files
al_combine_files
load("@com-alwaldend-git-src//bzl/macros:al_combine_files.bzl", "al_combine_files") al_combine_files(name, srcs, **kwargs)
Create a genrule combining several files into one
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | genrule target | none |
srcs | list of labels to combine | none |
kwargs | other genrule kwargs | none |
5 - al_compile_pip_requirements_combined
al_compile_pip_requirements_combined
load("@com-alwaldend-git-src//bzl/macros:al_compile_pip_requirements_combined.bzl", "al_compile_pip_requirements_combined") al_compile_pip_requirements_combined(name, srcs, **kwargs)
Create compile_pip_requirements target for several requirement files
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | compile_pip_requirements name | none |
srcs | list of labels of requirement files to combine | none |
kwargs | kwargs for compile_pip_requirements |
none |
6 - al_drawio_run_binary
al_drawio_run_binary
load("@com-alwaldend-git-src//bzl/macros:al_drawio_run_binary.bzl", "al_drawio_run_binary") al_drawio_run_binary(**kwargs)
Wrapper around al_drawio_run_binary rule
PARAMETERS
Name | Description | Default Value |
---|---|---|
kwargs | kwargs for al_drawio_run_binary | none |
7 - al_genquery_write_to_source_file
al_genquery_write_to_source_file
load("@com-alwaldend-git-src//bzl/macros: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 |
8 - al_genrule
al_genrule
load("@com-alwaldend-git-src//bzl/macros:al_genrule.bzl", "al_genrule") al_genrule(test, executable, **kwargs)
Generate al_genrule target
PARAMETERS
Name | Description | Default Value |
---|---|---|
test | If set, use al_genrule_test | False |
executable | if set, use al_genrule_executable | False |
kwargs | kwargs for the rule | none |
9 - al_genrule_src
al_genrule_src
load("@com-alwaldend-git-src//bzl/macros:al_genrule_src.bzl", "al_genrule_src") al_genrule_src(name, srcs, visibility)
Create a filegroup and a genrule generating a tar archive
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | genrule name | none |
srcs | source labels | [] |
visibility | - |
["//visibility:public"] |
10 - al_genrule_with_wheels
al_genrule_with_wheels
load("@com-alwaldend-git-src//bzl/macros:al_genrule_with_wheels.bzl", "al_genrule_with_wheels") al_genrule_with_wheels(name, wheels, srcs, cmd, **kwargs)
Regular genrule with wheels added to ${PYTHONPATH}
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | genrule name | none |
wheels | list of wheel labels | none |
srcs | srcs for the genrule | [] |
cmd | genrule cmd | [] |
kwargs | other genrule kwargs | none |
11 - al_go_checkers
12 - al_install_file
al_install_file
load("@com-alwaldend-git-src//bzl/macros:al_install_file.bzl", "al_install_file") al_install_file(name, args, install_file_label, visibility, **py_binary_kwargs)
Create py_binary target to install file
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | target name | none |
args | install-file args | [] |
install_file_label | - |
"//py/install-file:lib" |
visibility | - |
["//visibility:public"] |
py_binary_kwargs | - |
none |
13 - al_lua_library
al_lua_library
load("@com-alwaldend-git-src//bzl/macros:al_lua_library.bzl", "al_lua_library") al_lua_library(name, srcs, check, stylua_config_label, stylua_label, pkg_tar_kwargs, visibility)
Generate targets for a lua library
Targets:
- ${name}: pkg_tar
- ${name}-stylua-fix: al_run_tool executable
- ${name}-stylua-test: al_run_tool test
PARAMETERS
14 - al_md_data
al_md_data
load("@com-alwaldend-git-src//bzl/macros:al_md_data.bzl", "al_md_data") al_md_data(name, srcs, deps, **kwargs)
Markdown data backed by a filegroup
Targets:
- ${name}: filegroup
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | filegroup name | none |
srcs | markdown files | none |
deps | deps | [] |
kwargs | filegroup kwargs | none |
15 - al_pkg_tar_combined
al_pkg_tar_combined
load("@com-alwaldend-git-src//bzl/macros:al_pkg_tar_combined.bzl", "al_pkg_tar_combined") al_pkg_tar_combined(name, srcs, strip_components, **kwargs)
Create a genrule combining several tars into one
PARAMETERS
16 - al_py_binary_shell
al_py_binary_shell
load("@com-alwaldend-git-src//bzl/macros:al_py_binary_shell.bzl", "al_py_binary_shell") al_py_binary_shell(name, deps, srcs, shell_type, shell_label, **kwargs)
Create a py_binary target that allows you to run commands in proper python environment
PARAMETERS
17 - al_py_checker
al_py_checker
load("@com-alwaldend-git-src//bzl/macros:al_py_checker.bzl", "al_py_checker") al_py_checker(name, tool, args_bin, args_test, test_size, disable_fix, **kwargs)
Create -fix and -test targets for a python checker
PARAMETERS
18 - al_py_checkers
al_py_checkers
load("@com-alwaldend-git-src//bzl/macros:al_py_checkers.bzl", "al_py_checkers") al_py_checkers(srcs, isort_label, black_label, mypy_label, flake8_label, pyproject_label)
Generate -fix and -test targets for python checkers
PARAMETERS
19 - al_readme
al_readme
load("@com-alwaldend-git-src//bzl/macros:al_readme.bzl", "al_readme") al_readme(name, srcs, subpackages, **kwargs)
Create readme targets
Targets:
- ${name}: al_md_data target
- ${name}-children: pkg_tar containing ${name}-children from subpackages
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | target name | none |
srcs | - |
[":README.md"] |
subpackages | override list of subpackages | [] |
kwargs | al_md_data kwargs | none |
20 - al_run_tool
al_run_tool
load("@com-alwaldend-git-src//bzl/macros:al_run_tool.bzl", "al_run_tool") al_run_tool(name, tool, executable, test, **kwargs)
Generate either native_test, native_binary, or run_binary target
PARAMETERS
21 - al_sh_library
al_sh_library
load("@com-alwaldend-git-src//bzl/macros:al_sh_library.bzl", "al_sh_library") al_sh_library(name, shfmt_src, editorconfig_src, shellcheck_src, run_args_src, visibility, **common_kwargs)
Create targets for a shell library
Targets:
- ${name}-shfmt-fix: executable to run shfmt
- ${name}-shfmt-test: test whether the script is formatted
- ${name}-shellcheck-test: shellcheck test
PARAMETERS
22 - al_template_files
al_template_files
load("@com-alwaldend-git-src//bzl/macros:al_template_files.bzl", "al_template_files") al_template_files(**kwargs)
Macros around al_template_files rule
PARAMETERS
Name | Description | Default Value |
---|---|---|
kwargs | kwargs for al_template_files | none |