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_TARGET_H_ | 5 #ifndef TOOLS_GN_TARGET_H_ |
6 #define TOOLS_GN_TARGET_H_ | 6 #define TOOLS_GN_TARGET_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // dependencies are known). They will be null until then. Generally, this can | 212 // dependencies are known). They will be null until then. Generally, this can |
213 // only be used during target writing. | 213 // only be used during target writing. |
214 const Toolchain* toolchain() const { return toolchain_; } | 214 const Toolchain* toolchain() const { return toolchain_; } |
215 | 215 |
216 // Sets the toolchain. The toolchain must include a tool for this target | 216 // Sets the toolchain. The toolchain must include a tool for this target |
217 // or the error will be set and the function will return false. Unusually, | 217 // or the error will be set and the function will return false. Unusually, |
218 // this function's "err" output is optional since this is commonly used | 218 // this function's "err" output is optional since this is commonly used |
219 // frequently by unit tests which become needlessly verbose. | 219 // frequently by unit tests which become needlessly verbose. |
220 bool SetToolchain(const Toolchain* toolchain, Err* err = nullptr); | 220 bool SetToolchain(const Toolchain* toolchain, Err* err = nullptr); |
221 | 221 |
| 222 // Once this target has been resolved, all outputs from the target will be |
| 223 // listed here. This will include things listed in the "outputs" for an |
| 224 // action or a copy step, and the output library or executable file(s) from |
| 225 // binary targets. |
| 226 // |
| 227 // It will NOT include stamp files and object files. |
| 228 const std::vector<OutputFile>& computed_outputs() const { |
| 229 return computed_outputs_; |
| 230 } |
| 231 |
222 // Returns outputs from this target. The link output file is the one that | 232 // Returns outputs from this target. The link output file is the one that |
223 // other targets link to when they depend on this target. This will only be | 233 // other targets link to when they depend on this target. This will only be |
224 // valid for libraries and will be empty for all other target types. | 234 // valid for libraries and will be empty for all other target types. |
225 // | 235 // |
226 // The dependency output file is the file that should be used to express | 236 // The dependency output file is the file that should be used to express |
227 // a dependency on this one. It could be the same as the link output file | 237 // a dependency on this one. It could be the same as the link output file |
228 // (this will be the case for static libraries). For shared libraries it | 238 // (this will be the case for static libraries). For shared libraries it |
229 // could be the same or different than the link output file, depending on the | 239 // could be the same or different than the link output file, depending on the |
230 // system. For actions this will be the stamp file. | 240 // system. For actions this will be the stamp file. |
231 // | 241 // |
(...skipping 19 matching lines...) Expand all Loading... |
251 void PullForwardedDependentConfigsFrom(const Target* from); | 261 void PullForwardedDependentConfigsFrom(const Target* from); |
252 void PullRecursiveHardDeps(); | 262 void PullRecursiveHardDeps(); |
253 | 263 |
254 // Fills the link and dependency output files when a target is resolved. | 264 // Fills the link and dependency output files when a target is resolved. |
255 void FillOutputFiles(); | 265 void FillOutputFiles(); |
256 | 266 |
257 // Validates the given thing when a target is resolved. | 267 // Validates the given thing when a target is resolved. |
258 bool CheckVisibility(Err* err) const; | 268 bool CheckVisibility(Err* err) const; |
259 bool CheckTestonly(Err* err) const; | 269 bool CheckTestonly(Err* err) const; |
260 bool CheckNoNestedStaticLibs(Err* err) const; | 270 bool CheckNoNestedStaticLibs(Err* err) const; |
| 271 void CheckSourcesGenerated() const; |
| 272 void CheckSourceGenerated(const SourceFile& source) const; |
261 | 273 |
262 OutputType output_type_; | 274 OutputType output_type_; |
263 std::string output_name_; | 275 std::string output_name_; |
264 std::string output_extension_; | 276 std::string output_extension_; |
265 | 277 |
266 FileList sources_; | 278 FileList sources_; |
267 bool all_headers_public_; | 279 bool all_headers_public_; |
268 FileList public_headers_; | 280 FileList public_headers_; |
269 bool check_includes_; | 281 bool check_includes_; |
270 bool complete_static_lib_; | 282 bool complete_static_lib_; |
(...skipping 24 matching lines...) Expand all Loading... |
295 // All hard deps from this target and all dependencies. Filled in when this | 307 // All hard deps from this target and all dependencies. Filled in when this |
296 // target is marked resolved. This will not include the current target. | 308 // target is marked resolved. This will not include the current target. |
297 std::set<const Target*> recursive_hard_deps_; | 309 std::set<const Target*> recursive_hard_deps_; |
298 | 310 |
299 ConfigValues config_values_; // Used for all binary targets. | 311 ConfigValues config_values_; // Used for all binary targets. |
300 ActionValues action_values_; // Used for action[_foreach] targets. | 312 ActionValues action_values_; // Used for action[_foreach] targets. |
301 | 313 |
302 // Toolchain used by this target. Null until target is resolved. | 314 // Toolchain used by this target. Null until target is resolved. |
303 const Toolchain* toolchain_; | 315 const Toolchain* toolchain_; |
304 | 316 |
305 // Output files. Null until the target is resolved. | 317 // Output files. Empty until the target is resolved. |
| 318 std::vector<OutputFile> computed_outputs_; |
306 OutputFile link_output_file_; | 319 OutputFile link_output_file_; |
307 OutputFile dependency_output_file_; | 320 OutputFile dependency_output_file_; |
308 | 321 |
309 DISALLOW_COPY_AND_ASSIGN(Target); | 322 DISALLOW_COPY_AND_ASSIGN(Target); |
310 }; | 323 }; |
311 | 324 |
312 #endif // TOOLS_GN_TARGET_H_ | 325 #endif // TOOLS_GN_TARGET_H_ |
OLD | NEW |