Example of build configurations
This is to show a bug in Bazel's (recently added) ability to employ user-defined build flags.
If you do:
bazel clean && bazel build //:my_drink
it will print:
DEBUG: .../rules.bzl:7:9: Get the default (False)
In contrast, if you do
bazel clean && bazel build //:my_drink --//:favorite_flavor=True
it will print:
DEBUG: .../rules.bzl:5:9: Get the opposite of default (True)
The bug (branch: bug)
Same code, except using workspace prefix for referencing the build-sertting target. Both commands listed above yield the same result:
DEBUG: .../rules.bzl:7:9: Get the default (False)
That is, the flag set in the command-line has no effect. It might make sense to modify the command to use the workspace prefix too:
bazel clean && bazel build //:my_drink --@bsws//:favorite_flavor=True
Unfortunately (and surpriingly) this yields:
ERROR: Unrecognized option: --@bsws//:favorite_flavor=True