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