Add ICU message format support
[chromium-blink-merge.git] / tools / gn / ninja_build_writer.h
blobfe7b7a5d3d98f5f95719edf27c481516590841f3
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
3 // found in the LICENSE file.
5 #ifndef TOOLS_GN_NINJA_BUILD_WRITER_H_
6 #define TOOLS_GN_NINJA_BUILD_WRITER_H_
8 #include <iosfwd>
9 #include <set>
10 #include <vector>
12 #include "tools/gn/path_output.h"
14 class BuildSettings;
15 class Err;
16 class Settings;
17 class Target;
18 class Toolchain;
20 // Generates the toplevel "build.ninja" file. This references the individual
21 // toolchain files and lists all input .gn files as dependencies of the
22 // build itself.
23 class NinjaBuildWriter {
24 public:
25 static bool RunAndWriteFile(
26 const BuildSettings* settings,
27 const std::vector<const Settings*>& all_settings,
28 const Toolchain* default_toolchain,
29 const std::vector<const Target*>& default_toolchain_targets,
30 Err* err);
32 private:
33 NinjaBuildWriter(const BuildSettings* settings,
34 const std::vector<const Settings*>& all_settings,
35 const Toolchain* default_toolchain,
36 const std::vector<const Target*>& default_toolchain_targets,
37 std::ostream& out,
38 std::ostream& dep_out);
39 ~NinjaBuildWriter();
41 bool Run(Err* err);
43 void WriteNinjaRules();
44 void WriteLinkPool();
45 void WriteSubninjas();
46 bool WritePhonyAndAllRules(Err* err);
48 // Writes a phony rule for the given target with the given name. Adds the new
49 // name to the given set. If the name is already in the set, does nothing.
50 void WritePhonyRule(const Target* target,
51 const OutputFile& target_file,
52 const std::string& phony_name,
53 std::set<std::string>* written_rules);
55 const BuildSettings* build_settings_;
56 std::vector<const Settings*> all_settings_;
57 const Toolchain* default_toolchain_;
58 std::vector<const Target*> default_toolchain_targets_;
59 std::ostream& out_;
60 std::ostream& dep_out_;
61 PathOutput path_output_;
63 DISALLOW_COPY_AND_ASSIGN(NinjaBuildWriter);
66 #endif // TOOLS_GN_NINJA_BUILD_WRITER_H_