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