matthias_buehlmann
matthias_buehlmann

Reputation: 5061

Bazel: how to create genrule that uses cmd on linux and cmd_bat on windows?

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?

Upvotes: 3

Views: 610

Answers (1)

Vertexwahn
Vertexwahn

Reputation: 8142

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.

Upvotes: 4

Related Questions