| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef TOOLS_GN_NINJA_WRITER_H_ | 5 #ifndef TOOLS_GN_NINJA_WRITER_H_ |
| 6 #define TOOLS_GN_NINJA_WRITER_H_ | 6 #define TOOLS_GN_NINJA_WRITER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 | 13 |
| 14 class Builder; | 14 class Builder; |
| 15 class BuildSettings; | 15 class BuildSettings; |
| 16 class Err; |
| 16 class Settings; | 17 class Settings; |
| 17 class Target; | 18 class Target; |
| 18 | 19 |
| 19 class NinjaWriter { | 20 class NinjaWriter { |
| 20 public: | 21 public: |
| 21 // On failure will print an error and will return false. | 22 // On failure will populate |err| and will return false. |
| 22 static bool RunAndWriteFiles(const BuildSettings* build_settings, | 23 static bool RunAndWriteFiles(const BuildSettings* build_settings, |
| 23 Builder* builder); | 24 Builder* builder, |
| 25 Err* err); |
| 24 | 26 |
| 25 // Writes only the toolchain.ninja files, skipping the root buildfile. The | 27 // Writes only the toolchain.ninja files, skipping the root buildfile. The |
| 26 // settings for the files written will be added to the vector. | 28 // settings for the files written will be added to the vector. |
| 27 static bool RunAndWriteToolchainFiles( | 29 static bool RunAndWriteToolchainFiles( |
| 28 const BuildSettings* build_settings, | 30 const BuildSettings* build_settings, |
| 29 Builder* builder, | 31 Builder* builder, |
| 30 std::vector<const Settings*>* all_settings); | 32 std::vector<const Settings*>* all_settings, |
| 33 Err* err); |
| 31 | 34 |
| 32 private: | 35 private: |
| 33 NinjaWriter(const BuildSettings* build_settings, Builder* builder); | 36 NinjaWriter(const BuildSettings* build_settings, Builder* builder); |
| 34 ~NinjaWriter(); | 37 ~NinjaWriter(); |
| 35 | 38 |
| 36 bool WriteToolchains( | 39 bool WriteToolchains( |
| 37 std::vector<const Settings*>* all_settings, | 40 std::vector<const Settings*>* all_settings, |
| 38 std::vector<const Target*>* default_targets); | 41 std::vector<const Target*>* default_targets, |
| 42 Err* err); |
| 39 bool WriteRootBuildfiles(const std::vector<const Settings*>& all_settings, | 43 bool WriteRootBuildfiles(const std::vector<const Settings*>& all_settings, |
| 40 const std::vector<const Target*>& default_targets); | 44 const std::vector<const Target*>& default_targets, |
| 45 Err* err); |
| 41 | 46 |
| 42 const BuildSettings* build_settings_; | 47 const BuildSettings* build_settings_; |
| 43 Builder* builder_; | 48 Builder* builder_; |
| 44 | 49 |
| 45 DISALLOW_COPY_AND_ASSIGN(NinjaWriter); | 50 DISALLOW_COPY_AND_ASSIGN(NinjaWriter); |
| 46 }; | 51 }; |
| 47 | 52 |
| 48 #endif // TOOLS_GN_NINJA_WRITER_H_ | 53 #endif // TOOLS_GN_NINJA_WRITER_H_ |
| OLD | NEW |