Download external Go dependencies in build

This change updates the Go GN integration to download external
dependencies for Go packages before running "go build". These
dependencies are listed in the pw_go_package template using build
metadata and collected to a "go get" invocation.

To support this, the pw_exec template is expanded to allow setting
positional arguments from a file.

Change-Id: If4f6c71f037b35bb041984da9982a1629d1d36b0
diff --git a/pw_build/exec.gni b/pw_build/exec.gni
index afa2f48..7c8765d 100644
--- a/pw_build/exec.gni
+++ b/pw_build/exec.gni
@@ -22,15 +22,29 @@
 # Args:
 #  program: The program to run. Can be a full path or just a name (in which case
 #    $PATH is searched).
+#
 #  args: Optional list of arguments to the program.
+#
 #  deps: Dependencies for this target.
+#
 #  inputs: Optional list of build inputs to the program.
+#
 #  outputs: Optional list of artifacts produced by the program's execution.
+#
 #  env: Optional list of key-value pairs defining environment variables for
 #    the program.
+#
 #  env_file: Optional path to a file containing a list of newline-separated
 #    key-value pairs defining environment variables for the program.
 #
+#  args_file: Optional path to a file containing additional positional arguments
+#    to the program. Each line of the file is appended to the invocation. Useful
+#    for specifying arguments from GN metadata.
+#
+#  skip_empty_args: If args_file is provided, boolean indicating whether to skip
+#    running the program if the file is empty. Used to avoid running commands
+#    which error when called without arguments.
+#
 # Example:
 #
 #   pw_exec("hello_world") {
@@ -56,6 +70,17 @@
     ]
   }
 
+  if (defined(invoker.args_file)) {
+    _script_args += [
+      "--args-file",
+      get_path_info(invoker.args_file, "abspath"),
+    ]
+
+    if (defined(invoker.skip_empty_args) && invoker.skip_empty_args) {
+      _script_args += [ "--skip-empty-args" ]
+    }
+  }
+
   if (defined(invoker.env)) {
     foreach(_env, invoker.env) {
       _script_args += [
@@ -81,6 +106,7 @@
                            [
                              "deps",
                              "inputs",
+                             "pool",
                            ])
 
     if (!defined(inputs)) {