| 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_GYP_TARGET_WRITER_H_ | 5 #ifndef TOOLS_GN_GYP_TARGET_WRITER_H_ |
| 6 #define TOOLS_GN_GYP_TARGET_WRITER_H_ | 6 #define TOOLS_GN_GYP_TARGET_WRITER_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "tools/gn/gyp_helper.h" | 12 #include "tools/gn/gyp_helper.h" |
| 13 #include "tools/gn/path_output.h" |
| 13 | 14 |
| 14 class BuilderRecord; | 15 class BuilderRecord; |
| 15 class Err; | 16 class Err; |
| 16 class Settings; | 17 class Settings; |
| 17 class SourceFile; | 18 class SourceFile; |
| 18 class Target; | 19 class Target; |
| 19 | 20 |
| 20 class GypTargetWriter { | 21 class GypTargetWriter { |
| 21 public: | 22 public: |
| 22 struct TargetGroup { | 23 struct TargetGroup { |
| 23 TargetGroup() | 24 TargetGroup() |
| 24 : debug(NULL), | 25 : debug(NULL), |
| 25 release(NULL), | 26 release(NULL), |
| 26 host_debug(NULL), | 27 host_debug(NULL), |
| 27 host_release(NULL) { | 28 host_release(NULL) { |
| 28 } | 29 } |
| 29 const BuilderRecord* debug; | 30 const BuilderRecord* debug; |
| 30 const BuilderRecord* release; | 31 const BuilderRecord* release; |
| 31 const BuilderRecord* host_debug; | 32 const BuilderRecord* host_debug; |
| 32 const BuilderRecord* host_release; | 33 const BuilderRecord* host_release; |
| 33 }; | 34 }; |
| 34 | 35 |
| 35 GypTargetWriter(const Target* target, std::ostream& out); | 36 GypTargetWriter(const Target* target, |
| 37 const SourceDir& gyp_dir, |
| 38 std::ostream& out); |
| 36 virtual ~GypTargetWriter(); | 39 virtual ~GypTargetWriter(); |
| 37 | 40 |
| 38 static void WriteFile(const SourceFile& gyp_file, | 41 static void WriteFile(const SourceFile& gyp_file, |
| 39 const std::vector<TargetGroup>& targets, | 42 const std::vector<TargetGroup>& targets, |
| 40 Err* err); | 43 Err* err); |
| 41 | 44 |
| 42 virtual void Run() = 0; | 45 virtual void Run() = 0; |
| 43 | 46 |
| 44 protected: | 47 protected: |
| 48 // Writes the given number of spaces to the output stream and returns it. |
| 49 std::ostream& Indent(int spaces); |
| 50 static std::ostream& Indent(std::ostream& out, int spaces); |
| 51 |
| 52 static const int kExtraIndent = 2; |
| 53 |
| 45 const Settings* settings_; // Non-owning. | 54 const Settings* settings_; // Non-owning. |
| 46 const Target* target_; // Non-owning. | 55 const Target* target_; // Non-owning. |
| 56 SourceDir gyp_dir_; // Dir of GYP file. |
| 47 std::ostream& out_; | 57 std::ostream& out_; |
| 48 | 58 |
| 49 GypHelper helper_; | 59 GypHelper helper_; |
| 60 PathOutput path_output_; |
| 50 | 61 |
| 51 private: | 62 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(GypTargetWriter); | 63 DISALLOW_COPY_AND_ASSIGN(GypTargetWriter); |
| 53 }; | 64 }; |
| 54 | 65 |
| 55 #endif // TOOLS_GN_GYP_TARGET_WRITER_H_ | 66 #endif // TOOLS_GN_GYP_TARGET_WRITER_H_ |
| OLD | NEW |