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