perfetto: add exports for targets with import public decls

This CL adds export declarations for targets containing proto files
which do "import public" in their includes.

This will soon be required declaration in G3 so needs to be done ASAP.

Bug: 218447128
Change-Id: I26c25bab2c566c4d66d00bdec8b0357d7cc8ee02
diff --git a/gn/proto_library.gni b/gn/proto_library.gni
index 5b87753..d1794d5 100644
--- a/gn/proto_library.gni
+++ b/gn/proto_library.gni
@@ -254,6 +254,16 @@
       }
     }
 
+    # The distinction between deps and public_deps does not matter for GN
+    # but Bazel cares about the difference so we distinguish between the two.
+    public_deps_ = []
+    if (defined(invoker.public_deps)) {
+      foreach(dep, invoker.public_deps) {
+        public_deps_ = [ string_replace(dep, expansion_token, gen_type) ]
+      }
+    }
+    deps_ += public_deps_
+
     if (gen_type == "zero") {
       protozero_library(target_name_) {
         proto_in_dir = proto_path
@@ -328,6 +338,7 @@
         metadata = {
           proto_library_sources = invoker.sources
           import_dirs = import_dirs_
+          exports = get_path_info(public_deps_, "abspath")
         }
         forward_variables_from(invoker, vars_to_forward)
       }