我正在寻找一种在 bazel 中找到 sha256sum 的方法。 我已经定义了规则,但 bazel 规则定义了写入文件的输出。
# Create actions to generate the three output files.
# Actions are run only when the corresponding file is requested.
ctx.actions.run_shell(
outputs = [ctx.outputs.sha256],
inputs = [ctx.file.src],
use_default_shell_env = True,
command = "sha256sum {} > {}".format(ctx.file.src.path, ctx.outputs.sha256.path),
)
# By default (if you run `bazel build` on this target, or if you use it as a
# source of another target), only the sha256 is computed.
return DefaultInfo(files = depset([ctx.outputs.sha256]))
_hashes = rule(
implementation = _impl,
attrs = {
"src": attr.label(mandatory = True, allow_single_file = True),
"sha256": attr.output(),
},
)
如何创建一个返回给定源的 sha256 的函数/宏? 感谢帮助?