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.
4
5#ifndef TOOLS_GN_NINJA_TOOLCHAIN_WRITER_H_
6#define TOOLS_GN_NINJA_TOOLCHAIN_WRITER_H_
7
8#include <iosfwd>
9#include <vector>
10
11#include "tools/gn/ninja_helper.h"
12#include "tools/gn/path_output.h"
13
14class BuildSettings;
15class Settings;
16class Target;
17
18class NinjaToolchainWriter {
19 public:
20  // Takes the settings for the toolchain, as well as the list of all targets
21  // assicoated with the toolchain.
22  static bool RunAndWriteFile(const Settings* settings,
23                              const std::vector<const Target*>& targets);
24
25 private:
26  NinjaToolchainWriter(const Settings* settings,
27                       const std::vector<const Target*>& targets,
28                       std::ostream& out);
29  ~NinjaToolchainWriter();
30
31  void Run();
32
33  void WriteRules();
34  void WriteSubninjas();
35
36  const Settings* settings_;
37  std::vector<const Target*> targets_;
38  std::ostream& out_;
39  PathOutput path_output_;
40
41  NinjaHelper helper_;
42
43  DISALLOW_COPY_AND_ASSIGN(NinjaToolchainWriter);
44};
45
46#endif  // TOOLS_GN_NINJA_TOOLCHAIN_WRITER_H_
47