Implement environment variable substitution for unix platforms
I want to be able to use this to redirect the bazel config file based
on the environment, for integration with our existing
environment-based mechanisms for selecting build configurations.
I found some opinions in comments which said this was too difficult,
which I have amended.
Closes #7318.
PiperOrigin-RevId: 237467945
diff --git a/src/main/cpp/option_processor.cc b/src/main/cpp/option_processor.cc
index 181afd2..6c4e3f4 100644
--- a/src/main/cpp/option_processor.cc
+++ b/src/main/cpp/option_processor.cc
@@ -220,7 +220,7 @@
std::string FindSystemWideRc(const std::string& system_bazelrc_path) {
const std::string path =
- blaze_util::MakeAbsoluteAndResolveWindowsEnvvars(system_bazelrc_path);
+ blaze_util::MakeAbsoluteAndResolveEnvvars(system_bazelrc_path);
if (blaze_util::CanReadFile(path)) {
return path;
}
@@ -325,11 +325,11 @@
// Get the system rc (unless --nosystem_rc).
if (SearchNullaryOption(cmd_line->startup_args, "system_rc", true)) {
- // MakeAbsoluteAndResolveWindowsEnvvars will standardize the form of the
+ // MakeAbsoluteAndResolveEnvvars will standardize the form of the
// provided path. This also means we accept relative paths, which is
// is convenient for testing.
const std::string system_rc =
- blaze_util::MakeAbsoluteAndResolveWindowsEnvvars(system_bazelrc_path_);
+ blaze_util::MakeAbsoluteAndResolveEnvvars(system_bazelrc_path_);
rc_files.push_back(system_rc);
}