aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/option_processor.h
diff options
context:
space:
mode:
authorGravatar ccalvarin <ccalvarin@google.com>2018-08-02 16:49:56 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-08-02 16:51:24 -0700
commitec83598cb6ee4136166bb562a24dc5dfa58921db (patch)
treeda003f48a11b4e3e8f56c5aea2673c49f84d3407 /src/main/cpp/option_processor.h
parent1ae4fc24164a4131ac9f177f3e91170ae4e721bc (diff)
Change the list of rc files accepted.
The old list 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) - 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 list removes two less than useful locations, duplication in the Workspace directory, and the rc next to the bazel binary. This location made sense at Google but is generally nonsensical elsewhere so we are removing it. It also stops the user local rc file from being overriden by passing in a custom file in --bazelrc. In both old and new, --ignore_all_rc_files disables all of the above. For a transition period, any file that you would have loaded but was not read will cause a WARNING to be printed. If you want the old file to still be read without moving its location, you can always import it into one of the new standard locations, or create a symlink. Closes #4502, except for cleanup to remove the warning after a transition period of 1 Bazel version has passed. RELNOTES[INC]: New bazelrc file list. PiperOrigin-RevId: 207189212
Diffstat (limited to 'src/main/cpp/option_processor.h')
-rw-r--r--src/main/cpp/option_processor.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/main/cpp/option_processor.h b/src/main/cpp/option_processor.h
index 2ae1798f85..0d7277fb96 100644
--- a/src/main/cpp/option_processor.h
+++ b/src/main/cpp/option_processor.h
@@ -115,24 +115,17 @@ class OptionProcessor {
const std::vector<std::unique_ptr<RcFile>>& blazercs,
const std::vector<std::string>& env);
- // Finds and parses the appropriate RcFiles.
- // TODO(#4502) Change where the bazelrcs are read from.
+ // Finds and parses the appropriate RcFiles:
+ // - system rc (unless --nosystem_rc)
+ // - workspace, %workspace%/.bazelrc (unless --noworkspace_rc)
+ // - user, $HOME/.bazelrc (unless --nohome_rc)
+ // - command-line provided, if a value is passed with --bazelrc.
virtual blaze_exit_code::ExitCode GetRcFiles(
const WorkspaceLayout* workspace_layout, const std::string& workspace,
const std::string& cwd, const CommandLine* cmd_line,
std::vector<std::unique_ptr<RcFile>>* result_rc_files,
std::string* error) const;
- protected:
- // Return the path to the user's rc file. If cmd_line_rc_file != NULL,
- // use it, dying if it is not readable. Otherwise, return the first
- // readable file called rc_basename from [workspace, $HOME]
- //
- // If no readable .blazerc file is found, return the empty string.
- virtual blaze_exit_code::ExitCode FindUserBlazerc(
- const char* cmd_line_rc_file, const std::string& workspace,
- std::string* user_blazerc_file, std::string* error) const;
-
private:
blaze_exit_code::ExitCode ParseStartupOptions(
const std::vector<std::unique_ptr<RcFile>>& rc_files,