lpino | b379f65 | 2017-04-07 12:05:09 +0000 | [diff] [blame] | 1 | // Copyright 2017 The Bazel Authors. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
lpino | 233b72d | 2017-07-05 11:08:40 -0400 | [diff] [blame] | 15 | #ifndef BAZEL_SRC_MAIN_CPP_OPTION_PROCESSOR_INTERNAL_H_ |
| 16 | #define BAZEL_SRC_MAIN_CPP_OPTION_PROCESSOR_INTERNAL_H_ |
lpino | b379f65 | 2017-04-07 12:05:09 +0000 | [diff] [blame] | 17 | |
| 18 | #include <algorithm> |
ccalvarin | ec83598 | 2018-08-02 16:49:56 -0700 | [diff] [blame] | 19 | #include <set> |
lpino | b379f65 | 2017-04-07 12:05:09 +0000 | [diff] [blame] | 20 | |
ccalvarin | fec75f4 | 2018-04-23 10:40:26 -0700 | [diff] [blame] | 21 | #include "src/main/cpp/rc_file.h" |
| 22 | #include "src/main/cpp/util/exit_code.h" |
lpino | b379f65 | 2017-04-07 12:05:09 +0000 | [diff] [blame] | 23 | #include "src/main/cpp/util/file.h" |
| 24 | |
| 25 | namespace blaze { |
| 26 | namespace internal { |
| 27 | |
lpino | 233b72d | 2017-07-05 11:08:40 -0400 | [diff] [blame] | 28 | // Returns the deduped set of bazelrc paths (with respect to its canonical form) |
lpino | b379f65 | 2017-04-07 12:05:09 +0000 | [diff] [blame] | 29 | // preserving the original order. The paths that cannot be resolved are |
| 30 | // omitted. |
| 31 | std::vector<std::string> DedupeBlazercPaths( |
| 32 | const std::vector<std::string>& paths); |
| 33 | |
ccalvarin | ec83598 | 2018-08-02 16:49:56 -0700 | [diff] [blame] | 34 | // Get the legacy list of rc files that would have been loaded - this is to |
| 35 | // provide a useful warning if files are being ignored that were loaded in a |
| 36 | // previous version of Bazel. |
| 37 | // TODO(b/3616816): Remove this once the warning is no longer useful. |
| 38 | std::set<std::string> GetOldRcPaths( |
| 39 | const WorkspaceLayout* workspace_layout, const std::string& workspace, |
| 40 | const std::string& cwd, const std::string& path_to_binary, |
| 41 | const std::vector<std::string>& startup_args); |
| 42 | |
| 43 | // Returns what the "user bazelrc" would have been in the legacy rc list. |
| 44 | std::string FindLegacyUserBazelrc(const char* cmd_line_rc_file, |
| 45 | const std::string& workspace); |
| 46 | |
ccalvarin | bccf9c6 | 2018-06-20 15:05:23 -0700 | [diff] [blame] | 47 | std::string FindSystemWideRc(); |
| 48 | |
ccalvarin | fec75f4 | 2018-04-23 10:40:26 -0700 | [diff] [blame] | 49 | std::string FindRcAlongsideBinary(const std::string& cwd, |
| 50 | const std::string& path_to_binary); |
| 51 | |
| 52 | blaze_exit_code::ExitCode ParseErrorToExitCode(RcFile::ParseError parse_error); |
| 53 | |
lpino | b379f65 | 2017-04-07 12:05:09 +0000 | [diff] [blame] | 54 | } // namespace internal |
| 55 | } // namespace blaze |
| 56 | |
lpino | 233b72d | 2017-07-05 11:08:40 -0400 | [diff] [blame] | 57 | #endif // BAZEL_SRC_MAIN_CPP_OPTION_PROCESSOR_INTERNAL_H_ |