blob: c552db4e38ae4b1770c824f110d3e1677df38da7 [file] [log] [blame]
lpinob379f652017-04-07 12:05:09 +00001// 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
lpino233b72d2017-07-05 11:08:40 -040015#ifndef BAZEL_SRC_MAIN_CPP_OPTION_PROCESSOR_INTERNAL_H_
16#define BAZEL_SRC_MAIN_CPP_OPTION_PROCESSOR_INTERNAL_H_
lpinob379f652017-04-07 12:05:09 +000017
18#include <algorithm>
ccalvarinec835982018-08-02 16:49:56 -070019#include <set>
lpinob379f652017-04-07 12:05:09 +000020
ccalvarinfec75f42018-04-23 10:40:26 -070021#include "src/main/cpp/rc_file.h"
22#include "src/main/cpp/util/exit_code.h"
lpinob379f652017-04-07 12:05:09 +000023#include "src/main/cpp/util/file.h"
24
25namespace blaze {
26namespace internal {
27
lpino233b72d2017-07-05 11:08:40 -040028// Returns the deduped set of bazelrc paths (with respect to its canonical form)
lpinob379f652017-04-07 12:05:09 +000029// preserving the original order. The paths that cannot be resolved are
30// omitted.
31std::vector<std::string> DedupeBlazercPaths(
32 const std::vector<std::string>& paths);
33
ccalvarinec835982018-08-02 16:49:56 -070034// 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.
38std::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.
44std::string FindLegacyUserBazelrc(const char* cmd_line_rc_file,
45 const std::string& workspace);
46
ccalvarinbccf9c62018-06-20 15:05:23 -070047std::string FindSystemWideRc();
48
ccalvarinfec75f42018-04-23 10:40:26 -070049std::string FindRcAlongsideBinary(const std::string& cwd,
50 const std::string& path_to_binary);
51
52blaze_exit_code::ExitCode ParseErrorToExitCode(RcFile::ParseError parse_error);
53
lpinob379f652017-04-07 12:05:09 +000054} // namespace internal
55} // namespace blaze
56
lpino233b72d2017-07-05 11:08:40 -040057#endif // BAZEL_SRC_MAIN_CPP_OPTION_PROCESSOR_INTERNAL_H_