This is the multi-page printable view of this section. Click here to print.
Sh
Shell rules
- 1: Bzl
- 1.1: al_sh_library
- 1.2: al_write_script
1 - Bzl
Bazel code
1.1 - al_sh_library
al_sh_library
load("@com_alwaldend_src//tools/sh/main/bzl:al_sh_library.bzl", "al_sh_library")
al_sh_library(name, shfmt_src, editorconfig_src, shellcheck_src, run_args_src, visibility,
test_data, **sh_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
1.2 - al_write_script
al_write_script
load("@com_alwaldend_src//tools/sh/main/bzl:al_write_script.bzl", "al_write_script")
al_write_script(name, out, content, make_vars, set_flags, shebang)
Write a script and make it executable
ATTRIBUTES
| Name | Description | Type | Mandatory | Default |
|---|---|---|---|---|
| name | A unique name for this target. | Name | required | |
| out | Output file | Label; nonconfigurable | required | |
| content | Script content | String | required | |
| make_vars | Additional make vars | Dictionary: String -> String | optional | {} |
| set_flags | Flags to pass to set | List of strings | optional | ["-eu"] |
| shebang | Sheband to use | String | optional | "#!/usr/bin/env sh" |