Index: tools/gn/target_generator.cc |
diff --git a/tools/gn/target_generator.cc b/tools/gn/target_generator.cc |
index f5b4ec8122f9305de54bf846b1ffce3142d0d88e..4a84bcd5cd28ce450d06ea9f92940b6a9e6fd858 100644 |
--- a/tools/gn/target_generator.cc |
+++ b/tools/gn/target_generator.cc |
@@ -58,6 +58,9 @@ void TargetGenerator::Run() { |
if (!Visibility::FillItemVisibility(target_, scope_, err_)) |
return; |
+ if (!FillWriteRuntimeDeps()) |
+ return; |
+ |
// Do type-specific generation. |
DoRun(); |
} |
@@ -383,3 +386,23 @@ bool TargetGenerator::FillGenericDeps(const char* var_name, |
} |
return !err_->has_error(); |
} |
+ |
+bool TargetGenerator::FillWriteRuntimeDeps() { |
+ const Value* value = scope_->GetValue(variables::kWriteRuntimeDeps, true); |
+ if (!value) |
+ return true; |
+ |
+ // Compute the file name and make sure it's in the output dir. |
+ SourceFile source_file = scope_->GetSourceDir().ResolveRelativeFile( |
+ *value, err_, GetBuildSettings()->root_path_utf8()); |
+ if (err_->has_error()) |
+ return false; |
+ if (!EnsureStringIsInOutputDir(GetBuildSettings()->build_dir(), |
+ source_file.value(), value->origin(), err_)) |
+ return false; |
+ OutputFile output_file(GetBuildSettings(), source_file); |
+ target_->set_write_runtime_deps_output(output_file); |
+ |
+ g_scheduler->AddWriteRuntimeDepsTarget(target_); |
+ return true; |
+} |