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

Name Description Default Value
name library name none
srcs library sources none
check if set, only these files will be checked []
stylua_config_label

-

"//lua:stylua-config"
stylua_label

-

"@com-alwaldend-src-cargo//:stylua__stylua"
pkg_tar_kwargs kwargs for pkg_tar {}
visibility visibility ["//visibility:public"]

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

Name Description Default Value
name genrule name none
srcs dicts tar archives ({“label”: “tar label”, “dir”: “target dir”}) []
strip_components value of –stip-components 2
kwargs other genrule kwargs none

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

Name Description Default Value
name target name none
deps py_binary deps []
srcs py_binary srcs []
shell_type ${BAZEL_PYTHON_SHELL_TYPE} "python"
shell_label

-

"//py/bazel-python-shell:library"
kwargs other py_binary kwargs none

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

Name Description Default Value
name Name prefix None
tool Tool label None
args_bin Args for the binary target None
args_test Args for the test None
test_size

-

"small"
disable_fix If set, do not create fix target False
kwargs Kwargs for both targets none

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

Name Description Default Value
srcs list of source file labels none
isort_label

-

"//py:isort"
black_label

-

"//py:black"
mypy_label

-

"//py:mypy"
flake8_label

-

"//py:flake8"
pyproject_label

-

"//:pyproject"

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

Name Description Default Value
name Target name (required) none
tool Tool label to run (required) none
executable If True, generate native_binary False
test If True, generate native_test False
kwargs kwargs for rules none

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

Name Description Default Value
name target name none
shfmt_src

-

"@cc_mvdan_sh_v3//cmd/shfmt:shfmt"
editorconfig_src

-

"//:editorconfig"
shellcheck_src

-

"@com-github-koalaman-shellcheck-linux-x86_64//:bin"
run_args_src

-

"//sh/scripts:run-args-lib"
visibility

-

["//visibility:public"]
common_kwargs kwargs for both targets none

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

23 - al_txt_data

al_txt_data

load("@com-alwaldend-git-src//bzl/macros:al_txt_data.bzl", "al_txt_data")

al_txt_data(name, srcs, **kwargs)

Text data

PARAMETERS

Name Description Default Value
name target name none
srcs sources none
kwargs filegroup kwargs none