I'd like to make Bazel rules that don't depend on Bash on Windows.
I see that in a genrule
, you can use cmd_bat instead of cmd (which requires bash). But how can I define the rule so that there is a cmd attribute and a cmd_bat attribute, and on Windows only cmd_bat is used and everywhere else cmd is used?
In Bazel 3.2.0 cmd_bat
is only considered on Windows. In other operating systems it is simply ignored. cmd_bat
has a higher priority than cmd
.