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> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "tools/gn/path_output.h" | 13 #include "tools/gn/path_output.h" |
14 | 14 |
15 class BuildSettings; | 15 class BuildSettings; |
16 class Err; | 16 class Err; |
| 17 class Pool; |
17 class Settings; | 18 class Settings; |
18 class Target; | 19 class Target; |
19 class Toolchain; | 20 class Toolchain; |
20 | 21 |
21 // Generates the toplevel "build.ninja" file. This references the individual | 22 // Generates the toplevel "build.ninja" file. This references the individual |
22 // toolchain files and lists all input .gn files as dependencies of the | 23 // toolchain files and lists all input .gn files as dependencies of the |
23 // build itself. | 24 // build itself. |
24 class NinjaBuildWriter { | 25 class NinjaBuildWriter { |
25 public: | 26 public: |
26 static bool RunAndWriteFile( | 27 static bool RunAndWriteFile( |
27 const BuildSettings* settings, | 28 const BuildSettings* settings, |
28 const std::vector<const Settings*>& all_settings, | 29 const std::vector<const Settings*>& all_settings, |
29 const Toolchain* default_toolchain, | 30 const Toolchain* default_toolchain, |
30 const std::vector<const Target*>& default_toolchain_targets, | 31 const std::vector<const Target*>& default_toolchain_targets, |
| 32 const std::vector<const Pool*>& all_pools, |
31 Err* err); | 33 Err* err); |
32 | 34 |
33 NinjaBuildWriter(const BuildSettings* settings, | 35 NinjaBuildWriter(const BuildSettings* settings, |
34 const std::vector<const Settings*>& all_settings, | 36 const std::vector<const Settings*>& all_settings, |
35 const Toolchain* default_toolchain, | 37 const Toolchain* default_toolchain, |
36 const std::vector<const Target*>& default_toolchain_targets, | 38 const std::vector<const Target*>& default_toolchain_targets, |
| 39 const std::vector<const Pool*>& all_pools, |
37 std::ostream& out, | 40 std::ostream& out, |
38 std::ostream& dep_out); | 41 std::ostream& dep_out); |
39 ~NinjaBuildWriter(); | 42 ~NinjaBuildWriter(); |
40 | 43 |
41 bool Run(Err* err); | 44 bool Run(Err* err); |
42 | 45 |
43 private: | 46 private: |
44 void WriteNinjaRules(); | 47 void WriteNinjaRules(); |
45 void WriteLinkPool(); | 48 void WriteAllPools(); |
46 void WriteSubninjas(); | 49 void WriteSubninjas(); |
47 bool WritePhonyAndAllRules(Err* err); | 50 bool WritePhonyAndAllRules(Err* err); |
48 | 51 |
49 void WritePhonyRule(const Target* target, const std::string& phony_name); | 52 void WritePhonyRule(const Target* target, const std::string& phony_name); |
50 | 53 |
51 const BuildSettings* build_settings_; | 54 const BuildSettings* build_settings_; |
52 std::vector<const Settings*> all_settings_; | 55 std::vector<const Settings*> all_settings_; |
53 const Toolchain* default_toolchain_; | 56 const Toolchain* default_toolchain_; |
54 std::vector<const Target*> default_toolchain_targets_; | 57 std::vector<const Target*> default_toolchain_targets_; |
| 58 std::vector<const Pool*> all_pools_; |
55 std::ostream& out_; | 59 std::ostream& out_; |
56 std::ostream& dep_out_; | 60 std::ostream& dep_out_; |
57 PathOutput path_output_; | 61 PathOutput path_output_; |
58 | 62 |
59 DISALLOW_COPY_AND_ASSIGN(NinjaBuildWriter); | 63 DISALLOW_COPY_AND_ASSIGN(NinjaBuildWriter); |
60 }; | 64 }; |
61 | 65 |
62 #endif // TOOLS_GN_NINJA_BUILD_WRITER_H_ | 66 #endif // TOOLS_GN_NINJA_BUILD_WRITER_H_ |
63 | 67 |
OLD | NEW |