Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / tools / gn / ninja_writer.h
blobbde836ce2825bebd80e9fe59a1452b4753bf7f81
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_WRITER_H_
6 #define TOOLS_GN_NINJA_WRITER_H_
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
14 class Builder;
15 class BuildSettings;
16 class Err;
17 class Settings;
18 class Target;
20 class NinjaWriter {
21 public:
22 // On failure will populate |err| and will return false.
23 static bool RunAndWriteFiles(const BuildSettings* build_settings,
24 Builder* builder,
25 Err* err);
27 // Writes only the toolchain.ninja files, skipping the root buildfile. The
28 // settings for the files written will be added to the vector.
29 static bool RunAndWriteToolchainFiles(
30 const BuildSettings* build_settings,
31 Builder* builder,
32 std::vector<const Settings*>* all_settings,
33 Err* err);
35 private:
36 NinjaWriter(const BuildSettings* build_settings, Builder* builder);
37 ~NinjaWriter();
39 bool WriteToolchains(
40 std::vector<const Settings*>* all_settings,
41 std::vector<const Target*>* default_targets,
42 Err* err);
43 bool WriteRootBuildfiles(const std::vector<const Settings*>& all_settings,
44 const std::vector<const Target*>& default_targets,
45 Err* err);
47 const BuildSettings* build_settings_;
48 Builder* builder_;
50 DISALLOW_COPY_AND_ASSIGN(NinjaWriter);
53 #endif // TOOLS_GN_NINJA_WRITER_H_