Lines Matching +full:target +full:- +full:file
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gn/target.h"
27 // Merges the public configs from the given target to the given config list.
28 void MergePublicConfigsFrom(const Target* from_target, in MergePublicConfigsFrom()
30 const UniqueVector<LabelConfigPair>& pub = from_target->public_configs(); in MergePublicConfigsFrom()
31 dest->Append(pub.begin(), pub.end()); in MergePublicConfigsFrom()
36 // target given in *all_dest.
37 void MergeAllDependentConfigsFrom(const Target* from_target, in MergeAllDependentConfigsFrom()
40 for (const auto& pair : from_target->all_dependent_configs()) { in MergeAllDependentConfigsFrom()
41 all_dest->push_back(pair); in MergeAllDependentConfigsFrom()
42 dest->push_back(pair); in MergeAllDependentConfigsFrom()
47 bool with_toolchain = from->settings()->ShouldShowToolchain({ in MakeTestOnlyError()
48 &from->label(), in MakeTestOnlyError()
49 &to->label(), in MakeTestOnlyError()
52 from->defined_from(), "Test-only dependency not allowed.", in MakeTestOnlyError()
53 from->label().GetUserVisibleName(with_toolchain) + in MakeTestOnlyError()
56 to->label().GetUserVisibleName(with_toolchain) + in MakeTestOnlyError()
59 "can depend on other test-only targets.\n" in MakeTestOnlyError()
61 "Either mark it test-only or don't do this dependency."); in MakeTestOnlyError()
64 // Set check_private_deps to true for the first invocation since a target
74 // us to avoid computing all object file names in the common case.
75 bool EnsureFileIsGeneratedByDependency(const Target* target, in EnsureFileIsGeneratedByDependency() argument
76 const OutputFile& file, in EnsureFileIsGeneratedByDependency() argument
81 if (!seen_targets->add(target)) in EnsureFileIsGeneratedByDependency()
84 // Assume that we have relatively few generated inputs so brute-force in EnsureFileIsGeneratedByDependency()
87 for (const OutputFile& cur : target->computed_outputs()) { in EnsureFileIsGeneratedByDependency()
88 if (file == cur) in EnsureFileIsGeneratedByDependency()
92 if (file == target->write_runtime_deps_output()) in EnsureFileIsGeneratedByDependency()
95 // Check binary target intermediate files if requested. in EnsureFileIsGeneratedByDependency()
96 if (consider_object_files && target->IsBinary()) { in EnsureFileIsGeneratedByDependency()
98 for (const SourceFile& source : target->sources()) { in EnsureFileIsGeneratedByDependency()
100 if (!target->GetOutputFilesForSource(source, &tool_name, &source_outputs)) in EnsureFileIsGeneratedByDependency()
102 if (base::ContainsValue(source_outputs, file)) in EnsureFileIsGeneratedByDependency()
109 for (const auto& pair : target->data_deps()) { in EnsureFileIsGeneratedByDependency()
110 if (EnsureFileIsGeneratedByDependency(pair.ptr, file, false, in EnsureFileIsGeneratedByDependency()
118 // runtime-only). in EnsureFileIsGeneratedByDependency()
119 for (const auto& pair : target->public_deps()) { in EnsureFileIsGeneratedByDependency()
120 if (EnsureFileIsGeneratedByDependency(pair.ptr, file, false, in EnsureFileIsGeneratedByDependency()
128 for (const auto& pair : target->private_deps()) { in EnsureFileIsGeneratedByDependency()
129 if (EnsureFileIsGeneratedByDependency(pair.ptr, file, false, in EnsureFileIsGeneratedByDependency()
134 if (target->output_type() == Target::CREATE_BUNDLE) { in EnsureFileIsGeneratedByDependency()
135 for (const auto* dep : target->bundle_data().bundle_deps()) { in EnsureFileIsGeneratedByDependency()
136 if (EnsureFileIsGeneratedByDependency(dep, file, false, in EnsureFileIsGeneratedByDependency()
146 // check_this indicates if the given target should be matched against the
148 // shouldn't match the target itself.
155 // assert_no that matched the target.
159 bool RecursiveCheckAssertNoDeps(const Target* target, in RecursiveCheckAssertNoDeps() argument
167 if (!visited->add(target)) in RecursiveCheckAssertNoDeps()
168 return true; // Already checked this target. in RecursiveCheckAssertNoDeps()
171 // Check this target against the given list of patterns. in RecursiveCheckAssertNoDeps()
173 if (pattern.Matches(target->label())) { in RecursiveCheckAssertNoDeps()
177 kIndentPath + target->label().GetUserVisibleName(false); in RecursiveCheckAssertNoDeps()
184 for (const auto& pair : target->GetDeps(Target::DEPS_ALL)) { in RecursiveCheckAssertNoDeps()
185 if (pair.ptr->output_type() == Target::EXECUTABLE) in RecursiveCheckAssertNoDeps()
189 // To reconstruct the path, prepend the current target to the error. in RecursiveCheckAssertNoDeps()
191 kIndentPath + target->label().GetUserVisibleName(false) + " ->\n"; in RecursiveCheckAssertNoDeps()
192 failure_path_str->insert(0, prepend_path); in RecursiveCheckAssertNoDeps()
207 1. Look for ".gn" file (see "gn help dotfile") in the current directory and
209 the "source root" and interpret this file to find the name of the build
210 config file.
212 2. Execute the build config file identified by .gn to set up the global
214 etc. set up in this file will be visible to all files in the build.
219 necessary to resolve dependencies. If a BUILD file isn't found in the
223 5. When a target's dependencies are resolved, write out the `.ninja`
224 file to disk.
226 6. When all targets are resolved, write out the root build.ninja file.
228 Note that the BUILD.gn file name may be modulated by .gn arguments such as
231 Executing target definitions and templates
234 interrogate a target from GN code for any information not derivable from its
236 function which requires the target being interrogated to have been defined
237 previously in the same file.
242 ... target parameter definitions ...
245 There is also a generic "target" function for programmatically defined types
246 (see "gn help target"). You can define new types using templates (see "gn
250 Before executing the code inside the target's { }, the target defaults are
252 definitions that can be overridden by the target code as necessary. Typically
263 Targets in non-default toolchains will only be generated when they are
264 required (directly or transitively) to build a target in the default
268 example, related tools or optional variants). A target that is marked as
269 "generated" can propagate its generated state to an associated target using
271 generated in the same cases the source target has but without a build-time
272 dependency and even in non-default toolchains.
282 A target's "data_deps" are guaranteed to be built whenever the target is
284 required at runtime. Currently data deps will be complete before the target
290 Target::Target(const Settings* settings, in Target() function in Target
295 Target::~Target() = default;
304 // const Foo& Target::foo() const {
310 // const Foo& Target::foo() const {
325 const BundleData& Target::bundle_data() const { in bundle_data()
329 BundleData& Target::bundle_data() { in bundle_data()
337 const ConfigValues& Target::config_values() const { in config_values()
341 ConfigValues& Target::config_values() { in config_values()
349 const ActionValues& Target::action_values() const { in action_values()
353 ActionValues& Target::action_values() { in action_values()
361 const RustValues& Target::rust_values() const { in rust_values()
365 RustValues& Target::rust_values() { in rust_values()
373 const SwiftValues& Target::swift_values() const { in swift_values()
377 SwiftValues& Target::swift_values() { in swift_values()
385 const Metadata& Target::metadata() const { in metadata()
389 Metadata& Target::metadata() { in metadata()
395 static const Target::GeneratedFile kEmptyGeneratedFile;
397 const Target::GeneratedFile& Target::generated_file() const { in generated_file()
401 Target::GeneratedFile& Target::generated_file() { in generated_file()
403 generated_file_ = std::make_unique<Target::GeneratedFile>(); in generated_file()
408 const char* Target::GetStringForOutputType(OutputType type) { in GetStringForOutputType()
445 Target* Target::AsTarget() { in AsTarget()
449 const Target* Target::AsTarget() const { in AsTarget()
453 bool Target::OnResolved(Err* err) { in OnResolved()
458 trace.SetToolchain(settings()->toolchain_label()); in OnResolved()
460 // Copy this target's own dependent and public configs to the list of configs in OnResolved()
465 // Check visibility for just this target's own configs, before dependents are in OnResolved()
471 // applying to this target (configs_). in OnResolved()
474 // Copies public dependencies' public configs to this target's public in OnResolved()
475 // configs. These configs have already been applied to this target by in OnResolved()
477 // private deps. This step re-exports them as public configs for targets that in OnResolved()
480 if (dep.ptr->toolchain() == toolchain() || in OnResolved()
481 dep.ptr->toolchain()->propagates_configs()) in OnResolved()
482 public_configs_.Append(dep.ptr->public_configs().begin(), in OnResolved()
483 dep.ptr->public_configs().end()); in OnResolved()
509 g_scheduler->AddWriteRuntimeDepsTarget(this); in OnResolved()
513 g_scheduler->AddGeneratedFile( in OnResolved()
514 computed_outputs_[0].AsSourceFile(settings()->build_settings())); in OnResolved()
520 bool Target::IsBinary() const { in IsBinary()
527 bool Target::IsLinkable() const { in IsLinkable()
535 bool Target::IsFinal() const { in IsFinal()
543 bool Target::IsDataOnly() const { in IsDataOnly()
545 // targets. Changing only contents of the bundle data target should not cause in IsDataOnly()
546 // a binary to be re-linked. It should affect only the CREATE_BUNDLE steps in IsDataOnly()
552 bool Target::ShouldGenerate() const { in ShouldGenerate()
553 const auto& root_patterns = settings()->build_settings()->root_patterns(); in ShouldGenerate()
556 return settings()->is_default(); in ShouldGenerate()
561 DepsIteratorRange Target::GetDeps(DepsIterationType type) const { in GetDeps()
571 std::string Target::GetComputedOutputName() const { in GetComputedOutputName()
579 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); in GetComputedOutputName()
583 if (!output_prefix_override_ && !base::starts_with(name, tool->output_prefix())) in GetComputedOutputName()
584 result = tool->output_prefix(); in GetComputedOutputName()
590 bool Target::SetToolchain(const Toolchain* toolchain, Err* err) { in SetToolchain()
595 const Tool* tool = toolchain->GetToolForTargetFinalOutput(this); in SetToolchain()
599 // Tool not specified for this target type. in SetToolchain()
602 Err(defined_from(), "This target uses an undefined tool.", in SetToolchain()
604 "The target %s\n" in SetToolchain()
617 bool Target::GetOutputsAsSourceFiles(const LocationRange& loc_for_error, in GetOutputsAsSourceFiles()
622 "This target is a binary target which can't be queried for its " in GetOutputsAsSourceFiles()
626 outputs->clear(); in GetOutputsAsSourceFiles()
629 if (output_type() == Target::ACTION || output_type() == Target::COPY_FILES || in GetOutputsAsSourceFiles()
630 output_type() == Target::ACTION_FOREACH || in GetOutputsAsSourceFiles()
631 output_type() == Target::GENERATED_FILE) { in GetOutputsAsSourceFiles()
633 } else if (output_type() == Target::CREATE_BUNDLE) { in GetOutputsAsSourceFiles()
636 } else if (IsBinary() && output_type() != Target::SOURCE_SET) { in GetOutputsAsSourceFiles()
637 // Binary target with normal outputs (source sets have stamp outputs like in GetOutputsAsSourceFiles()
641 // Can't access the toolchain for a target before the build is complete. in GetOutputsAsSourceFiles()
648 const Tool* tool = toolchain()->GetToolForTargetFinalOutput(this); in GetOutputsAsSourceFiles()
652 this, tool, tool->outputs(), &output_files); in GetOutputsAsSourceFiles()
654 outputs->push_back( in GetOutputsAsSourceFiles()
655 output_file.AsSourceFile(settings()->build_settings())); in GetOutputsAsSourceFiles()
659 // dependency output file should have computed what this is. This won't be in GetOutputsAsSourceFiles()
665 outputs->push_back( in GetOutputsAsSourceFiles()
666 dependency_output_file().AsSourceFile(settings()->build_settings())); in GetOutputsAsSourceFiles()
671 bool Target::GetOutputFilesForSource(const SourceFile& source, in GetOutputFilesForSource()
676 outputs->clear(); in GetOutputFilesForSource()
679 if (output_type() == Target::COPY_FILES || in GetOutputFilesForSource()
680 output_type() == Target::ACTION_FOREACH) { in GetOutputFilesForSource()
681 // These target types apply the output pattern to the input. in GetOutputFilesForSource()
686 // All other non-binary target types just return the target outputs. We in GetOutputFilesForSource()
687 // don't know if the build is complete and it doesn't matter for non-binary in GetOutputFilesForSource()
696 outputs->emplace_back(OutputFile(settings()->build_settings(), cur)); in GetOutputFilesForSource()
706 outputs->emplace_back(OutputFile(settings()->build_settings(), source)); in GetOutputFilesForSource()
716 return false; // No tool for this file (it's a header file or something). in GetOutputFilesForSource()
717 const Tool* tool = toolchain_->GetTool(*computed_tool_type); in GetOutputFilesForSource()
719 return false; // Tool does not apply for this toolchain.file. in GetOutputFilesForSource()
723 if (tool->partial_outputs().list().empty()) in GetOutputFilesForSource()
728 file_type == SourceFile::SOURCE_SWIFT ? tool->partial_outputs() in GetOutputFilesForSource()
729 : tool->outputs(); in GetOutputFilesForSource()
735 return !outputs->empty(); in GetOutputFilesForSource()
738 void Target::PullDependentTargetConfigs() { in PullDependentTargetConfigs()
740 if (pair.ptr->toolchain() == toolchain() || in PullDependentTargetConfigs()
741 pair.ptr->toolchain()->propagates_configs()) in PullDependentTargetConfigs()
746 if (pair.ptr->toolchain() == toolchain() || in PullDependentTargetConfigs()
747 pair.ptr->toolchain()->propagates_configs()) in PullDependentTargetConfigs()
753 void Target::PullDependentTargetLibsFrom(const Target* dep, bool is_public) { in PullDependentTargetLibsFrom()
755 if (dep->output_type() == STATIC_LIBRARY || in PullDependentTargetLibsFrom()
756 dep->output_type() == SHARED_LIBRARY || in PullDependentTargetLibsFrom()
757 dep->output_type() == RUST_LIBRARY || in PullDependentTargetLibsFrom()
758 dep->output_type() == SOURCE_SET || in PullDependentTargetLibsFrom()
759 (dep->output_type() == CREATE_BUNDLE && in PullDependentTargetLibsFrom()
760 dep->bundle_data().is_framework()) || in PullDependentTargetLibsFrom()
761 (dep->output_type() == COPY_FILES && in PullDependentTargetLibsFrom()
762 dep->copy_linkable_file())) { in PullDependentTargetLibsFrom()
766 // Collect Rust libraries that are accessible from the current target, or in PullDependentTargetLibsFrom()
767 // transitively part of the current target. in PullDependentTargetLibsFrom()
768 if (dep->output_type() == STATIC_LIBRARY || in PullDependentTargetLibsFrom()
769 dep->output_type() == SHARED_LIBRARY || in PullDependentTargetLibsFrom()
770 dep->output_type() == SOURCE_SET || dep->output_type() == RUST_LIBRARY || in PullDependentTargetLibsFrom()
771 dep->output_type() == GROUP || in PullDependentTargetLibsFrom()
772 (dep->output_type() == COPY_FILES && in PullDependentTargetLibsFrom()
773 dep->copy_linkable_file())) { in PullDependentTargetLibsFrom()
774 // Here we have: `this` --[depends-on]--> `dep` in PullDependentTargetLibsFrom()
776 // The `this` target has direct access to `dep` since its a direct in PullDependentTargetLibsFrom()
778 // true for public-ness. Whereas, anything depending on `this` can only gain in PullDependentTargetLibsFrom()
783 // it's used for passing to rustc with --extern. We currently track in PullDependentTargetLibsFrom()
784 // everything then drop non-Rust libs in ninja_rust_binary_target_writer.cc. in PullDependentTargetLibsFrom()
789 dep->rust_transitive_inheritable_libs(), true); in PullDependentTargetLibsFrom()
791 dep->rust_transitive_inheritable_libs(), is_public); in PullDependentTargetLibsFrom()
792 } else if (dep->output_type() == RUST_PROC_MACRO) { in PullDependentTargetLibsFrom()
793 // Proc-macros are inherited as a transitive dependency, but the things they in PullDependentTargetLibsFrom()
795 // the target (as it's only used during compilation). in PullDependentTargetLibsFrom()
800 if ((dep->output_type() == SHARED_LIBRARY) || in PullDependentTargetLibsFrom()
801 (dep->output_type() == COPY_FILES && in PullDependentTargetLibsFrom()
802 dep->copy_linkable_file())) { in PullDependentTargetLibsFrom()
807 // EXE -> INTERMEDIATE_SHLIB --[public]--> FINAL_SHLIB in PullDependentTargetLibsFrom()
813 // EXE -> INTERMEDIATE_SHLIB --[private]--> FINAL_SHLIB in PullDependentTargetLibsFrom()
823 inherited_libraries_.AppendPublicSharedLibraries(dep->inherited_libraries(), in PullDependentTargetLibsFrom()
828 if (!dep->IsFinal()) { in PullDependentTargetLibsFrom()
829 // The current target isn't linked, so propagate linked deps and in PullDependentTargetLibsFrom()
832 dep->inherited_libraries().GetOrderedAndPublicFlag()) { in PullDependentTargetLibsFrom()
835 } else if (dep->complete_static_lib()) { in PullDependentTargetLibsFrom()
841 // libraries link in non-final targets they shouldn't be inherited. in PullDependentTargetLibsFrom()
843 dep->inherited_libraries().GetOrderedAndPublicFlag()) { in PullDependentTargetLibsFrom()
844 if (inherited->IsFinal()) { in PullDependentTargetLibsFrom()
850 for (const auto& [target, pub] : transitive.GetOrderedAndPublicFlag()) { in PullDependentTargetLibsFrom()
853 // be specified in --extern. in PullDependentTargetLibsFrom()
854 if (target->output_type() != RUST_PROC_MACRO) { in PullDependentTargetLibsFrom()
855 inherited_libraries_.Append(target, pub); in PullDependentTargetLibsFrom()
861 if (!dep->IsFinal() || dep->output_type() == STATIC_LIBRARY) { in PullDependentTargetLibsFrom()
862 all_lib_dirs_.Append(dep->all_lib_dirs()); in PullDependentTargetLibsFrom()
863 all_libs_.Append(dep->all_libs()); in PullDependentTargetLibsFrom()
865 all_framework_dirs_.Append(dep->all_framework_dirs()); in PullDependentTargetLibsFrom()
866 all_frameworks_.Append(dep->all_frameworks()); in PullDependentTargetLibsFrom()
867 all_weak_frameworks_.Append(dep->all_weak_frameworks()); in PullDependentTargetLibsFrom()
871 void Target::PullDependentTargetLibs() { in PullDependentTargetLibs()
878 void Target::PullRecursiveHardDeps() { in PullRecursiveHardDeps()
881 if (hard_dep() || pair.ptr->hard_dep()) { in PullRecursiveHardDeps()
886 // If |pair.ptr| is binary target and |pair.ptr| has no public header, in PullRecursiveHardDeps()
887 // |this| target does not need to have |pair.ptr|'s hard_deps as its in PullRecursiveHardDeps()
888 // hard_deps to start compiles earlier. Unless the target compiles a in PullRecursiveHardDeps()
890 // by the current target). in PullRecursiveHardDeps()
891 if (pair.ptr->IsBinary() && !pair.ptr->all_headers_public() && in PullRecursiveHardDeps()
892 pair.ptr->public_headers().empty() && in PullRecursiveHardDeps()
893 !pair.ptr->builds_swift_module()) { in PullRecursiveHardDeps()
898 recursive_hard_deps_.insert(pair.ptr->recursive_hard_deps().begin(), in PullRecursiveHardDeps()
899 pair.ptr->recursive_hard_deps().end()); in PullRecursiveHardDeps()
903 void Target::PullRecursiveBundleData() { in PullRecursiveBundleData()
907 if (pair.ptr->toolchain() != toolchain()) in PullRecursiveBundleData()
911 if (pair.ptr->output_type() == CREATE_BUNDLE && in PullRecursiveBundleData()
912 !pair.ptr->bundle_data().transparent()) { in PullRecursiveBundleData()
916 // Direct dependency on a bundle_data target. in PullRecursiveBundleData()
917 if (pair.ptr->output_type() == BUNDLE_DATA) { in PullRecursiveBundleData()
922 if (pair.ptr->has_bundle_data()) { in PullRecursiveBundleData()
923 for (const auto* target : pair.ptr->bundle_data().forwarded_bundle_deps()) in PullRecursiveBundleData() local
924 bundle_data().AddBundleData(target, is_create_bundle); in PullRecursiveBundleData()
932 bool Target::FillOutputFiles(Err* err) { in FillOutputFiles()
933 const Tool* tool = toolchain_->GetToolForTargetFinalOutput(this); in FillOutputFiles()
947 // affect the stamp file name: it is always based on the original target in FillOutputFiles()
959 CHECK_GE(tool->outputs().list().size(), 1u); in FillOutputFiles()
963 this, tool, tool->outputs().list()[0]); in FillOutputFiles()
965 if (tool->runtime_outputs().list().empty()) { in FillOutputFiles()
970 this, tool, tool->runtime_outputs(), &runtime_outputs_); in FillOutputFiles()
977 CHECK(tool->outputs().list().size() >= 1); in FillOutputFiles()
981 this, tool, tool->outputs().list()[0]); in FillOutputFiles()
985 CHECK(tool->outputs().list().size() >= 1); in FillOutputFiles()
987 if (const CTool* ctool = tool->AsC()) { in FillOutputFiles()
988 if (ctool->link_output().empty() && ctool->depend_output().empty()) { in FillOutputFiles()
989 // Default behavior, use the first output file for both. in FillOutputFiles()
992 this, tool, tool->outputs().list()[0]); in FillOutputFiles()
994 // Use the tool-specified ones. in FillOutputFiles()
995 if (!ctool->link_output().empty()) { in FillOutputFiles()
998 this, tool, ctool->link_output()); in FillOutputFiles()
1000 if (!ctool->depend_output().empty()) { in FillOutputFiles()
1003 this, tool, ctool->depend_output()); in FillOutputFiles()
1006 if (tool->runtime_outputs().list().empty()) { in FillOutputFiles()
1011 this, tool, tool->runtime_outputs(), &runtime_outputs_); in FillOutputFiles()
1013 } else if (tool->AsRust()) { in FillOutputFiles()
1014 // Default behavior, use the first output file for both. in FillOutputFiles()
1017 this, tool, tool->outputs().list()[0]); in FillOutputFiles()
1032 // Count all outputs from this tool as something generated by this target. in FillOutputFiles()
1035 this, tool, tool->outputs(), &computed_outputs_); in FillOutputFiles()
1046 // Also count anything the target has declared to be an output. in FillOutputFiles()
1049 action_values_->GetOutputsAsSourceFiles(this, &outputs_as_sources); in FillOutputFiles()
1052 OutputFile(settings()->build_settings(), out)); in FillOutputFiles()
1063 bool Target::ResolvePrecompiledHeaders(Err* err) { in ResolvePrecompiledHeaders()
1067 // specified directly on a target. in ResolvePrecompiledHeaders()
1076 config_values_.get() && config_values_->has_precompiled_headers(); in ResolvePrecompiledHeaders()
1083 continue; // Skip the one on the target itself. in ResolvePrecompiledHeaders()
1086 const ConfigValues& cur = config->resolved_values(); in ResolvePrecompiledHeaders()
1092 if (config_values_->precompiled_header() != cur.precompiled_header() || in ResolvePrecompiledHeaders()
1093 config_values_->precompiled_source() != cur.precompiled_source()) { in ResolvePrecompiledHeaders()
1094 bool with_toolchain = settings()->ShouldShowToolchain({ in ResolvePrecompiledHeaders()
1097 &config->label(), in ResolvePrecompiledHeaders()
1101 "The target " + label().GetUserVisibleName(with_toolchain) + in ResolvePrecompiledHeaders()
1106 pch_header_settings_from->GetUserVisibleName(with_toolchain) + in ResolvePrecompiledHeaders()
1107 "\n header: " + config_values_->precompiled_header() + in ResolvePrecompiledHeaders()
1108 "\n source: " + config_values_->precompiled_source().value() + in ResolvePrecompiledHeaders()
1111 config->label().GetUserVisibleName(with_toolchain) + in ResolvePrecompiledHeaders()
1118 pch_header_settings_from = &config->label(); in ResolvePrecompiledHeaders()
1127 bool Target::CheckVisibility(Err* err) const { in CheckVisibility()
1135 bool Target::CheckConfigVisibility(Err* err) const { in CheckConfigVisibility()
1144 bool Target::CheckSourceSetLanguages(Err* err) const { in CheckSourceSetLanguages()
1145 if (output_type() == Target::SOURCE_SET && in CheckSourceSetLanguages()
1148 label().GetUserVisibleName(!settings()->is_default()) + in CheckSourceSetLanguages()
1155 bool Target::CheckTestonly(Err* err) const { in CheckTestonly()
1156 // If the current target is marked testonly, it can include both testonly in CheckTestonly()
1157 // and non-testonly targets, so there's nothing to check. in CheckTestonly()
1163 if (pair.ptr->testonly()) { in CheckTestonly()
1172 if (config->testonly()) { in CheckTestonly()
1182 bool Target::CheckAssertNoDeps(Err* err) const { in CheckAssertNoDeps()
1194 label().GetUserVisibleName(!settings()->is_default()) + in CheckAssertNoDeps()
1195 " has an assert_no_deps entry:\n " + failure_pattern->Describe() + in CheckAssertNoDeps()
1202 void Target::CheckSourcesGenerated() const { in CheckSourcesGenerated()
1203 // Checks that any inputs or sources to this target that are in the build in CheckSourcesGenerated()
1204 // directory are generated by a target that this one transitively depends on in CheckSourcesGenerated()
1209 for (const SourceFile& file : sources_) in CheckSourcesGenerated() local
1210 CheckSourceGenerated(file); in CheckSourcesGenerated()
1212 for (const SourceFile& file : iter.cur().inputs()) in CheckSourcesGenerated() local
1213 CheckSourceGenerated(file); in CheckSourcesGenerated()
1219 void Target::CheckSourceGenerated(const SourceFile& source) const { in CheckSourceGenerated()
1220 if (!IsStringInOutputDir(settings()->build_settings()->build_dir(), in CheckSourceGenerated()
1227 OutputFile out_file(settings()->build_settings(), source); in CheckSourceGenerated()
1237 g_scheduler->IsFileGeneratedByWriteRuntimeDeps(out_file) || in CheckSourceGenerated()
1238 g_scheduler->IsFileGeneratedByTarget(source); in CheckSourceGenerated()
1245 g_scheduler->AddUnknownGeneratedInput(this, source); in CheckSourceGenerated()
1249 bool Target::GetMetadata(const std::vector<std::string>& keys_to_extract, in GetMetadata()
1258 // If deps_only, this is the top-level target and thus we don't want to in GetMetadata()
1266 // Otherwise, we walk this target and collect the appropriate data. in GetMetadata()
1270 if (!metadata().WalkStep(settings()->build_settings(), keys_to_extract, in GetMetadata()
1276 // Gather walk keys and find the appropriate target. Targets identified in in GetMetadata()
1277 // the walk key set must be deps or data_deps of the declaring target. in GetMetadata()
1278 const DepsIteratorRange& all_deps = GetDeps(Target::DEPS_ALL); in GetMetadata()
1290 if (targets_walked->add(dep.ptr)) { in GetMetadata()
1291 if (!dep.ptr->GetMetadata(keys_to_extract, keys_to_walk, rebase_dir, in GetMetadata()
1302 // Otherwise, look through the target's deps for the specified one. in GetMetadata()
1305 current_dir, settings()->build_settings()->root_path_utf8(), in GetMetadata()
1306 settings()->toolchain_label(), next, err); in GetMetadata()
1318 if (targets_walked->add(dep.ptr)) { in GetMetadata()
1319 if (!dep.ptr->GetMetadata(keys_to_extract, keys_to_walk, rebase_dir, in GetMetadata()
1328 // If we didn't find the specified dep in the target, that's an error. in GetMetadata()
1340 result->insert(result->end(), std::make_move_iterator(current_result.begin()), in GetMetadata()