athena: Improve the overview mode support for split-view mode.
[chromium-blink-merge.git] / tools / gn / ninja_toolchain_writer.h
blob50cb7ef60db5f1e6951eceacb0e05c209c776ce6
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef TOOLS_GN_NINJA_TOOLCHAIN_WRITER_H_
6 #define TOOLS_GN_NINJA_TOOLCHAIN_WRITER_H_
8 #include <iosfwd>
9 #include <set>
10 #include <string>
11 #include <vector>
13 #include "base/gtest_prod_util.h"
14 #include "tools/gn/path_output.h"
15 #include "tools/gn/toolchain.h"
17 class BuildSettings;
18 struct EscapeOptions;
19 class Settings;
20 class Target;
21 class Tool;
23 class NinjaToolchainWriter {
24 public:
25 // Takes the settings for the toolchain, as well as the list of all targets
26 // associated with the toolchain.
27 static bool RunAndWriteFile(const Settings* settings,
28 const Toolchain* toolchain,
29 const std::vector<const Target*>& targets);
31 private:
32 FRIEND_TEST_ALL_PREFIXES(NinjaToolchainWriter, WriteToolRule);
34 NinjaToolchainWriter(const Settings* settings,
35 const Toolchain* toolchain,
36 const std::vector<const Target*>& targets,
37 std::ostream& out);
38 ~NinjaToolchainWriter();
40 void Run();
42 void WriteRules();
43 void WriteToolRule(Toolchain::ToolType type,
44 const Tool* tool,
45 const std::string& rule_prefix);
46 void WriteRulePattern(const char* name,
47 const SubstitutionPattern& pattern,
48 const EscapeOptions& options);
49 void WriteSubninjas();
51 const Settings* settings_;
52 const Toolchain* toolchain_;
53 std::vector<const Target*> targets_;
54 std::ostream& out_;
55 PathOutput path_output_;
57 DISALLOW_COPY_AND_ASSIGN(NinjaToolchainWriter);
60 #endif // TOOLS_GN_NINJA_TOOLCHAIN_WRITER_H_