Specify deps format for actions

Setting deps format is necessary for Ninja to store the depfile in its
internal dependency database. This can significantly speed up loading
for large dependency files, which can be the case for custom language
support, e.g. Go or Dart in Fuchsia, where we emit large depfiles from
actions. This also enables the use of `ninja -t deps` tool for custom
actions.

We hardcode the format to gcc since the documentation for depfile
already explicitly specifies that "format is that of a Makefile".

Change-Id: Iddaad90d6c1dcf0de40b0ed8fa005ac9c5b45bd6
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/8540
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Petr Hosek <phosek@google.com>
diff --git a/src/gn/ninja_action_target_writer.cc b/src/gn/ninja_action_target_writer.cc
index bb78254..842eb17 100644
--- a/src/gn/ninja_action_target_writer.cc
+++ b/src/gn/ninja_action_target_writer.cc
@@ -75,6 +75,7 @@
       out_ << "  depfile = ";
       WriteDepfile(SourceFile());
       out_ << std::endl;
+      out_ << "  deps = gcc" << std::endl;
     }
     if (target_->action_values().pool().ptr) {
       out_ << "  pool = ";
@@ -206,6 +207,7 @@
       out_ << "  depfile = ";
       WriteDepfile(sources[i]);
       out_ << std::endl;
+      out_ << "  deps = gcc" << std::endl;
     }
     if (target_->action_values().pool().ptr) {
       out_ << "  pool = ";
diff --git a/src/gn/ninja_action_target_writer_unittest.cc b/src/gn/ninja_action_target_writer_unittest.cc
index d217ab2..9efebff 100644
--- a/src/gn/ninja_action_target_writer_unittest.cc
+++ b/src/gn/ninja_action_target_writer_unittest.cc
@@ -286,10 +286,12 @@
       " | obj/foo/bar.inputdeps.stamp\n"
       "  source_name_part = input1\n"
       "  depfile = gen/input1.d\n"
+      "  deps = gcc\n"
       "build input2.out: __foo_bar___rule ../../foo/input2.txt"
       " | obj/foo/bar.inputdeps.stamp\n"
       "  source_name_part = input2\n"
       "  depfile = gen/input2.d\n"
+      "  deps = gcc\n"
       "\n"
       "build obj/foo/bar.stamp: stamp input1.out input2.out\n";
   EXPECT_EQ(expected_linux, out.str());