Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(723)

Side by Side Diff: tools/gn/ninja_binary_target_writer.h

Issue 2071573003: GN: Use implicit dependency for binary input deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review changes Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/ninja_binary_target_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_BINARY_TARGET_WRITER_H_ 5 #ifndef TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_
6 #define TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ 6 #define TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "tools/gn/config_values.h" 9 #include "tools/gn/config_values.h"
10 #include "tools/gn/ninja_target_writer.h" 10 #include "tools/gn/ninja_target_writer.h"
(...skipping 13 matching lines...) Expand all
24 ~NinjaBinaryTargetWriter() override; 24 ~NinjaBinaryTargetWriter() override;
25 25
26 void Run() override; 26 void Run() override;
27 27
28 private: 28 private:
29 typedef std::set<OutputFile> OutputFileSet; 29 typedef std::set<OutputFile> OutputFileSet;
30 30
31 // Writes all flags for the compiler: includes, defines, cflags, etc. 31 // Writes all flags for the compiler: includes, defines, cflags, etc.
32 void WriteCompilerVars(const SourceFileTypeSet& used_types); 32 void WriteCompilerVars(const SourceFileTypeSet& used_types);
33 33
34 // Writes to the output stream a stamp rule for inputs, and
35 // returns the file to be appended to source rules that encodes the
36 // implicit dependencies for the current target. The returned OutputFile
37 // will be empty if there are no inputs.
38 OutputFile WriteInputsStampAndGetDep() const;
39
34 // has_precompiled_headers is set when this substitution matches a tool type 40 // has_precompiled_headers is set when this substitution matches a tool type
35 // that supports precompiled headers, and this target supports precompiled 41 // that supports precompiled headers, and this target supports precompiled
36 // headers. It doesn't indicate if the tool has precompiled headers (this 42 // headers. It doesn't indicate if the tool has precompiled headers (this
37 // will be looked up by this function). 43 // will be looked up by this function).
38 // 44 //
39 // The tool_type indicates the corresponding tool for flags that are 45 // The tool_type indicates the corresponding tool for flags that are
40 // tool-specific (e.g. "cflags_c"). For non-tool-specific flags (e.g. 46 // tool-specific (e.g. "cflags_c"). For non-tool-specific flags (e.g.
41 // "defines") tool_type should be TYPE_NONE. 47 // "defines") tool_type should be TYPE_NONE.
42 void WriteOneFlag( 48 void WriteOneFlag(
43 SubstitutionType subst_enum, 49 SubstitutionType subst_enum,
44 bool has_precompiled_headers, 50 bool has_precompiled_headers,
45 Toolchain::ToolType tool_type, 51 Toolchain::ToolType tool_type,
46 const std::vector<std::string>& (ConfigValues::* getter)() const, 52 const std::vector<std::string>& (ConfigValues::* getter)() const,
47 EscapeOptions flag_escape_options); 53 EscapeOptions flag_escape_options);
48 54
49 // Writes build lines required for precompiled headers. Any generated 55 // Writes build lines required for precompiled headers. Any generated
50 // object files will be appended to the |object_files|. Any generated 56 // object files will be appended to the |object_files|. Any generated
51 // non-object files (for instance, .gch files from a GCC toolchain, are 57 // non-object files (for instance, .gch files from a GCC toolchain, are
52 // appended to |other_files|). 58 // appended to |other_files|).
53 // 59 //
54 // input_dep is the stamp file collecting the dependencies required before 60 // input_dep is the stamp file collecting the dependencies required before
55 // compiling this target. It will be empty if there are no input deps. 61 // compiling this target. It will be empty if there are no input deps.
56 void WritePCHCommands(const SourceFileTypeSet& used_types, 62 void WritePCHCommands(const SourceFileTypeSet& used_types,
57 const OutputFile& input_dep, 63 const OutputFile& input_dep,
64 const OutputFile& order_only_dep,
58 std::vector<OutputFile>* object_files, 65 std::vector<OutputFile>* object_files,
59 std::vector<OutputFile>* other_files); 66 std::vector<OutputFile>* other_files);
60 67
61 // Writes a .pch compile build line for a language type. 68 // Writes a .pch compile build line for a language type.
62 void WritePCHCommand(SubstitutionType flag_type, 69 void WritePCHCommand(SubstitutionType flag_type,
63 Toolchain::ToolType tool_type, 70 Toolchain::ToolType tool_type,
64 Tool::PrecompiledHeaderType header_type, 71 Tool::PrecompiledHeaderType header_type,
65 const OutputFile& input_dep, 72 const OutputFile& input_dep,
73 const OutputFile& order_only_dep,
66 std::vector<OutputFile>* object_files, 74 std::vector<OutputFile>* object_files,
67 std::vector<OutputFile>* other_files); 75 std::vector<OutputFile>* other_files);
68 76
69 void WriteGCCPCHCommand(SubstitutionType flag_type, 77 void WriteGCCPCHCommand(SubstitutionType flag_type,
70 Toolchain::ToolType tool_type, 78 Toolchain::ToolType tool_type,
79 const OutputFile& input_dep,
71 const OutputFile& order_only_dep, 80 const OutputFile& order_only_dep,
72 std::vector<OutputFile>* gch_files); 81 std::vector<OutputFile>* gch_files);
73 82
74 void WriteWindowsPCHCommand(SubstitutionType flag_type, 83 void WriteWindowsPCHCommand(SubstitutionType flag_type,
75 Toolchain::ToolType tool_type, 84 Toolchain::ToolType tool_type,
85 const OutputFile& input_dep,
76 const OutputFile& order_only_dep, 86 const OutputFile& order_only_dep,
77 std::vector<OutputFile>* object_files); 87 std::vector<OutputFile>* object_files);
78 88
79 // pch_deps are additional dependencies to run before the rule. They are 89 // pch_deps are additional dependencies to run before the rule. They are
80 // expected to abide by the naming conventions specified by GetPCHOutputFiles. 90 // expected to abide by the naming conventions specified by GetPCHOutputFiles.
81 // 91 //
82 // order_only_dep is the name of the stamp file that covers the dependencies 92 // order_only_dep is the name of the stamp file that covers the dependencies
83 // that must be run before doing any compiles. 93 // that must be run before doing any compiles.
84 // 94 //
85 // The files produced by the compiler will be added to two output vectors. 95 // The files produced by the compiler will be added to two output vectors.
86 void WriteSources(const std::vector<OutputFile>& pch_deps, 96 void WriteSources(const std::vector<OutputFile>& pch_deps,
97 const OutputFile& input_dep,
87 const OutputFile& order_only_dep, 98 const OutputFile& order_only_dep,
88 std::vector<OutputFile>* object_files, 99 std::vector<OutputFile>* object_files,
89 std::vector<SourceFile>* other_files); 100 std::vector<SourceFile>* other_files);
90 101
91 // Writes a build line. 102 // Writes a build line.
92 void WriteCompilerBuildLine(const SourceFile& source, 103 void WriteCompilerBuildLine(const SourceFile& source,
93 const std::vector<OutputFile>& extra_deps, 104 const std::vector<OutputFile>& extra_deps,
94 const OutputFile& order_only_dep, 105 const OutputFile& order_only_dep,
95 Toolchain::ToolType tool_type, 106 Toolchain::ToolType tool_type,
96 const std::vector<OutputFile>& outputs); 107 const std::vector<OutputFile>& outputs);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const Tool* tool_; 150 const Tool* tool_;
140 151
141 // Cached version of the prefix used for rule types for this toolchain. 152 // Cached version of the prefix used for rule types for this toolchain.
142 std::string rule_prefix_; 153 std::string rule_prefix_;
143 154
144 DISALLOW_COPY_AND_ASSIGN(NinjaBinaryTargetWriter); 155 DISALLOW_COPY_AND_ASSIGN(NinjaBinaryTargetWriter);
145 }; 156 };
146 157
147 #endif // TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ 158 #endif // TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_
148 159
OLDNEW
« no previous file with comments | « tools/gn/docs/reference.md ('k') | tools/gn/ninja_binary_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698