gn: fix incremental build of descriptor when changing transitive deps

This CL makes it so that GN is aware of the transitive deps of a proto
descriptor rule so that it rebuilds the descriptor when the non-root
files are touched.

We need to wrap protoc because of a bug in protoc where the depfile is
not in the right output format when generating descriptors.

Change-Id: Ib0fb95351849f0ca802e87ea54329430ec6b1ffd
diff --git a/gn/standalone/proto_library.gni b/gn/standalone/proto_library.gni
index 3c73926..f79ae07 100644
--- a/gn/standalone/proto_library.gni
+++ b/gn/standalone/proto_library.gni
@@ -125,9 +125,12 @@
     sources = proto_sources
     outputs = get_path_info(protogens, "abspath")
 
+    protoc_script = "//gn/standalone/protoc.py"
     protoc_label = "//gn:protoc($host_toolchain)"
     protoc_path = get_label_info(protoc_label, "root_out_dir") + "/protoc"
     args = [
+      "./" + rebase_path(protoc_script, root_build_dir),
+
       # Path should be rebased because |root_build_dir| for current toolchain
       # may be different from |root_out_dir| of protoc built on host toolchain.
       "./" + rebase_path(protoc_path, root_build_dir),
@@ -141,10 +144,14 @@
       ]
     }
     if (generate_descriptor != "") {
+      depfile = "$target_gen_dir/" +
+                rebase_path("$generate_descriptor.d", root_gen_dir)
       args += [
         "--include_imports",
         "--descriptor_set_out",
         rebase_path("$root_gen_dir/" + generate_descriptor, root_build_dir),
+        "--dependency_out",
+        rebase_path("$root_gen_dir/$generate_descriptor.d", root_build_dir),
       ]
     }