common --color=yes
build --subcommands=pretty_print
build --verbose_failures
build --sandbox_debugbazelrc files Last updated May 5, 2022
OBazl convention:
- 
Create or edit .bazelrc(in the project root directory, which should also containWORKSPACE.bazel), adding as the final line:try-import dev/user.bazelrc. This file should go under version control.
- 
Create dev/.gitignoreand put it under version control.
- 
dev/.gitignoreshould contain one line:*. This keepsdev/under version control so it is available to all developers, but everything it contains is gitignored, so developers can use it for private files likeuser.bazelrc.
- 
Create dev/user.bazelrcand populate it ad libitum.
At a minimum you will probably want to add the following to your user.bazelrc.
The common command makes the option apply to all Bazel commands
(e.g. build, query, etc.). The build options listed only apply
to the build command, which is why they do not use common.
You can control these with a command line flag by adding a "grouping"
suffix. For example, if you prefer to usually build without these
debugging options, but want to be able to flip them on with a command
line switch, you can add a suffix like :dbg
build:dbg --subcommands=pretty_print
build:dbg --verbose_failures
build:dbg --sandbox_debugThen to enable the options pass --config=dbg on the command line.
You can use user.bazelrc to override remote repo references,
redirecting resolution to a local copy. For example, if you wanted to
develop rules_ocaml, you would fork/clone a copy to your local
system, say in $HOME/bazel/rules_ocaml, and then add an override to
user.bazelrc, using an absolute path:
common --override_repository=rules_ocaml=/home/<UID>/bazel/rules_ocamlThis tells Bazel to resolve all references to the @rules_ocaml
namespace to your local copy.