Skip to content

Remove tools/bazel.rc parsing #6319

Closed
Closed

Description

@dslomov

Current documentation of how .bazerc files are parsed is here: https://docs.bazel.build/versions/master/user-manual.html#where-are-the-bazelrc-files

#6321 introduced a support for parsing tools/bazel.rc file to ease the transition.

How to migrate

(see the complete summary of changes in #6319 (comment))

%workspace%/tools/bazel.rc is replaced by %workspace%/.bazelrc. If you have the old file and want to support multiple versions of bazel - add the line import %workspace%/tools/bazel.rc at the top of your new .bazelrc file.

This file is in the same location as a file that used to be a "user-rc" (per-user configuration file for the project) - this is because it's the best place for it. If you have trouble transitioning though, because the user-rc was .gitignored, here is a suggestion for how to update your layout:

  • Move the old .bazelrc to user.bazelrc
  • Change the gitignore to ignoring that file.
  • Add the line try-import %workspace%/user.bazelrc

Activity

  1. added
    incompatible-change
    on Oct 5, 2018
  2. self-assigned this
    on Oct 5, 2018
  3. added
    P0
    on Oct 5, 2018
  4. katre commented on Oct 5, 2018

    @katre
    Collaborator

    This is then also a release blocker for 0.19 (#6116).

  5. dslomov commented on Oct 5, 2018

    @dslomov
    ContributorAuthor

    This bug is actually not a release blocker for 0.18, #6321 is.
    However this bug is indeed a blocker for 0.19

  6. katre commented on Oct 5, 2018

    @katre
    Collaborator

    Once they are merged please comment on #6116 to let me know what the needed cherrypicks are. Thanks!

  7. cvcal commented on Oct 5, 2018

    @cvcal
    Contributor

    The old list of bazelrcs was, in order:

    • %workspace%/tools/bazel.rc (unless --nomaster_bazelrc)
    • %binary_dir%/bazel.bazelrc (unless --nomaster_bazelrc)
    • system rc, /etc/bazel.bazelrc or in %ProgramData% for Windows (unless --nomaster_bazelrc)
    • the first of the following gets called the "user" bazelrc
      • path passed by flag --bazelrc
      • %workspace%/.bazelrc
      • $HOME/.bazelrc

    The new list is hopefully a bit more consistent, as:

    • system rc (unless --nosystem_rc) (same location as before)
    • workspace, %workspace%/.bazelrc (unless --noworkspace_rc)
    • user, $HOME/.bazelrc (unless --nohome_rc)
    • command-line provided, passed as --bazelrc or nothing if the flag is absent.

    This means that the following rc's will be ignored from now on:

    • %workspace%/tools/bazel.rc
      1. This is replaced by %workspace%/.bazelrc. If you have the old file and want to support multiple versions of bazel - add the line import %workspace%/tools/bazel.rc at the top of your new .bazelrc file.
      2. Yes, this is in the same location as a file that used to be a "user-rc" - this is because it's the best place for it. If you have trouble transitioning though, because the user-rc was .gitignored, here is a suggestion for how to update your layout:
        1. Move the old .bazelrc to user.bazelrc
        2. Change the gitignore to ignoring that file.
        3. The workspace rc file, the new .bazelrc, can be checked in (and import tools/bazel.rc, if you need version compatibility as described above), and contain the line try-import %workspace%/user.bazelrc. This will allow users of this git project to optionally have the user rc, without erroring out for the users who do not need it.
    • %binary_dir%/bazel.bazelrc
      • There is no replacement for the binary rc - there wasn't much of a use case for that and the system rc should be sufficient, but if you were using it, please import that file into your system rc.
  8. dslomov commented on Oct 5, 2018

    @dslomov
    ContributorAuthor

    @katre Well actually this one is not a release blocker for 0.19 because that one is already cut. As long as you do not cherry-pick the fix for #6321 (don't), no action is needed.

    However it is a release blocker for 0.20 (#6117)

  9. 6 remaining items

  10. sgreenstein commented on Oct 24, 2018

    @sgreenstein
    Contributor

    Where does the user rc reside on Windows?

    %USERPROFILE%/.bazelrc

  11. added a commit that references this issue on Nov 27, 2018
  12. added a commit that references this issue on Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0incompatible-changetype: feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions