Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: tools/gn/ninja_build_writer.h

Issue 2152413002: GN: don't write separate files for non-binary targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/json_project_writer.cc ('k') | tools/gn/ninja_build_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <map>
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 Builder;
15 class BuildSettings; 16 class BuildSettings;
16 class Err; 17 class Err;
17 class Pool; 18 class Pool;
18 class Settings; 19 class Settings;
19 class Target; 20 class Target;
20 class Toolchain; 21 class Toolchain;
21 22
22 // Generates the toplevel "build.ninja" file. This references the individual 23 // Generates the toplevel "build.ninja" file. This references the individual
23 // toolchain files and lists all input .gn files as dependencies of the 24 // toolchain files and lists all input .gn files as dependencies of the
24 // build itself. 25 // build itself.
25 class NinjaBuildWriter { 26 class NinjaBuildWriter {
26 public: 27 public:
28 NinjaBuildWriter(
29 const BuildSettings* settings,
30 const std::map<const Settings*, const Toolchain*>& used_toolchains,
31 const Toolchain* default_toolchain,
32 const std::vector<const Target*>& default_toolchain_targets,
33 std::ostream& out,
34 std::ostream& dep_out);
35 ~NinjaBuildWriter();
36
37 // The design of this class is that this static factory function takes the
38 // Builder, extracts the relevant information, and passes it to the class
39 // constructor. The class itself doesn't depend on the Builder at all which
40 // makes testing much easier (tests integrating various functions along with
41 // the Builder get very complicated).
27 static bool RunAndWriteFile( 42 static bool RunAndWriteFile(
28 const BuildSettings* settings, 43 const BuildSettings* settings,
29 const std::vector<const Settings*>& all_settings, 44 const Builder& builder,
30 const Toolchain* default_toolchain,
31 const std::vector<const Target*>& default_toolchain_targets,
32 const std::vector<const Pool*>& all_pools,
33 Err* err); 45 Err* err);
34 46
35 NinjaBuildWriter(const BuildSettings* settings,
36 const std::vector<const Settings*>& all_settings,
37 const Toolchain* default_toolchain,
38 const std::vector<const Target*>& default_toolchain_targets,
39 const std::vector<const Pool*>& all_pools,
40 std::ostream& out,
41 std::ostream& dep_out);
42 ~NinjaBuildWriter();
43
44 bool Run(Err* err); 47 bool Run(Err* err);
45 48
46 private: 49 private:
47 void WriteNinjaRules(); 50 void WriteNinjaRules();
48 void WriteAllPools(); 51 void WriteAllPools();
49 void WriteSubninjas(); 52 void WriteSubninjas();
50 bool WritePhonyAndAllRules(Err* err); 53 bool WritePhonyAndAllRules(
54 Err* err);
51 55
52 void WritePhonyRule(const Target* target, const std::string& phony_name); 56 void WritePhonyRule(const Target* target, const std::string& phony_name);
53 57
54 const BuildSettings* build_settings_; 58 const BuildSettings* build_settings_;
55 std::vector<const Settings*> all_settings_; 59
60 const std::map<const Settings*, const Toolchain*>& used_toolchains_;
56 const Toolchain* default_toolchain_; 61 const Toolchain* default_toolchain_;
57 std::vector<const Target*> default_toolchain_targets_; 62 const std::vector<const Target*>& default_toolchain_targets_;
58 std::vector<const Pool*> all_pools_; 63
59 std::ostream& out_; 64 std::ostream& out_;
60 std::ostream& dep_out_; 65 std::ostream& dep_out_;
61 PathOutput path_output_; 66 PathOutput path_output_;
62 67
63 DISALLOW_COPY_AND_ASSIGN(NinjaBuildWriter); 68 DISALLOW_COPY_AND_ASSIGN(NinjaBuildWriter);
64 }; 69 };
65 70
66 #endif // TOOLS_GN_NINJA_BUILD_WRITER_H_ 71 #endif // TOOLS_GN_NINJA_BUILD_WRITER_H_
67 72
OLDNEW
« no previous file with comments | « tools/gn/json_project_writer.cc ('k') | tools/gn/ninja_build_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698