2021-01-25 22:01:43 +00:00
|
|
|
# buildifier: disable=module-docstring
|
2021-03-12 16:54:14 +00:00
|
|
|
# buildifier: disable=bzl-visibility
|
2021-04-30 16:03:32 +00:00
|
|
|
load("//foreign_cc/private/framework:helpers.bzl", "convert_shell_script")
|
2020-04-30 09:24:25 +00:00
|
|
|
|
|
|
|
def _impl(ctx):
|
|
|
|
text = convert_shell_script(ctx, ctx.attr.script)
|
|
|
|
out = ctx.actions.declare_file(ctx.attr.out)
|
|
|
|
ctx.actions.write(
|
|
|
|
output = out,
|
|
|
|
content = text,
|
|
|
|
)
|
|
|
|
return [DefaultInfo(files = depset([out]))]
|
|
|
|
|
|
|
|
shell_script_helper_test_rule = rule(
|
|
|
|
implementation = _impl,
|
|
|
|
attrs = {
|
|
|
|
"out": attr.string(mandatory = True),
|
2021-02-02 20:09:33 +00:00
|
|
|
"script": attr.string_list(mandatory = True),
|
2020-04-30 09:24:25 +00:00
|
|
|
},
|
|
|
|
toolchains = [
|
2021-04-30 16:03:32 +00:00
|
|
|
"@rules_foreign_cc//foreign_cc/private/framework:shell_toolchain",
|
2020-04-30 09:24:25 +00:00
|
|
|
],
|
|
|
|
)
|