Index: tools/gn/script_target_generator.cc |
diff --git a/tools/gn/script_target_generator.cc b/tools/gn/script_target_generator.cc |
index c9616950e4b48ce4ca90f2942e7f4e27b45eec24..272061c488be588e66ae98043c974c6ff80c323f 100644 |
--- a/tools/gn/script_target_generator.cc |
+++ b/tools/gn/script_target_generator.cc |
@@ -4,6 +4,7 @@ |
#include "tools/gn/script_target_generator.h" |
+#include "tools/gn/build_settings.h" |
#include "tools/gn/err.h" |
#include "tools/gn/filesystem_utils.h" |
#include "tools/gn/scope.h" |
@@ -48,6 +49,10 @@ void ScriptTargetGenerator::DoRun() { |
if (err_->has_error()) |
return; |
+ FillDepfile(); |
+ if (err_->has_error()) |
+ return; |
+ |
// Script outputs don't depend on the current toolchain so we can skip adding |
// that dependency. |
} |
@@ -77,3 +82,12 @@ void ScriptTargetGenerator::FillScriptArgs() { |
return; |
target_->script_values().swap_in_args(&args); |
} |
+ |
+void ScriptTargetGenerator::FillDepfile() { |
+ const Value* value = scope_->GetValue(variables::kDepfile, true); |
+ if (!value) |
+ return; |
+ target_->script_values().set_depfile( |
+ scope_->settings()->build_settings()->build_dir().ResolveRelativeFile( |
+ value->string_value())); |
+} |