| 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 BuildSettings; | 15 class BuildSettings; |
| 15 class Settings; | 16 class Settings; |
| 16 class Target; | 17 class Target; |
| 17 | 18 |
| 18 class NinjaWriter { | 19 class NinjaWriter { |
| 19 public: | 20 public: |
| 20 // On failure will print an error and will return false. | 21 // On failure will print an error and will return false. |
| 21 static bool RunAndWriteFiles(const BuildSettings* build_settings); | 22 static bool RunAndWriteFiles(const BuildSettings* build_settings, |
| 23 Builder* builder); |
| 22 | 24 |
| 23 // Writes only the toolchain.ninja files, skipping the root buildfile. The | 25 // Writes only the toolchain.ninja files, skipping the root buildfile. The |
| 24 // settings for the files written will be added to the vector. | 26 // settings for the files written will be added to the vector. |
| 25 // | |
| 26 // The skip files will avoid writing "subninja" rules when we're doing a | |
| 27 // side-by-side GYP build. .ninja files exactly matching the ones in the set | |
| 28 // will be ignored. | |
| 29 static bool RunAndWriteToolchainFiles( | 27 static bool RunAndWriteToolchainFiles( |
| 30 const BuildSettings* build_settings, | 28 const BuildSettings* build_settings, |
| 31 const std::set<std::string>& skip_files, | 29 Builder* builder, |
| 32 std::vector<const Settings*>* all_settings); | 30 std::vector<const Settings*>* all_settings); |
| 33 | 31 |
| 34 private: | 32 private: |
| 35 NinjaWriter(const BuildSettings* build_settings); | 33 NinjaWriter(const BuildSettings* build_settings, Builder* builder); |
| 36 ~NinjaWriter(); | 34 ~NinjaWriter(); |
| 37 | 35 |
| 38 bool WriteToolchains( | 36 bool WriteToolchains( |
| 39 const std::set<std::string>& skip_files, | |
| 40 std::vector<const Settings*>* all_settings, | 37 std::vector<const Settings*>* all_settings, |
| 41 std::vector<const Target*>* default_targets); | 38 std::vector<const Target*>* default_targets); |
| 42 bool WriteRootBuildfiles(const std::vector<const Settings*>& all_settings, | 39 bool WriteRootBuildfiles(const std::vector<const Settings*>& all_settings, |
| 43 const std::vector<const Target*>& default_targets); | 40 const std::vector<const Target*>& default_targets); |
| 44 | 41 |
| 45 const BuildSettings* build_settings_; | 42 const BuildSettings* build_settings_; |
| 43 Builder* builder_; |
| 46 | 44 |
| 47 DISALLOW_COPY_AND_ASSIGN(NinjaWriter); | 45 DISALLOW_COPY_AND_ASSIGN(NinjaWriter); |
| 48 }; | 46 }; |
| 49 | 47 |
| 50 #endif // TOOLS_GN_NINJA_WRITER_H_ | 48 #endif // TOOLS_GN_NINJA_WRITER_H_ |
| OLD | NEW |