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_SCRIPT_TARGET_WRITER_H_ | 5 #ifndef TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_ |
6 #define TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_ | 6 #define TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 const Toolchain* toolchain, | 21 const Toolchain* toolchain, |
22 std::ostream& out); | 22 std::ostream& out); |
23 virtual ~NinjaScriptTargetWriter(); | 23 virtual ~NinjaScriptTargetWriter(); |
24 | 24 |
25 virtual void Run() OVERRIDE; | 25 virtual void Run() OVERRIDE; |
26 | 26 |
27 private: | 27 private: |
28 FRIEND_TEST_ALL_PREFIXES(NinjaScriptTargetWriter, | 28 FRIEND_TEST_ALL_PREFIXES(NinjaScriptTargetWriter, |
29 WriteOutputFilesForBuildLine); | 29 WriteOutputFilesForBuildLine); |
30 FRIEND_TEST_ALL_PREFIXES(NinjaScriptTargetWriter, | 30 FRIEND_TEST_ALL_PREFIXES(NinjaScriptTargetWriter, |
| 31 WriteOutputFilesForBuildLineWithDepfile); |
| 32 FRIEND_TEST_ALL_PREFIXES(NinjaScriptTargetWriter, |
31 WriteArgsSubstitutions); | 33 WriteArgsSubstitutions); |
32 | 34 |
33 bool has_sources() const { return !target_->sources().empty(); } | 35 bool has_sources() const { return !target_->sources().empty(); } |
34 | 36 |
35 // Writes the Ninja rule for invoking the script. | 37 // Writes the Ninja rule for invoking the script. |
36 // | 38 // |
37 // Returns the name of the custom rule generated. This will be based on the | 39 // Returns the name of the custom rule generated. This will be based on the |
38 // target name, and will include the string "$unique_name" if there are | 40 // target name, and will include the string "$unique_name" if there are |
39 // multiple inputs. | 41 // multiple inputs. |
40 std::string WriteRuleDefinition(const FileTemplate& args_template); | 42 std::string WriteRuleDefinition(const FileTemplate& args_template); |
(...skipping 17 matching lines...) Expand all Loading... |
58 // of the script into one thing that other targets can depend on. | 60 // of the script into one thing that other targets can depend on. |
59 void WriteStamp(const std::vector<OutputFile>& output_files); | 61 void WriteStamp(const std::vector<OutputFile>& output_files); |
60 | 62 |
61 // Writes the output files generated by the output template for the given | 63 // Writes the output files generated by the output template for the given |
62 // source file. This will start with a space and will not include a newline. | 64 // source file. This will start with a space and will not include a newline. |
63 // Appends the output files to the given vector. | 65 // Appends the output files to the given vector. |
64 void WriteOutputFilesForBuildLine(const FileTemplate& output_template, | 66 void WriteOutputFilesForBuildLine(const FileTemplate& output_template, |
65 const SourceFile& source, | 67 const SourceFile& source, |
66 std::vector<OutputFile>* output_files); | 68 std::vector<OutputFile>* output_files); |
67 | 69 |
| 70 void WriteDepfile(const SourceFile& source); |
| 71 |
| 72 // Returns the FileTemplate for the depfile variable. |
| 73 FileTemplate GetDepfileTemplate() const; |
| 74 |
68 // Path output writer that doesn't do any escaping or quoting. It does, | 75 // Path output writer that doesn't do any escaping or quoting. It does, |
69 // however, convert slashes. Used for | 76 // however, convert slashes. Used for |
70 // computing intermediate strings. | 77 // computing intermediate strings. |
71 PathOutput path_output_no_escaping_; | 78 PathOutput path_output_no_escaping_; |
72 | 79 |
73 DISALLOW_COPY_AND_ASSIGN(NinjaScriptTargetWriter); | 80 DISALLOW_COPY_AND_ASSIGN(NinjaScriptTargetWriter); |
74 }; | 81 }; |
75 | 82 |
76 #endif // TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_ | 83 #endif // TOOLS_GN_NINJA_SCRIPT_TARGET_WRITER_H_ |
OLD | NEW |