Jan15
Jan15

Reputation: 539

Expand bazel command with bazelrc

given a bazel command, for example bazel build //..., is it possible to see what build command this expands to based on the bazelrc(s)?

bazelrcs are great to set default flags, like the default platform to build for setting some variables based on profiles. They also allow for nested bazelrcs, that you can import and try-import leading to a rather complex expansion of bazel commands via bazelrcs.

To verify that the bazelrcs did indeed configure the correct things and did not override some flags accidentally, I would love to see the output of what bazel would expand a bazel command to.

Is that possible?

I tried setting --logging=0 and --logging=6 with bazel 5.3.0 but see no such output.

Upvotes: 0

Views: 272

Answers (1)

lummax
lummax

Reputation: 373

You can run your build using the --explain flag.

Something like

bazel build --explain explain.log //...

should produce a file explain.log where the first line contains the expanded flags.

Upvotes: 1

Related Questions