Practical Bazel: Changing Behavior on Windows

Bazel started on Linux and Mac OS, and most people use Bazel on these platforms exclusively, but Bazel can execute on Windows as well. However, Windows has enough idiosynchatic differences that writing a single, operating-system agnostic rule that executes on both Windows and Linux/Mac is quite hard. Often it is easiest to have the rule detect whether it is running on Windows and execute different behavior.
A rule can detect whether it is running on Windows is by using
configurable attributes, a.k.a. the select()
statement.
This can be made automatic by wrapping your custom rule in a macro that
generates the select()
statement for you automatically:
|
|
|
|