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_
11 #include "tools/gn/path_output.h"
18 // Generates the toplevel "build.ninja" file. This references the individual
19 // toolchain files and lists all input .gn files as dependencies of the
21 class NinjaBuildWriter {
23 static bool RunAndWriteFile(
24 const BuildSettings* settings,
25 const std::vector<const Settings*>& all_settings,
26 const Toolchain* default_toolchain,
27 const std::vector<const Target*>& default_toolchain_targets);
30 NinjaBuildWriter(const BuildSettings* settings,
31 const std::vector<const Settings*>& all_settings,
32 const Toolchain* default_toolchain,
33 const std::vector<const Target*>& default_toolchain_targets,
35 std::ostream& dep_out);
40 void WriteNinjaRules();
42 void WriteSubninjas();
43 void WritePhonyAndAllRules();
45 void WritePhonyRule(const Target* target, const OutputFile& target_file,
46 const std::string& phony_name);
48 const BuildSettings* build_settings_;
49 std::vector<const Settings*> all_settings_;
50 const Toolchain* default_toolchain_;
51 std::vector<const Target*> default_toolchain_targets_;
53 std::ostream& dep_out_;
54 PathOutput path_output_;
56 DISALLOW_COPY_AND_ASSIGN(NinjaBuildWriter);
59 #endif // TOOLS_GN_NINJA_BUILD_GENERATOR_H_