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 3 // found in the LICENSE file. 4 5 #ifndef TOOLS_GN_TARGET_H_ 6 #define TOOLS_GN_TARGET_H_ 7 8 #include <set> 9 #include <string> 10 #include <vector> 11 12 #include "base/gtest_prod_util.h" 13 #include "base/logging.h" 14 #include "gn/action_values.h" 15 #include "gn/bundle_data.h" 16 #include "gn/config_values.h" 17 #include "gn/inherited_libraries.h" 18 #include "gn/item.h" 19 #include "gn/label_pattern.h" 20 #include "gn/label_ptr.h" 21 #include "gn/lib_file.h" 22 #include "gn/metadata.h" 23 #include "gn/output_file.h" 24 #include "gn/pointer_set.h" 25 #include "gn/rust_values.h" 26 #include "gn/source_file.h" 27 #include "gn/swift_values.h" 28 #include "gn/toolchain.h" 29 #include "gn/unique_vector.h" 30 31 class DepsIteratorRange; 32 class Settings; 33 class Target; 34 class Toolchain; 35 36 using TargetSet = PointerSet<const Target>; 37 38 class Target : public Item { 39 public: 40 enum OutputType { 41 UNKNOWN, 42 GROUP, 43 EXECUTABLE, 44 SHARED_LIBRARY, 45 LOADABLE_MODULE, 46 STATIC_LIBRARY, 47 SOURCE_SET, 48 COPY_FILES, 49 ACTION, 50 ACTION_FOREACH, 51 BUNDLE_DATA, 52 CREATE_BUNDLE, 53 GENERATED_FILE, 54 RUST_LIBRARY, 55 RUST_PROC_MACRO, 56 }; 57 58 enum DepsIterationType { 59 DEPS_ALL, // Iterates through all public, private, and data deps. 60 DEPS_LINKED, // Iterates through all non-data dependencies. 61 }; 62 63 using FileList = std::vector<SourceFile>; 64 using StringVector = std::vector<std::string>; 65 66 // We track the set of build files that may affect this target, please refer 67 // to Scope for how this is determined. 68 Target(const Settings* settings, 69 const Label& label, 70 const SourceFileSet& build_dependency_files = {}); 71 ~Target() override; 72 73 // Returns a string naming the output type. 74 static const char* GetStringForOutputType(OutputType type); 75 76 // Item overrides. 77 Target* AsTarget() override; 78 const Target* AsTarget() const override; 79 bool OnResolved(Err* err) override; 80 output_type()81 OutputType output_type() const { return output_type_; } set_output_type(OutputType t)82 void set_output_type(OutputType t) { output_type_ = t; } 83 84 // True for targets that compile source code (all types of libraries and 85 // executables). 86 bool IsBinary() const; 87 88 // Can be linked into other targets. 89 bool IsLinkable() const; 90 91 // True if the target links dependencies rather than propagated up the graph. 92 // This is also true of action and copy steps even though they don't link 93 // dependencies, because they also don't propagate libraries up. 94 bool IsFinal() const; 95 96 // Set when the target should normally be treated as a data dependency. These 97 // do not need to be treated as inputs or hard dependencies for normal build 98 // steps, but have to be kept in the dependency tree to be properly 99 // propagated. Treating these as data only decreases superfluous rebuilds and 100 // increases parallelism. 101 bool IsDataOnly() const; 102 103 // Return true if this target should be generated in the final build graph. 104 bool ShouldGenerate() const; 105 106 // Will be the empty string to use the target label as the output name. 107 // See GetComputedOutputName(). output_name()108 const std::string& output_name() const { return output_name_; } set_output_name(const std::string & name)109 void set_output_name(const std::string& name) { output_name_ = name; } 110 111 // Returns the output name for this target, which is the output_name if 112 // specified, or the target label if not. 113 // 114 // Because this depends on the tool for this target, the toolchain must 115 // have been set before calling. 116 std::string GetComputedOutputName() const; 117 output_prefix_override()118 bool output_prefix_override() const { return output_prefix_override_; } set_output_prefix_override(bool prefix_override)119 void set_output_prefix_override(bool prefix_override) { 120 output_prefix_override_ = prefix_override; 121 } 122 123 // Desired output directory for the final output. This will be used for 124 // the {{output_dir}} substitution in the tool if it is specified. If 125 // is_null, the tool default will be used. output_dir()126 const SourceDir& output_dir() const { return output_dir_; } set_output_dir(const SourceDir & dir)127 void set_output_dir(const SourceDir& dir) { output_dir_ = dir; } 128 129 // The output extension is really a tri-state: unset (output_extension_set 130 // is false and the string is empty, meaning the default extension should be 131 // used), the output extension is set but empty (output should have no 132 // extension) and the output extension is set but nonempty (use the given 133 // extension). output_extension()134 const std::string& output_extension() const { return output_extension_; } set_output_extension(const std::string & extension)135 void set_output_extension(const std::string& extension) { 136 output_extension_ = extension; 137 output_extension_set_ = true; 138 } output_extension_set()139 bool output_extension_set() const { return output_extension_set_; } 140 sources()141 const FileList& sources() const { return sources_; } sources()142 FileList& sources() { return sources_; } 143 include_dirs()144 const std::vector<SourceDir>& include_dirs() const { return include_dirs_; } include_dirs()145 std::vector<SourceDir>& include_dirs() { return include_dirs_; } 146 source_types_used()147 const SourceFileTypeSet& source_types_used() const { 148 return source_types_used_; 149 } source_types_used()150 SourceFileTypeSet& source_types_used() { return source_types_used_; } 151 152 // Set to true when all sources are public. This is the default. In this case 153 // the public headers list should be empty. all_headers_public()154 bool all_headers_public() const { return all_headers_public_; } set_all_headers_public(bool p)155 void set_all_headers_public(bool p) { all_headers_public_ = p; } 156 157 // When all_headers_public is false, this is the list of public headers. It 158 // could be empty which would mean no headers are public. public_headers()159 const FileList& public_headers() const { return public_headers_; } public_headers()160 FileList& public_headers() { return public_headers_; } 161 162 // Whether this target's includes should be checked by "gn check". check_includes()163 bool check_includes() const { return check_includes_; } set_check_includes(bool ci)164 void set_check_includes(bool ci) { check_includes_ = ci; } 165 166 // Whether this static_library target should have code linked in. complete_static_lib()167 bool complete_static_lib() const { return complete_static_lib_; } set_complete_static_lib(bool complete)168 void set_complete_static_lib(bool complete) { 169 DCHECK_EQ(STATIC_LIBRARY, output_type_); 170 complete_static_lib_ = complete; 171 } 172 173 // Whether this copy target is linkable. copy_linkable_file()174 bool copy_linkable_file() const { return copy_linkable_file_; } set_copy_linkable_file(bool linkable)175 void set_copy_linkable_file(bool linkable) 176 { 177 DCHECK_EQ(COPY_FILES, output_type_); 178 copy_linkable_file_ = linkable; 179 } copy_rust_file()180 bool copy_rust_file() const { 181 return copy_linkable_file_ && output_type_ == COPY_FILES && 182 has_rust_values(); 183 } 184 185 // Metadata. Target takes ownership of the resulting scope. 186 const Metadata& metadata() const; 187 Metadata& metadata(); has_metadata()188 bool has_metadata() const { return metadata_.get(); } 189 190 // Get metadata from this target and its dependencies. This is intended to 191 // be called after the target is resolved. 192 bool GetMetadata(const std::vector<std::string>& keys_to_extract, 193 const std::vector<std::string>& keys_to_walk, 194 const SourceDir& rebase_dir, 195 bool deps_only, 196 std::vector<Value>* result, 197 TargetSet* targets_walked, 198 Err* err) const; 199 200 // GeneratedFile-related methods. 201 bool GenerateFile(Err* err) const; 202 203 // Metadata collection methods for GeneratedFile targets. 204 struct GeneratedFile { 205 Value output_conversion_; 206 Value contents_; // Value::NONE if metadata collection should occur. 207 SourceDir rebase_; 208 std::vector<std::string> data_keys_; 209 std::vector<std::string> walk_keys_; 210 }; 211 const GeneratedFile& generated_file() const; 212 GeneratedFile& generated_file(); has_generated_file()213 bool has_generated_file() const { return generated_file_.get(); } 214 contents()215 const Value& contents() const { return generated_file().contents_; } set_contents(const Value & value)216 void set_contents(const Value& value) { generated_file().contents_ = value; } output_conversion()217 const Value& output_conversion() const { 218 return generated_file().output_conversion_; 219 } set_output_conversion(const Value & value)220 void set_output_conversion(const Value& value) { 221 generated_file().output_conversion_ = value; 222 } 223 rebase()224 const SourceDir& rebase() const { return generated_file().rebase_; } set_rebase(const SourceDir & value)225 void set_rebase(const SourceDir& value) { generated_file().rebase_ = value; } data_keys()226 const std::vector<std::string>& data_keys() const { 227 return generated_file().data_keys_; 228 } data_keys()229 std::vector<std::string>& data_keys() { return generated_file().data_keys_; } walk_keys()230 const std::vector<std::string>& walk_keys() const { 231 return generated_file().walk_keys_; 232 } walk_keys()233 std::vector<std::string>& walk_keys() { return generated_file().walk_keys_; } 234 write_runtime_deps_output()235 OutputFile write_runtime_deps_output() const { 236 return write_runtime_deps_output_; 237 } set_write_runtime_deps_output(const OutputFile & value)238 void set_write_runtime_deps_output(const OutputFile& value) { 239 write_runtime_deps_output_ = value; 240 } 241 242 // Runtime dependencies. These are "file-like things" that can either be 243 // directories or files. They do not need to exist, these are just passed as 244 // runtime dependencies to external test systems as necessary. data()245 const std::vector<std::string>& data() const { return data_; } data()246 std::vector<std::string>& data() { return data_; } 247 248 // Information about the bundle. Only valid for CREATE_BUNDLE target after 249 // they have been resolved. 250 const BundleData& bundle_data() const; 251 BundleData& bundle_data(); has_bundle_data()252 bool has_bundle_data() const { return bundle_data_.get(); } 253 254 // Returns true if targets depending on this one should have an order 255 // dependency. hard_dep()256 bool hard_dep() const { 257 return output_type_ == ACTION || output_type_ == ACTION_FOREACH || 258 output_type_ == COPY_FILES || output_type_ == CREATE_BUNDLE || 259 output_type_ == BUNDLE_DATA || output_type_ == GENERATED_FILE || 260 builds_swift_module(); 261 } 262 263 // Returns the iterator range which can be used in range-based for loops 264 // to iterate over multiple types of deps in one loop: 265 // for (const auto& pair : target->GetDeps(Target::DEPS_ALL)) ... 266 DepsIteratorRange GetDeps(DepsIterationType type) const; 267 268 // Linked private dependencies. private_deps()269 const LabelTargetVector& private_deps() const { return private_deps_; } private_deps()270 LabelTargetVector& private_deps() { return private_deps_; } 271 272 // Linked whole archive dependencies. whole_archive_deps()273 const LabelTargetVector& whole_archive_deps() const { return whole_archive_deps_; } whole_archive_deps()274 LabelTargetVector& whole_archive_deps() { return whole_archive_deps_; } 275 276 // Linked no whole archive dependencies. no_whole_archive_deps()277 const LabelTargetVector& no_whole_archive_deps() const { return no_whole_archive_deps_; } no_whole_archive_deps()278 LabelTargetVector& no_whole_archive_deps() { return no_whole_archive_deps_; } 279 280 // Linked public dependencies. public_deps()281 const LabelTargetVector& public_deps() const { return public_deps_; } public_deps()282 LabelTargetVector& public_deps() { return public_deps_; } 283 284 // Non-linked dependencies. data_deps()285 const LabelTargetVector& data_deps() const { return data_deps_; } data_deps()286 LabelTargetVector& data_deps() { return data_deps_; } 287 288 // gen_deps only propagate the "should_generate" flag. These dependencies can 289 // have cycles so care should be taken if iterating over them recursively. gen_deps()290 const LabelTargetVector& gen_deps() const { return gen_deps_; } gen_deps()291 LabelTargetVector& gen_deps() { return gen_deps_; } 292 293 // List of configs that this class inherits settings from. Once a target is 294 // resolved, this will also list all-dependent and public configs. configs()295 const UniqueVector<LabelConfigPair>& configs() const { return configs_; } configs()296 UniqueVector<LabelConfigPair>& configs() { return configs_; } 297 298 // List of direct configs that this target, excluding the indirect config passed by. own_configs()299 const UniqueVector<LabelConfigPair>& own_configs() const { return own_configs_; } own_configs()300 UniqueVector<LabelConfigPair>& own_configs() { return own_configs_; } 301 302 // List of configs that all dependencies (direct and indirect) of this 303 // target get. These configs are not added to this target. Note that due 304 // to the way this is computed, there may be duplicates in this list. all_dependent_configs()305 const UniqueVector<LabelConfigPair>& all_dependent_configs() const { 306 return all_dependent_configs_; 307 } all_dependent_configs()308 UniqueVector<LabelConfigPair>& all_dependent_configs() { 309 return all_dependent_configs_; 310 } 311 312 // List of direct all_dependent_configs that this target, excluding the indirect config passed by. own_all_dependent_configs()313 const UniqueVector<LabelConfigPair>& own_all_dependent_configs() const { 314 return own_all_dependent_configs_; 315 } own_all_dependent_configs()316 UniqueVector<LabelConfigPair>& own_all_dependent_configs() { 317 return own_all_dependent_configs_; 318 } 319 320 // List of configs that targets depending directly on this one get. These 321 // configs are also added to this target. public_configs()322 const UniqueVector<LabelConfigPair>& public_configs() const { 323 return public_configs_; 324 } public_configs()325 UniqueVector<LabelConfigPair>& public_configs() { return public_configs_; } 326 327 // List of direct public_configs that this target, excluding the indirect config passed by. own_public_configs()328 const UniqueVector<LabelConfigPair>& own_public_configs() const { 329 return own_public_configs_; 330 } own_public_configs()331 UniqueVector<LabelConfigPair>& own_public_configs() { return own_public_configs_; } 332 333 // Dependencies that can include files from this target. allow_circular_includes_from()334 const std::set<Label>& allow_circular_includes_from() const { 335 return allow_circular_includes_from_; 336 } allow_circular_includes_from()337 std::set<Label>& allow_circular_includes_from() { 338 return allow_circular_includes_from_; 339 } 340 inherited_libraries()341 const InheritedLibraries& inherited_libraries() const { 342 return inherited_libraries_; 343 } 344 345 // Pool option pool()346 const LabelPtrPair<Pool>& pool() const { return pool_; } set_pool(LabelPtrPair<Pool> pool)347 void set_pool(LabelPtrPair<Pool> pool) { pool_ = std::move(pool); } 348 349 // This config represents the configuration set directly on this target. 350 ConfigValues& config_values(); 351 const ConfigValues& config_values() const; has_config_values()352 bool has_config_values() const { return config_values_.get(); } 353 354 ActionValues& action_values(); 355 const ActionValues& action_values() const; has_action_values()356 bool has_action_values() const { return action_values_.get(); } 357 358 SwiftValues& swift_values(); 359 const SwiftValues& swift_values() const; has_swift_values()360 bool has_swift_values() const { return swift_values_.get(); } 361 362 // Return true if this targets builds a SwiftModule builds_swift_module()363 bool builds_swift_module() const { 364 return IsBinary() && has_swift_values() && 365 source_types_used().SwiftSourceUsed(); 366 } 367 368 RustValues& rust_values(); 369 const RustValues& rust_values() const; has_rust_values()370 bool has_rust_values() const { return rust_values_.get(); } 371 372 // Transitive closure of libraries that are depended on by this target rust_transitive_inherited_libs()373 const InheritedLibraries& rust_transitive_inherited_libs() const { 374 return rust_transitive_inherited_libs_; 375 } rust_transitive_inheritable_libs()376 const InheritedLibraries& rust_transitive_inheritable_libs() const { 377 return rust_transitive_inheritable_libs_; 378 } 379 all_lib_dirs()380 const UniqueVector<SourceDir>& all_lib_dirs() const { return all_lib_dirs_; } all_libs()381 const UniqueVector<LibFile>& all_libs() const { return all_libs_; } 382 all_framework_dirs()383 const UniqueVector<SourceDir>& all_framework_dirs() const { 384 return all_framework_dirs_; 385 } all_frameworks()386 const UniqueVector<std::string>& all_frameworks() const { 387 return all_frameworks_; 388 } all_weak_frameworks()389 const UniqueVector<std::string>& all_weak_frameworks() const { 390 return all_weak_frameworks_; 391 } 392 recursive_hard_deps()393 const TargetSet& recursive_hard_deps() const { return recursive_hard_deps_; } 394 friends()395 std::vector<LabelPattern>& friends() { return friends_; } friends()396 const std::vector<LabelPattern>& friends() const { return friends_; } 397 assert_no_deps()398 std::vector<LabelPattern>& assert_no_deps() { return assert_no_deps_; } assert_no_deps()399 const std::vector<LabelPattern>& assert_no_deps() const { 400 return assert_no_deps_; 401 } 402 403 // The toolchain is only known once this target is resolved (all if its 404 // dependencies are known). They will be null until then. Generally, this can 405 // only be used during target writing. toolchain()406 const Toolchain* toolchain() const { return toolchain_; } 407 408 // Sets the toolchain. The toolchain must include a tool for this target 409 // or the error will be set and the function will return false. Unusually, 410 // this function's "err" output is optional since this is commonly used 411 // frequently by unit tests which become needlessly verbose. 412 bool SetToolchain(const Toolchain* toolchain, Err* err = nullptr); 413 414 // Once this target has been resolved, all outputs from the target will be 415 // listed here. This will include things listed in the "outputs" for an 416 // action or a copy step, and the output library or executable file(s) from 417 // binary targets. 418 // 419 // It will NOT include stamp files and object files. computed_outputs()420 const std::vector<OutputFile>& computed_outputs() const { 421 return computed_outputs_; 422 } 423 424 // Returns outputs from this target. The link output file is the one that 425 // other targets link to when they depend on this target. This will only be 426 // valid for libraries and will be empty for all other target types. 427 // 428 // The dependency output file is the file that should be used to express 429 // a dependency on this one. It could be the same as the link output file 430 // (this will be the case for static libraries). For shared libraries it 431 // could be the same or different than the link output file, depending on the 432 // system. For actions this will be the stamp file. 433 // 434 // These are only known once the target is resolved and will be empty before 435 // that. This is a cache of the files to prevent every target that depends on 436 // a given library from recomputing the same pattern. link_output_file()437 const OutputFile& link_output_file() const { return link_output_file_; } dependency_output_file()438 const OutputFile& dependency_output_file() const { 439 return dependency_output_file_; 440 } 441 442 // The subset of computed_outputs that are considered runtime outputs. runtime_outputs()443 const std::vector<OutputFile>& runtime_outputs() const { 444 return runtime_outputs_; 445 } 446 447 // Computes and returns the outputs of this target expressed as SourceFiles. 448 // 449 // For binary target this depends on the tool for this target so the toolchain 450 // must have been loaded beforehand. This will happen asynchronously so 451 // calling this on a binary target before the build is complete will produce a 452 // race condition. 453 // 454 // To resolve this, the caller passes in whether the entire build is complete 455 // (this is used for the introspection commands which run after everything 456 // else). 457 // 458 // If the build is complete, the toolchain will be used for binary targets to 459 // compute the outputs. If the build is not complete, calling this function 460 // for binary targets will produce an error. 461 // 462 // The |loc_for_error| is used to blame a location for any errors produced. It 463 // can be empty if there is no range (like this is being called based on the 464 // command-line. 465 bool GetOutputsAsSourceFiles(const LocationRange& loc_for_error, 466 bool build_complete, 467 std::vector<SourceFile>* outputs, 468 Err* err) const; 469 470 // Computes the set of output files resulting from compiling the given source 471 // file. 472 // 473 // For binary targets, if the file can be compiled and the tool exists, fills 474 // the outputs in and writes the tool type to computed_tool_type. If the file 475 // is not compilable, returns false. 476 // 477 // For action_foreach and copy targets, applies the output pattern to the 478 // given file name to compute the outputs. 479 // 480 // For all other target types, just returns the target outputs because such 481 // targets conceptually process all of their inputs as one step. 482 // 483 // The function can succeed with a "NONE" tool type for object files which 484 // are just passed to the output. The output will always be overwritten, not 485 // appended to. 486 bool GetOutputFilesForSource(const SourceFile& source, 487 const char** computed_tool_type, 488 std::vector<OutputFile>* outputs) const; 489 490 private: 491 FRIEND_TEST_ALL_PREFIXES(TargetTest, ResolvePrecompiledHeaders); 492 493 // Pulls necessary information from dependencies to this one when all 494 // dependencies have been resolved. 495 void PullDependentTargetConfigs(); 496 void PullDependentTargetLibsFrom(const Target* dep, bool is_public); 497 void PullDependentTargetLibs(); 498 void PullRecursiveHardDeps(); 499 void PullRecursiveBundleData(); 500 501 // Fills the link and dependency output files when a target is resolved. 502 bool FillOutputFiles(Err* err); 503 504 // Checks precompiled headers from configs and makes sure the resulting 505 // values are in config_values_. 506 bool ResolvePrecompiledHeaders(Err* err); 507 508 // Validates the given thing when a target is resolved. 509 bool CheckVisibility(Err* err) const; 510 bool CheckConfigVisibility(Err* err) const; 511 bool CheckTestonly(Err* err) const; 512 bool CheckAssertNoDeps(Err* err) const; 513 void CheckSourcesGenerated() const; 514 void CheckSourceGenerated(const SourceFile& source) const; 515 bool CheckSourceSetLanguages(Err* err) const; 516 517 OutputType output_type_ = UNKNOWN; 518 std::string output_name_; 519 bool output_prefix_override_ = false; 520 SourceDir output_dir_; 521 std::string output_extension_; 522 bool output_extension_set_ = false; 523 524 FileList sources_; 525 std::vector<SourceDir> include_dirs_; 526 SourceFileTypeSet source_types_used_; 527 bool all_headers_public_ = true; 528 FileList public_headers_; 529 bool check_includes_ = true; 530 bool complete_static_lib_ = false; 531 bool copy_linkable_file_ = false; 532 std::vector<std::string> data_; 533 std::unique_ptr<BundleData> bundle_data_; 534 OutputFile write_runtime_deps_output_; 535 536 LabelTargetVector whole_archive_deps_; 537 LabelTargetVector no_whole_archive_deps_; 538 LabelTargetVector private_deps_; 539 LabelTargetVector public_deps_; 540 LabelTargetVector data_deps_; 541 LabelTargetVector gen_deps_; 542 543 // See getters for more info. 544 UniqueVector<LabelConfigPair> own_configs_; 545 UniqueVector<LabelConfigPair> own_all_dependent_configs_; 546 UniqueVector<LabelConfigPair> own_public_configs_; 547 548 UniqueVector<LabelConfigPair> configs_; 549 UniqueVector<LabelConfigPair> all_dependent_configs_; 550 UniqueVector<LabelConfigPair> public_configs_; 551 552 std::set<Label> allow_circular_includes_from_; 553 554 // Static libraries, shared libraries, and source sets from transitive deps 555 // that need to be linked. 556 InheritedLibraries inherited_libraries_; 557 558 // These libs and dirs are inherited from statically linked deps and all 559 // configs applying to this target. 560 UniqueVector<SourceDir> all_lib_dirs_; 561 UniqueVector<LibFile> all_libs_; 562 563 // These frameworks and dirs are inherited from statically linked deps and 564 // all configs applying to this target. 565 UniqueVector<SourceDir> all_framework_dirs_; 566 UniqueVector<std::string> all_frameworks_; 567 UniqueVector<std::string> all_weak_frameworks_; 568 569 // All hard deps from this target and all dependencies. Filled in when this 570 // target is marked resolved. This will not include the current target. 571 TargetSet recursive_hard_deps_; 572 573 LabelPtrPair<Pool> pool_; 574 575 std::vector<LabelPattern> friends_; 576 std::vector<LabelPattern> assert_no_deps_; 577 578 // Used for all binary targets, and for inputs in regular targets. The 579 // precompiled header values in this struct will be resolved to the ones to 580 // use for this target, if precompiled headers are used. 581 std::unique_ptr<ConfigValues> config_values_; 582 583 // Used for action[_foreach] targets. 584 std::unique_ptr<ActionValues> action_values_; 585 586 // Used for Rust targets. 587 std::unique_ptr<RustValues> rust_values_; 588 589 // Used by all targets, only useful to generate Rust targets though. These 590 // present 2 different views of the public flags: 591 // 592 // Lists all transitive libraries, and for each one the public bit says if 593 // there is a public chain such that this target can make direct use of the 594 // lib. For each library marked public: "I have access to these targets." 595 InheritedLibraries rust_transitive_inherited_libs_; 596 // Lists all transitive libraries, and for each one the public bit says if a 597 // target depending on this target would inherit the libraries as public too. 598 // For each library marked public: "If you depend on me, you get access to 599 // these targets." 600 InheritedLibraries rust_transitive_inheritable_libs_; 601 602 // User for Swift targets. 603 std::unique_ptr<SwiftValues> swift_values_; 604 605 // Toolchain used by this target. Null until target is resolved. 606 const Toolchain* toolchain_ = nullptr; 607 608 // Output files. Empty until the target is resolved. 609 std::vector<OutputFile> computed_outputs_; 610 OutputFile link_output_file_; 611 OutputFile dependency_output_file_; 612 std::vector<OutputFile> runtime_outputs_; 613 614 std::unique_ptr<Metadata> metadata_; 615 616 // GeneratedFile as metadata collection values. 617 std::unique_ptr<GeneratedFile> generated_file_; 618 619 Target(const Target&) = delete; 620 Target& operator=(const Target&) = delete; 621 }; 622 623 extern const char kExecution_Help[]; 624 625 #endif // TOOLS_GN_TARGET_H_ 626