GN build: Add application images group and docs

This change adds a top-level build group for application images, as well
as documentation for the upstream GN build layout.

Change-Id: Ib559a9747e9758648cd97b5192126028a01526f2
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/13520
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Reviewed-by: Rob Oliver <rgoliver@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 745b9c4..30ba175 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -30,6 +30,9 @@
   #   size_optimized
   #   speed_optimized
   pw_optimization_level = "debug"
+
+  # List of application image GN targets specific to the Pigweed target.
+  pw_TARGET_APPLICATIONS = []
 }
 
 # Enumerate all of the different targets that upstream Pigweed will build by
@@ -88,6 +91,7 @@
     if (pw_docgen_BUILD_DOCS) {
       deps += [ "$dir_pigweed/docs" ]
     } else {
+      deps += [ ":apps" ]
       if (pw_unit_test_AUTOMATIC_RUNNER == "") {
         # Without a test runner defined, build the tests but don't run them.
         deps += [ ":pw_module_tests" ]
@@ -106,6 +110,14 @@
 
 # Prevent the default toolchain from parsing any other BUILD.gn files.
 if (current_toolchain != default_toolchain) {
+  group("apps") {
+    # Application images built for all targets.
+    deps = []
+
+    # Add target-specific images.
+    deps += pw_TARGET_APPLICATIONS
+  }
+
   group("host_tools") {
     deps = [
       "$dir_pw_target_runner/go:simple_client",
@@ -113,13 +125,6 @@
     ]
   }
 
-  group("pw_facades") {
-    deps = [
-      "$dir_pw_cpu_exception",
-      "$dir_pw_sys_io",
-    ]
-  }
-
   # All Pigweed modules that can be built using gn. This is not built by default.
   group("pw_modules") {
     deps = [
@@ -128,6 +133,7 @@
       "$dir_pw_base64",
       "$dir_pw_bytes",
       "$dir_pw_checksum",
+      "$dir_pw_cpu_exception",
       "$dir_pw_polyfill",
       "$dir_pw_preprocessor",
       "$dir_pw_protobuf",
@@ -136,6 +142,7 @@
       "$dir_pw_status",
       "$dir_pw_stream",
       "$dir_pw_string",
+      "$dir_pw_sys_io",
       "$dir_pw_trace",
       "$dir_pw_unit_test",
       "$dir_pw_varint",