Home | History | Annotate | Download | only in gn
      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_WRITER_H_
      6 #define TOOLS_GN_NINJA_WRITER_H_
      7 
      8 #include <set>
      9 #include <string>
     10 #include <vector>
     11 
     12 #include "base/basictypes.h"
     13 
     14 class Builder;
     15 class BuildSettings;
     16 class Settings;
     17 class Target;
     18 
     19 class NinjaWriter {
     20  public:
     21   // On failure will print an error and will return false.
     22   static bool RunAndWriteFiles(const BuildSettings* build_settings,
     23                                Builder* builder);
     24 
     25   // Writes only the toolchain.ninja files, skipping the root buildfile. The
     26   // settings for the files written will be added to the vector.
     27   static bool RunAndWriteToolchainFiles(
     28       const BuildSettings* build_settings,
     29       Builder* builder,
     30       std::vector<const Settings*>* all_settings);
     31 
     32  private:
     33   NinjaWriter(const BuildSettings* build_settings, Builder* builder);
     34   ~NinjaWriter();
     35 
     36   bool WriteToolchains(
     37       std::vector<const Settings*>* all_settings,
     38       std::vector<const Target*>* default_targets);
     39   bool WriteRootBuildfiles(const std::vector<const Settings*>& all_settings,
     40                            const std::vector<const Target*>& default_targets);
     41 
     42   const BuildSettings* build_settings_;
     43   Builder* builder_;
     44 
     45   DISALLOW_COPY_AND_ASSIGN(NinjaWriter);
     46 };
     47 
     48 #endif  // TOOLS_GN_NINJA_WRITER_H_
     49