OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TOOLS_GN_NINJA_BUILD_WRITER_H_ | 5 #ifndef TOOLS_GN_NINJA_BUILD_WRITER_H_ |
6 #define TOOLS_GN_NINJA_BUILD_WRITER_H_ | 6 #define TOOLS_GN_NINJA_BUILD_WRITER_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 12 matching lines...) Loading... |
23 // build itself. | 23 // build itself. |
24 class NinjaBuildWriter { | 24 class NinjaBuildWriter { |
25 public: | 25 public: |
26 static bool RunAndWriteFile( | 26 static bool RunAndWriteFile( |
27 const BuildSettings* settings, | 27 const BuildSettings* settings, |
28 const std::vector<const Settings*>& all_settings, | 28 const std::vector<const Settings*>& all_settings, |
29 const Toolchain* default_toolchain, | 29 const Toolchain* default_toolchain, |
30 const std::vector<const Target*>& default_toolchain_targets, | 30 const std::vector<const Target*>& default_toolchain_targets, |
31 Err* err); | 31 Err* err); |
32 | 32 |
33 private: | |
34 NinjaBuildWriter(const BuildSettings* settings, | 33 NinjaBuildWriter(const BuildSettings* settings, |
35 const std::vector<const Settings*>& all_settings, | 34 const std::vector<const Settings*>& all_settings, |
36 const Toolchain* default_toolchain, | 35 const Toolchain* default_toolchain, |
37 const std::vector<const Target*>& default_toolchain_targets, | 36 const std::vector<const Target*>& default_toolchain_targets, |
38 std::ostream& out, | 37 std::ostream& out, |
39 std::ostream& dep_out); | 38 std::ostream& dep_out); |
40 ~NinjaBuildWriter(); | 39 ~NinjaBuildWriter(); |
41 | 40 |
42 bool Run(Err* err); | 41 bool Run(Err* err); |
43 | 42 |
| 43 private: |
44 void WriteNinjaRules(); | 44 void WriteNinjaRules(); |
45 void WriteLinkPool(); | 45 void WriteLinkPool(); |
46 void WriteSubninjas(); | 46 void WriteSubninjas(); |
47 bool WritePhonyAndAllRules(Err* err); | 47 bool WritePhonyAndAllRules(Err* err); |
48 | 48 |
49 // Writes a phony rule for the given target with the given name. Adds the new | 49 // Writes a phony rule for the given target with the given name. Adds the new |
50 // name to the given set. If the name is already in the set, does nothing. | 50 // name to the given set. If the name is already in the set, does nothing. |
51 void WritePhonyRule(const Target* target, | 51 void WritePhonyRule(const Target* target, |
52 const OutputFile& target_file, | 52 const OutputFile& target_file, |
53 const std::string& phony_name, | 53 const std::string& phony_name, |
54 std::set<std::string>* written_rules); | 54 std::set<std::string>* written_rules); |
55 | 55 |
56 const BuildSettings* build_settings_; | 56 const BuildSettings* build_settings_; |
57 std::vector<const Settings*> all_settings_; | 57 std::vector<const Settings*> all_settings_; |
58 const Toolchain* default_toolchain_; | 58 const Toolchain* default_toolchain_; |
59 std::vector<const Target*> default_toolchain_targets_; | 59 std::vector<const Target*> default_toolchain_targets_; |
60 std::ostream& out_; | 60 std::ostream& out_; |
61 std::ostream& dep_out_; | 61 std::ostream& dep_out_; |
62 PathOutput path_output_; | 62 PathOutput path_output_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(NinjaBuildWriter); | 64 DISALLOW_COPY_AND_ASSIGN(NinjaBuildWriter); |
65 }; | 65 }; |
66 | 66 |
67 #endif // TOOLS_GN_NINJA_BUILD_WRITER_H_ | 67 #endif // TOOLS_GN_NINJA_BUILD_WRITER_H_ |
68 | 68 |
OLD | NEW |