| 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 22 matching lines...) Expand all Loading... |
| 33 public: | 33 public: |
| 34 enum OutputType { | 34 enum OutputType { |
| 35 UNKNOWN, | 35 UNKNOWN, |
| 36 GROUP, | 36 GROUP, |
| 37 EXECUTABLE, | 37 EXECUTABLE, |
| 38 SHARED_LIBRARY, | 38 SHARED_LIBRARY, |
| 39 LOADABLE_MODULE, | 39 LOADABLE_MODULE, |
| 40 STATIC_LIBRARY, | 40 STATIC_LIBRARY, |
| 41 SOURCE_SET, | 41 SOURCE_SET, |
| 42 COPY_FILES, | 42 COPY_FILES, |
| 43 COPY_BUNDLE_DATA, |
| 43 ACTION, | 44 ACTION, |
| 44 ACTION_FOREACH, | 45 ACTION_FOREACH, |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 enum DepsIterationType { | 48 enum DepsIterationType { |
| 48 DEPS_ALL, // Iterates through all public, private, and data deps. | 49 DEPS_ALL, // Iterates through all public, private, and data deps. |
| 49 DEPS_LINKED, // Iterates through all non-data dependencies. | 50 DEPS_LINKED, // Iterates through all non-data dependencies. |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 typedef std::vector<SourceFile> FileList; | 53 typedef std::vector<SourceFile> FileList; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // Compile-time extra dependencies. | 123 // Compile-time extra dependencies. |
| 123 const FileList& inputs() const { return inputs_; } | 124 const FileList& inputs() const { return inputs_; } |
| 124 FileList& inputs() { return inputs_; } | 125 FileList& inputs() { return inputs_; } |
| 125 | 126 |
| 126 // Runtime dependencies. These are "file-like things" that can either be | 127 // Runtime dependencies. These are "file-like things" that can either be |
| 127 // directories or files. They do not need to exist, these are just passed as | 128 // directories or files. They do not need to exist, these are just passed as |
| 128 // runtime dependencies to external test systems as necessary. | 129 // runtime dependencies to external test systems as necessary. |
| 129 const std::vector<std::string>& data() const { return data_; } | 130 const std::vector<std::string>& data() const { return data_; } |
| 130 std::vector<std::string>& data() { return data_; } | 131 std::vector<std::string>& data() { return data_; } |
| 131 | 132 |
| 133 // Runtime file dependency for bundled application (Mac/iOS). Those files |
| 134 // are collected recursively (breaking at executable, shared library and |
| 135 // loadable modules). |
| 136 const std::set<SourceFile>& bundle_data() const { return bundle_data_; } |
| 137 std::set<SourceFile>& bundle_data() { return bundle_data_; } |
| 138 |
| 132 // Returns true if targets depending on this one should have an order | 139 // Returns true if targets depending on this one should have an order |
| 133 // dependency. | 140 // dependency. |
| 134 bool hard_dep() const { | 141 bool hard_dep() const { |
| 135 return output_type_ == ACTION || | 142 return output_type_ == ACTION || |
| 136 output_type_ == ACTION_FOREACH || | 143 output_type_ == ACTION_FOREACH || |
| 137 output_type_ == COPY_FILES; | 144 output_type_ == COPY_FILES; |
| 138 } | 145 } |
| 139 | 146 |
| 140 // Returns the iterator range which can be used in range-based for loops | 147 // Returns the iterator range which can be used in range-based for loops |
| 141 // to iterate over multiple types of deps in one loop: | 148 // to iterate over multiple types of deps in one loop: |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 private: | 255 private: |
| 249 FRIEND_TEST_ALL_PREFIXES(Target, ResolvePrecompiledHeaders); | 256 FRIEND_TEST_ALL_PREFIXES(Target, ResolvePrecompiledHeaders); |
| 250 | 257 |
| 251 // Pulls necessary information from dependencies to this one when all | 258 // Pulls necessary information from dependencies to this one when all |
| 252 // dependencies have been resolved. | 259 // dependencies have been resolved. |
| 253 void PullDependentTargetConfigsFrom(const Target* dep); | 260 void PullDependentTargetConfigsFrom(const Target* dep); |
| 254 void PullDependentTargetConfigs(); | 261 void PullDependentTargetConfigs(); |
| 255 void PullDependentTargetLibsFrom(const Target* dep, bool is_public); | 262 void PullDependentTargetLibsFrom(const Target* dep, bool is_public); |
| 256 void PullDependentTargetLibs(); | 263 void PullDependentTargetLibs(); |
| 257 void PullRecursiveHardDeps(); | 264 void PullRecursiveHardDeps(); |
| 265 void PullRecursiveBundleData(); |
| 258 | 266 |
| 259 // Fills the link and dependency output files when a target is resolved. | 267 // Fills the link and dependency output files when a target is resolved. |
| 260 void FillOutputFiles(); | 268 void FillOutputFiles(); |
| 261 | 269 |
| 262 // Checks precompiled headers from configs and makes sure the resulting | 270 // Checks precompiled headers from configs and makes sure the resulting |
| 263 // values are in config_values_. | 271 // values are in config_values_. |
| 264 bool ResolvePrecompiledHeaders(Err* err); | 272 bool ResolvePrecompiledHeaders(Err* err); |
| 265 | 273 |
| 266 // Validates the given thing when a target is resolved. | 274 // Validates the given thing when a target is resolved. |
| 267 bool CheckVisibility(Err* err) const; | 275 bool CheckVisibility(Err* err) const; |
| 268 bool CheckTestonly(Err* err) const; | 276 bool CheckTestonly(Err* err) const; |
| 269 bool CheckNoNestedStaticLibs(Err* err) const; | 277 bool CheckNoNestedStaticLibs(Err* err) const; |
| 270 void CheckSourcesGenerated() const; | 278 void CheckSourcesGenerated() const; |
| 271 void CheckSourceGenerated(const SourceFile& source) const; | 279 void CheckSourceGenerated(const SourceFile& source) const; |
| 272 | 280 |
| 273 OutputType output_type_; | 281 OutputType output_type_; |
| 274 std::string output_name_; | 282 std::string output_name_; |
| 275 std::string output_extension_; | 283 std::string output_extension_; |
| 276 | 284 |
| 277 FileList sources_; | 285 FileList sources_; |
| 278 bool all_headers_public_; | 286 bool all_headers_public_; |
| 279 FileList public_headers_; | 287 FileList public_headers_; |
| 280 bool check_includes_; | 288 bool check_includes_; |
| 281 bool complete_static_lib_; | 289 bool complete_static_lib_; |
| 282 bool testonly_; | 290 bool testonly_; |
| 283 FileList inputs_; | 291 FileList inputs_; |
| 292 std::set<SourceFile> bundle_data_; |
| 284 std::vector<std::string> data_; | 293 std::vector<std::string> data_; |
| 285 | 294 |
| 286 LabelTargetVector private_deps_; | 295 LabelTargetVector private_deps_; |
| 287 LabelTargetVector public_deps_; | 296 LabelTargetVector public_deps_; |
| 288 LabelTargetVector data_deps_; | 297 LabelTargetVector data_deps_; |
| 289 | 298 |
| 290 // See getters for more info. | 299 // See getters for more info. |
| 291 UniqueVector<LabelConfigPair> configs_; | 300 UniqueVector<LabelConfigPair> configs_; |
| 292 UniqueVector<LabelConfigPair> all_dependent_configs_; | 301 UniqueVector<LabelConfigPair> all_dependent_configs_; |
| 293 UniqueVector<LabelConfigPair> public_configs_; | 302 UniqueVector<LabelConfigPair> public_configs_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 320 | 329 |
| 321 // Output files. Empty until the target is resolved. | 330 // Output files. Empty until the target is resolved. |
| 322 std::vector<OutputFile> computed_outputs_; | 331 std::vector<OutputFile> computed_outputs_; |
| 323 OutputFile link_output_file_; | 332 OutputFile link_output_file_; |
| 324 OutputFile dependency_output_file_; | 333 OutputFile dependency_output_file_; |
| 325 | 334 |
| 326 DISALLOW_COPY_AND_ASSIGN(Target); | 335 DISALLOW_COPY_AND_ASSIGN(Target); |
| 327 }; | 336 }; |
| 328 | 337 |
| 329 #endif // TOOLS_GN_TARGET_H_ | 338 #endif // TOOLS_GN_TARGET_H_ |
| OLD | NEW |