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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "tools/gn/action_values.h" | 16 #include "tools/gn/action_values.h" |
17 #include "tools/gn/config_values.h" | 17 #include "tools/gn/config_values.h" |
| 18 #include "tools/gn/inherited_libraries.h" |
18 #include "tools/gn/item.h" | 19 #include "tools/gn/item.h" |
19 #include "tools/gn/label_ptr.h" | 20 #include "tools/gn/label_ptr.h" |
20 #include "tools/gn/ordered_set.h" | 21 #include "tools/gn/ordered_set.h" |
21 #include "tools/gn/output_file.h" | 22 #include "tools/gn/output_file.h" |
22 #include "tools/gn/source_file.h" | 23 #include "tools/gn/source_file.h" |
23 #include "tools/gn/unique_vector.h" | 24 #include "tools/gn/unique_vector.h" |
24 | 25 |
25 class DepsIteratorRange; | 26 class DepsIteratorRange; |
26 class InputFile; | 27 class InputFile; |
27 class Settings; | 28 class Settings; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 183 } |
183 | 184 |
184 // Dependencies that can include files from this target. | 185 // Dependencies that can include files from this target. |
185 const std::set<Label>& allow_circular_includes_from() const { | 186 const std::set<Label>& allow_circular_includes_from() const { |
186 return allow_circular_includes_from_; | 187 return allow_circular_includes_from_; |
187 } | 188 } |
188 std::set<Label>& allow_circular_includes_from() { | 189 std::set<Label>& allow_circular_includes_from() { |
189 return allow_circular_includes_from_; | 190 return allow_circular_includes_from_; |
190 } | 191 } |
191 | 192 |
192 const UniqueVector<const Target*>& inherited_libraries() const { | 193 const InheritedLibraries& inherited_libraries() const { |
193 return inherited_libraries_; | 194 return inherited_libraries_; |
194 } | 195 } |
195 | 196 |
196 // This config represents the configuration set directly on this target. | 197 // This config represents the configuration set directly on this target. |
197 ConfigValues& config_values() { return config_values_; } | 198 ConfigValues& config_values() { return config_values_; } |
198 const ConfigValues& config_values() const { return config_values_; } | 199 const ConfigValues& config_values() const { return config_values_; } |
199 | 200 |
200 ActionValues& action_values() { return action_values_; } | 201 ActionValues& action_values() { return action_values_; } |
201 const ActionValues& action_values() const { return action_values_; } | 202 const ActionValues& action_values() const { return action_values_; } |
202 | 203 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 const OutputFile& link_output_file() const { | 235 const OutputFile& link_output_file() const { |
235 return link_output_file_; | 236 return link_output_file_; |
236 } | 237 } |
237 const OutputFile& dependency_output_file() const { | 238 const OutputFile& dependency_output_file() const { |
238 return dependency_output_file_; | 239 return dependency_output_file_; |
239 } | 240 } |
240 | 241 |
241 private: | 242 private: |
242 // Pulls necessary information from dependencies to this one when all | 243 // Pulls necessary information from dependencies to this one when all |
243 // dependencies have been resolved. | 244 // dependencies have been resolved. |
244 void PullDependentTargetInfo(); | 245 void PullDependentTarget(const Target* dep, bool is_public); |
| 246 void PullDependentTargets(); |
245 | 247 |
246 // These each pull specific things from dependencies to this one when all | 248 // These each pull specific things from dependencies to this one when all |
247 // deps have been resolved. | 249 // deps have been resolved. |
248 void PullForwardedDependentConfigs(); | 250 void PullForwardedDependentConfigs(); |
249 void PullForwardedDependentConfigsFrom(const Target* from); | 251 void PullForwardedDependentConfigsFrom(const Target* from); |
250 void PullRecursiveHardDeps(); | 252 void PullRecursiveHardDeps(); |
251 | 253 |
252 // Fills the link and dependency output files when a target is resolved. | 254 // Fills the link and dependency output files when a target is resolved. |
253 void FillOutputFiles(); | 255 void FillOutputFiles(); |
254 | 256 |
(...skipping 19 matching lines...) Expand all Loading... |
274 LabelTargetVector public_deps_; | 276 LabelTargetVector public_deps_; |
275 LabelTargetVector data_deps_; | 277 LabelTargetVector data_deps_; |
276 | 278 |
277 UniqueVector<LabelConfigPair> configs_; | 279 UniqueVector<LabelConfigPair> configs_; |
278 UniqueVector<LabelConfigPair> all_dependent_configs_; | 280 UniqueVector<LabelConfigPair> all_dependent_configs_; |
279 UniqueVector<LabelConfigPair> public_configs_; | 281 UniqueVector<LabelConfigPair> public_configs_; |
280 UniqueVector<LabelTargetPair> forward_dependent_configs_; | 282 UniqueVector<LabelTargetPair> forward_dependent_configs_; |
281 | 283 |
282 std::set<Label> allow_circular_includes_from_; | 284 std::set<Label> allow_circular_includes_from_; |
283 | 285 |
284 // Static libraries and source sets from transitive deps. These things need | 286 // Static libraries, shared libraries, and source sets from transitive deps |
285 // to be linked only with the end target (executable, shared library). Source | 287 // that need to be linked. |
286 // sets do not get pushed beyond static library boundaries, and neither | 288 InheritedLibraries inherited_libraries_; |
287 // source sets nor static libraries get pushed beyond sahred library | |
288 // boundaries. | |
289 UniqueVector<const Target*> inherited_libraries_; | |
290 | 289 |
291 // These libs and dirs are inherited from statically linked deps and all | 290 // These libs and dirs are inherited from statically linked deps and all |
292 // configs applying to this target. | 291 // configs applying to this target. |
293 OrderedSet<SourceDir> all_lib_dirs_; | 292 OrderedSet<SourceDir> all_lib_dirs_; |
294 OrderedSet<std::string> all_libs_; | 293 OrderedSet<std::string> all_libs_; |
295 | 294 |
296 // All hard deps from this target and all dependencies. Filled in when this | 295 // All hard deps from this target and all dependencies. Filled in when this |
297 // target is marked resolved. This will not include the current target. | 296 // target is marked resolved. This will not include the current target. |
298 std::set<const Target*> recursive_hard_deps_; | 297 std::set<const Target*> recursive_hard_deps_; |
299 | 298 |
300 ConfigValues config_values_; // Used for all binary targets. | 299 ConfigValues config_values_; // Used for all binary targets. |
301 ActionValues action_values_; // Used for action[_foreach] targets. | 300 ActionValues action_values_; // Used for action[_foreach] targets. |
302 | 301 |
303 // Toolchain used by this target. Null until target is resolved. | 302 // Toolchain used by this target. Null until target is resolved. |
304 const Toolchain* toolchain_; | 303 const Toolchain* toolchain_; |
305 | 304 |
306 // Output files. Null until the target is resolved. | 305 // Output files. Null until the target is resolved. |
307 OutputFile link_output_file_; | 306 OutputFile link_output_file_; |
308 OutputFile dependency_output_file_; | 307 OutputFile dependency_output_file_; |
309 | 308 |
310 DISALLOW_COPY_AND_ASSIGN(Target); | 309 DISALLOW_COPY_AND_ASSIGN(Target); |
311 }; | 310 }; |
312 | 311 |
313 #endif // TOOLS_GN_TARGET_H_ | 312 #endif // TOOLS_GN_TARGET_H_ |
OLD | NEW |