[bazel] Try adding cc_binary rules that use generated rules

To make the atomic rules a bit easier to work with, in many
of the folders, this adds in cc_library rules to group
together the sources from that folder (and subfolders
where prudent). We only needs sources because those atoms
should have their headers as deps.

One issue that was pointed out is that there is currently
no way to restrict the inclusion of certain packages,
a la, `gn check`. For example, there is no mechanism from
stopping a dev from adding
#include "modules/canvaskit/WasmCommon.h"
to something in //src/core (except circular dependencies).
We can probably address that using Bazel's visibility
rules as needed:
https://docs.bazel.build/versions/main/visibility.html
https://docs.bazel.build/versions/main/be/functions.html#package_group

It is recommended to look at this CL patchset by patchset.
PS1: Update gazelle command to generate rules in more folders.
PS2: A few changes to make generation work better.
PS3: The result of running make generate in //bazel
PS4: Adding the rules to build sksllex, the simplest binary I
     could find in the Skia repo.
PS5: Adding the rules to build skdiff, a more complex binary.
     I tried a few approaches, but ended up gravitating back
     towards the layout where we have each folder/package
     group up the sources. I imagine at some point, we'll have
     skdiff depend on skia_core or something, which will
     have things like //src/core, //src/codecs, //src/pathops
     all bundled together.
PS7: Added in the groupings of sources, similar to what we had
     earlier. I liked these for readability. These helped fix
     up the //:skia_core build, and by extension, the CanvasKit
     build.

Change-Id: I3faa7c4e821c876b243617aacf0246efa524cbde
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/476219
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
diff --git a/tools/flags/BUILD.bazel b/tools/flags/BUILD.bazel
new file mode 100644
index 0000000..d38bb0f
--- /dev/null
+++ b/tools/flags/BUILD.bazel
@@ -0,0 +1,105 @@
+load("//bazel:macros.bzl", "generated_cc_atom")
+
+generated_cc_atom(
+    name = "CommandLineFlags_hdr",
+    hdrs = ["CommandLineFlags.h"],
+    visibility = ["//:__subpackages__"],
+    deps = [
+        "//include/core:SkString_hdr",
+        "//include/private:SkTArray_hdr",
+        "//include/private:SkTDArray_hdr",
+    ],
+)
+
+generated_cc_atom(
+    name = "CommandLineFlags_src",
+    srcs = ["CommandLineFlags.cpp"],
+    visibility = ["//:__subpackages__"],
+    deps = [
+        ":CommandLineFlags_hdr",
+        "//include/private:SkTDArray_hdr",
+        "//src/core:SkTSort_hdr",
+    ],
+)
+
+generated_cc_atom(
+    name = "CommonFlagsAA_src",
+    srcs = ["CommonFlagsAA.cpp"],
+    visibility = ["//:__subpackages__"],
+    deps = [
+        ":CommonFlags_hdr",
+        "//src/core:SkScan_hdr",
+    ],
+)
+
+generated_cc_atom(
+    name = "CommonFlagsConfig_hdr",
+    hdrs = ["CommonFlagsConfig.h"],
+    visibility = ["//:__subpackages__"],
+    deps = [
+        ":CommandLineFlags_hdr",
+        "//tools/gpu:GrContextFactory_hdr",
+        "//tools/graphite:ContextFactory_hdr",
+    ],
+)
+
+generated_cc_atom(
+    name = "CommonFlagsConfig_src",
+    srcs = ["CommonFlagsConfig.cpp"],
+    visibility = ["//:__subpackages__"],
+    deps = [
+        ":CommonFlagsConfig_hdr",
+        "//include/core:SkImageInfo_hdr",
+        "//include/core:SkStringView_hdr",
+        "//include/core:SkSurfaceProps_hdr",
+        "//include/private:SkTHash_hdr",
+        "//src/core:SkColorSpacePriv_hdr",
+        "//src/core:SkSurfacePriv_hdr",
+    ],
+)
+
+generated_cc_atom(
+    name = "CommonFlagsFontMgr_src",
+    srcs = ["CommonFlagsFontMgr.cpp"],
+    visibility = ["//:__subpackages__"],
+    deps = [
+        ":CommandLineFlags_hdr",
+        ":CommonFlags_hdr",
+        "//include/ports:SkTypeface_win_hdr",
+        "//src/core:SkFontMgrPriv_hdr",
+        "//tools/fonts:TestFontMgr_hdr",
+    ],
+)
+
+generated_cc_atom(
+    name = "CommonFlagsGpu_src",
+    srcs = ["CommonFlagsGpu.cpp"],
+    visibility = ["//:__subpackages__"],
+    deps = [
+        ":CommonFlags_hdr",
+        "//include/core:SkExecutor_hdr",
+        "//include/gpu:GrContextOptions_hdr",
+    ],
+)
+
+generated_cc_atom(
+    name = "CommonFlagsImages_src",
+    srcs = ["CommonFlagsImages.cpp"],
+    visibility = ["//:__subpackages__"],
+    deps = [
+        ":CommonFlags_hdr",
+        "//src/core:SkOSFile_hdr",
+        "//src/utils:SkOSPath_hdr",
+    ],
+)
+
+generated_cc_atom(
+    name = "CommonFlags_hdr",
+    hdrs = ["CommonFlags.h"],
+    visibility = ["//:__subpackages__"],
+    deps = [
+        ":CommandLineFlags_hdr",
+        "//include/core:SkString_hdr",
+        "//include/private:SkTArray_hdr",
+    ],
+)