pw_bloat: By default, don't print size reports

Size reports currently print when they're generated. This creates a fair
amount of noise which will only increase over time. Add the
pw_bloat_SHOW_SIZE_REPORTS build arg that controls whether to print
size reports in the build.

Change-Id: I82a2578e5412cf20c31f70d5eba058f84697f0a3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/44820
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
diff --git a/pw_bloat/bloat.gni b/pw_bloat/bloat.gni
index 432358c..bb22417 100644
--- a/pw_bloat/bloat.gni
+++ b/pw_bloat/bloat.gni
@@ -34,6 +34,9 @@
   #
   # If this list is empty, pw_toolchain_size_report targets become no-ops.
   pw_bloat_TOOLCHAINS = []
+
+  # Controls whether to display size reports in the build output.
+  pw_bloat_SHOW_SIZE_REPORTS = false
 }
 
 # Creates a target which runs a size report diff on a set of executables.
@@ -186,8 +189,8 @@
         deps = _all_target_dependencies
         args = _bloat_script_args + _binary_paths
 
-        # Print size reports to stdout when they are generated.
-        capture_output = false
+        # Print size reports to stdout when they are generated, if requested.
+        capture_output = !pw_bloat_SHOW_SIZE_REPORTS
       }
     }
   } else {
diff --git a/pw_bloat/docs.rst b/pw_bloat/docs.rst
index 8c00345..b21e520 100644
--- a/pw_bloat/docs.rst
+++ b/pw_bloat/docs.rst
@@ -63,9 +63,10 @@
     ]
   }
 
-When the size report target runs, it will print its report card to stdout.
-Additionally, size report targets also generate ReST output, which is described
-below.
+Size reports are typically included in ReST documentation, as described in
+`Documentation integration`_. Size reports may also be printed in the build
+output if desired. To enable this in the GN build, set the
+``pw_bloat_SHOW_SIZE_REPORTS`` build arg to ``true``.
 
 Documentation integration
 =========================