Make commandline flags nicer for fuzz executable

This cleans up the build so commandline flags defined in tools/*.cpp
don't get globbed into the fuzzer's.

Bug: skia:
Change-Id: I5994aa5bf75686641baf0cf97fd81141f0ac6f3a
Reviewed-on: https://skia-review.googlesource.com/92680
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 64792d2..b6b768c 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1686,6 +1686,10 @@
   }
 
   test_app("fuzz") {
+    include_dirs = [
+      "tools",
+      "tools/debugger",
+    ]
     sources = [
       "fuzz/FilterFuzz.cpp",
       "fuzz/FuzzCanvas.cpp",
@@ -1695,12 +1699,19 @@
       "fuzz/FuzzPathop.cpp",
       "fuzz/FuzzScaleToSides.cpp",
       "fuzz/fuzz.cpp",
+      "tools/UrlDataManager.cpp",
+      "tools/debugger/SkDebugCanvas.cpp",
+      "tools/debugger/SkDrawCommand.cpp",
+      "tools/debugger/SkJsonWriteBuffer.cpp",
+      "tools/debugger/SkObjectParser.cpp",
+      "tools/picture_utils.cpp",
     ]
     deps = [
       ":flags",
       ":gpu_tool_utils",
       ":skia",
-      ":tool_utils",
+      "//third_party/jsoncpp",
+      "//third_party/libpng",
     ]
   }
 
diff --git a/fuzz/fuzz.cpp b/fuzz/fuzz.cpp
index 75f87c1..0d19027 100644
--- a/fuzz/fuzz.cpp
+++ b/fuzz/fuzz.cpp
@@ -35,22 +35,28 @@
 #include <signal.h>
 #include "sk_tool_utils.h"
 
-
 DEFINE_string2(bytes, b, "", "A path to a file or a directory. If a file, the "
         "contents will be used as the fuzz bytes. If a directory, all files "
         "in the directory will be used as fuzz bytes for the fuzzer, one at a "
         "time.");
 DEFINE_string2(name, n, "", "If --type is 'api', fuzz the API with this name.");
-
-DEFINE_string2(type, t, "api", "How to interpret --bytes, either 'image_scale'"
-        ", 'image_mode', 'skp', 'icc', or 'api'.");
 DEFINE_string2(dump, d, "", "If not empty, dump 'image*' or 'skp' types as a "
         "PNG with this name.");
+DEFINE_bool2(verbose, v, false, "Print more information while fuzzing.");
+DEFINE_string2(type, t, "", "How to interpret --bytes, one of:\n"
+                            "api\n"
+                            "color_deserialize\n"
+                            "filter_fuzz (equivalent to Chrome's filter_fuzz_stub)\n"
+                            "icc\n"
+                            "image_mode\n"
+                            "image_scale\n"
+                            "path_deserialize\n"
+                            "pipe\n"
+                            "region_deserialize\n"
+                            "skp\n"
+                            "sksl2glsl\n"
+                            "textblob");
 
-static int printUsage() {
-    SkDebugf("Usage: fuzz -t <type> -b <path/to/file> [-n api-to-fuzz]\n");
-    return 1;
-}
 static int fuzz_file(const char* path);
 static uint8_t calculate_option(SkData*);
 
@@ -70,6 +76,8 @@
 #endif
 
 int main(int argc, char** argv) {
+    SkCommandLineFlags::SetUsage("Usage: fuzz -t <type> -b <path/to/file> [-n api-to-fuzz]\n"
+                                 "--help lists the valid types\n");
     SkCommandLineFlags::Parse(argc, argv);
 
     const char* path = FLAGS_bytes.isEmpty() ? argv[0] : FLAGS_bytes[0];
@@ -151,7 +159,8 @@
         }
 #endif
     }
-    return printUsage();
+    SkCommandLineFlags::PrintUsage();
+    return 1;
 }
 
 // This adds up the first 1024 bytes and returns it as an 8 bit integer.  This allows afl-fuzz to