| 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 23 matching lines...) Expand all Loading... |
| 34 public: | 34 public: |
| 35 enum OutputType { | 35 enum OutputType { |
| 36 UNKNOWN, | 36 UNKNOWN, |
| 37 GROUP, | 37 GROUP, |
| 38 EXECUTABLE, | 38 EXECUTABLE, |
| 39 SHARED_LIBRARY, | 39 SHARED_LIBRARY, |
| 40 LOADABLE_MODULE, | 40 LOADABLE_MODULE, |
| 41 STATIC_LIBRARY, | 41 STATIC_LIBRARY, |
| 42 SOURCE_SET, | 42 SOURCE_SET, |
| 43 COPY_FILES, | 43 COPY_FILES, |
| 44 COPY_BUNDLE_DATA, |
| 44 ACTION, | 45 ACTION, |
| 45 ACTION_FOREACH, | 46 ACTION_FOREACH, |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 enum DepsIterationType { | 49 enum DepsIterationType { |
| 49 DEPS_ALL, // Iterates through all public, private, and data deps. | 50 DEPS_ALL, // Iterates through all public, private, and data deps. |
| 50 DEPS_LINKED, // Iterates through all non-data dependencies. | 51 DEPS_LINKED, // Iterates through all non-data dependencies. |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 typedef std::vector<SourceFile> FileList; | 54 typedef std::vector<SourceFile> FileList; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // Compile-time extra dependencies. | 128 // Compile-time extra dependencies. |
| 128 const FileList& inputs() const { return inputs_; } | 129 const FileList& inputs() const { return inputs_; } |
| 129 FileList& inputs() { return inputs_; } | 130 FileList& inputs() { return inputs_; } |
| 130 | 131 |
| 131 // Runtime dependencies. These are "file-like things" that can either be | 132 // Runtime dependencies. These are "file-like things" that can either be |
| 132 // directories or files. They do not need to exist, these are just passed as | 133 // directories or files. They do not need to exist, these are just passed as |
| 133 // runtime dependencies to external test systems as necessary. | 134 // runtime dependencies to external test systems as necessary. |
| 134 const std::vector<std::string>& data() const { return data_; } | 135 const std::vector<std::string>& data() const { return data_; } |
| 135 std::vector<std::string>& data() { return data_; } | 136 std::vector<std::string>& data() { return data_; } |
| 136 | 137 |
| 138 // Runtime file dependency for bundled application (Mac/iOS). Those files |
| 139 // are collected recursively (breaking at executable, shared library and |
| 140 // loadable modules). |
| 141 const std::set<SourceFile>& bundle_data() const { return bundle_data_; } |
| 142 std::set<SourceFile>& bundle_data() { return bundle_data_; } |
| 143 |
| 137 // Returns true if targets depending on this one should have an order | 144 // Returns true if targets depending on this one should have an order |
| 138 // dependency. | 145 // dependency. |
| 139 bool hard_dep() const { | 146 bool hard_dep() const { |
| 140 return output_type_ == ACTION || | 147 return output_type_ == ACTION || |
| 141 output_type_ == ACTION_FOREACH || | 148 output_type_ == ACTION_FOREACH || |
| 142 output_type_ == COPY_FILES; | 149 output_type_ == COPY_FILES; |
| 143 } | 150 } |
| 144 | 151 |
| 145 // Returns the iterator range which can be used in range-based for loops | 152 // Returns the iterator range which can be used in range-based for loops |
| 146 // to iterate over multiple types of deps in one loop: | 153 // to iterate over multiple types of deps in one loop: |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 private: | 272 private: |
| 266 FRIEND_TEST_ALL_PREFIXES(Target, ResolvePrecompiledHeaders); | 273 FRIEND_TEST_ALL_PREFIXES(Target, ResolvePrecompiledHeaders); |
| 267 | 274 |
| 268 // Pulls necessary information from dependencies to this one when all | 275 // Pulls necessary information from dependencies to this one when all |
| 269 // dependencies have been resolved. | 276 // dependencies have been resolved. |
| 270 void PullDependentTargetConfigsFrom(const Target* dep); | 277 void PullDependentTargetConfigsFrom(const Target* dep); |
| 271 void PullDependentTargetConfigs(); | 278 void PullDependentTargetConfigs(); |
| 272 void PullDependentTargetLibsFrom(const Target* dep, bool is_public); | 279 void PullDependentTargetLibsFrom(const Target* dep, bool is_public); |
| 273 void PullDependentTargetLibs(); | 280 void PullDependentTargetLibs(); |
| 274 void PullRecursiveHardDeps(); | 281 void PullRecursiveHardDeps(); |
| 282 void PullRecursiveBundleData(); |
| 275 | 283 |
| 276 // Fills the link and dependency output files when a target is resolved. | 284 // Fills the link and dependency output files when a target is resolved. |
| 277 void FillOutputFiles(); | 285 void FillOutputFiles(); |
| 278 | 286 |
| 279 // Checks precompiled headers from configs and makes sure the resulting | 287 // Checks precompiled headers from configs and makes sure the resulting |
| 280 // values are in config_values_. | 288 // values are in config_values_. |
| 281 bool ResolvePrecompiledHeaders(Err* err); | 289 bool ResolvePrecompiledHeaders(Err* err); |
| 282 | 290 |
| 283 // Validates the given thing when a target is resolved. | 291 // Validates the given thing when a target is resolved. |
| 284 bool CheckVisibility(Err* err) const; | 292 bool CheckVisibility(Err* err) const; |
| 285 bool CheckTestonly(Err* err) const; | 293 bool CheckTestonly(Err* err) const; |
| 286 bool CheckNoNestedStaticLibs(Err* err) const; | 294 bool CheckNoNestedStaticLibs(Err* err) const; |
| 287 void CheckSourcesGenerated() const; | 295 void CheckSourcesGenerated() const; |
| 288 void CheckSourceGenerated(const SourceFile& source) const; | 296 void CheckSourceGenerated(const SourceFile& source) const; |
| 289 | 297 |
| 290 OutputType output_type_; | 298 OutputType output_type_; |
| 291 std::string output_name_; | 299 std::string output_name_; |
| 292 std::string output_extension_; | 300 std::string output_extension_; |
| 293 | 301 |
| 294 FileList sources_; | 302 FileList sources_; |
| 295 bool all_headers_public_; | 303 bool all_headers_public_; |
| 296 FileList public_headers_; | 304 FileList public_headers_; |
| 297 bool check_includes_; | 305 bool check_includes_; |
| 298 bool complete_static_lib_; | 306 bool complete_static_lib_; |
| 299 bool testonly_; | 307 bool testonly_; |
| 300 FileList inputs_; | 308 FileList inputs_; |
| 309 std::set<SourceFile> bundle_data_; |
| 301 std::vector<std::string> data_; | 310 std::vector<std::string> data_; |
| 302 | 311 |
| 303 LabelTargetVector private_deps_; | 312 LabelTargetVector private_deps_; |
| 304 LabelTargetVector public_deps_; | 313 LabelTargetVector public_deps_; |
| 305 LabelTargetVector data_deps_; | 314 LabelTargetVector data_deps_; |
| 306 | 315 |
| 307 // See getters for more info. | 316 // See getters for more info. |
| 308 UniqueVector<LabelConfigPair> configs_; | 317 UniqueVector<LabelConfigPair> configs_; |
| 309 UniqueVector<LabelConfigPair> all_dependent_configs_; | 318 UniqueVector<LabelConfigPair> all_dependent_configs_; |
| 310 UniqueVector<LabelConfigPair> public_configs_; | 319 UniqueVector<LabelConfigPair> public_configs_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 337 | 346 |
| 338 // Output files. Empty until the target is resolved. | 347 // Output files. Empty until the target is resolved. |
| 339 std::vector<OutputFile> computed_outputs_; | 348 std::vector<OutputFile> computed_outputs_; |
| 340 OutputFile link_output_file_; | 349 OutputFile link_output_file_; |
| 341 OutputFile dependency_output_file_; | 350 OutputFile dependency_output_file_; |
| 342 | 351 |
| 343 DISALLOW_COPY_AND_ASSIGN(Target); | 352 DISALLOW_COPY_AND_ASSIGN(Target); |
| 344 }; | 353 }; |
| 345 | 354 |
| 346 #endif // TOOLS_GN_TARGET_H_ | 355 #endif // TOOLS_GN_TARGET_H_ |
| OLD | NEW |