.bazelrc file and startup --output_base workspace variable

1,028 views
Skip to first unread message

Alberto García Lamela

unread,
May 24, 2018, 6:12:51 AM5/24/18
to bazel-discuss
Hi,
I'd like to set the startup output_base parameter to a path relative to the root workspace folder in a .bazelrc file, i.e startup --output_base %workspace%/output. Is there any way to use this variable in there? Setting i.e startup --output_base ./output would only work as intended when running bazel from workspace dir.
Thanks1

Chloe Calvarin

unread,
May 24, 2018, 10:39:51 AM5/24/18
to bazel-discuss
Currently, this isn't possible.
The value of the flags read from the file are interpreted as if they were passed to Bazel through the command line: the path of the bazelrc does not affect where relative paths are interpreted from, and output base does not accept the %workspace% placeholder that we accept in bazelrc import paths. We could add to the syntax of output_base the option to make this possible, but would need to be careful and justify the change. For instance, any change to output_base's accepted path forms should probably also affect install_base and output_user_root, for consistency. Could you explain why you need this? 

Alberto García Lamela

unread,
Jun 4, 2018, 8:04:24 AM6/4/18
to bazel-discuss
Thanks Chloe, I want to provide the simplest ux for the dev workflow as well as ensuring portability and reproducibility for the CI system running bazel commands. .bazelrc ensures a common config is always applied, to keep things contained within the location of the repo I use output_base=./ So the trade off now is the dev must run bazel from the workspace folder, otherwise the behaviour wont be as intended and bazel will create a ./build folder in each folder the dev runs a bazel command
Reply all
Reply to author
Forward
0 new messages