bazel 登录 BUILD 文件

bazel logging inside of a BUILD file

您好,我想查看传递给 rules.bzl 文件中定义的规则的内容。所以我想在 BUILD 文件或 rules.bzl 文件中添加一个日志语句,只是为了查看传递了什么参数。我意识到有一个完整的 --execution_log_binary_file 并且有很多东西需要阅读,但我绝对希望只做一次并且快速而肮脏。我是否导入 logging 模块?是别的东西吗?谢谢

使用 BUILD.bzl 文件中的内置 Starlark print() function 来转储值 Bazel 的控制台。

bazel query --output=build //my/package:all will print out the definitions of all the targets created by macros called from my/package/BUILD by any .bzl file. This includes all the attributes passed to to various rules 创建这些目标。