Create .gni files for samples, tests, gms, and benches.

Calling Python to find all these files is convenient, but error-prone.  It's easy to forget to call GN again when adding a file.  Each of these calls to Python also adds ~50ms to the run time of gn gen, which is small but adds up.

On my desktop, gn gen drops from 600ms to 150ms, noticeably faster.

This leaves one call to find.py for generating skia.h for fiddle.  We're not quite sure how to automate that process to happen entirely inside the :skia.h action while maintaining correct dependencies, so I'm leaving it for now.

BUG=skia:

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4036

Change-Id: Ib9d355b97900f29afebc65311ceef50537e46dda
Reviewed-on: https://skia-review.googlesource.com/4036
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index e41166b..6a55922 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -809,13 +809,7 @@
     ]
   }
 
-  gm_sources = exec_script("gyp/find.py",
-                           [
-                             "*.c*",
-                             rebase_path("gm"),
-                           ],
-                           "list lines",
-                           [])
+  import("gn/gm.gni")
   test_lib("gm") {
     public_include_dirs = [ "gm" ]
     sources = gm_sources
@@ -827,23 +821,12 @@
     ]
   }
 
-  tests_sources = exec_script("gyp/find.py",
-                              [
-                                "*.c*",
-                                rebase_path("tests"),
-                              ],
-                              "list lines",
-                              [])
-
+  import("gn/tests.gni")
   test_lib("tests") {
     public_include_dirs = [ "tests" ]
-    sources = tests_sources - [
-                rebase_path("tests/PathOpsSkpClipTest.cpp"),  # alternate main
-                rebase_path("tests/SkpSkGrTest.cpp"),  # doesn't compile
-                rebase_path("tests/skia_test.cpp"),  # alternate main
-              ]
+    sources = tests_sources + pathops_tests_sources
     if (!fontmgr_android_enabled) {
-      sources -= [ rebase_path("tests/FontMgrAndroidParserTest.cpp") ]
+      sources -= [ "//tests/FontMgrAndroidParserTest.cpp" ]
     }
     deps = [
       ":experimental_svg_model",
@@ -856,21 +839,10 @@
     ]
   }
 
-  bench_sources = exec_script("gyp/find.py",
-                              [
-                                "*.c*",
-                                rebase_path("bench"),
-                              ],
-                              "list lines",
-                              [])
-
+  import("gn/bench.gni")
   test_lib("bench") {
     public_include_dirs = [ "bench" ]
     sources = bench_sources
-    sources -= [
-      rebase_path("bench/nanobench.cpp"),
-      rebase_path("bench/nanobenchAndroid.cpp"),
-    ]
     deps = [
       ":flags",
       ":gm",
@@ -945,38 +917,19 @@
     }
   }
 
-  sample_sources = exec_script("gyp/find.py",
-                               [
-                                 "*.c*",
-                                 rebase_path("samplecode"),
-                               ],
-                               "list lines",
-                               [])
-
+  import("gn/samples.gni")
   test_lib("samples") {
-    include_dirs = [ "experimental" ]
     public_include_dirs = [ "samplecode" ]
-    sources = sample_sources
-    sources -= [
-      rebase_path("samplecode/SampleAnimator.cpp"),  # relies on animator
-      rebase_path("samplecode/SampleApp.cpp"),  # part of SampleApp exe, not samples lib
-      rebase_path("samplecode/SampleClamp.cpp"),
-      rebase_path("samplecode/SampleDash.cpp"),
-      rebase_path("samplecode/SampleLua.cpp"),  # no Lua yet in GN
-      rebase_path("samplecode/SamplePathFill.cpp"),
-      rebase_path("samplecode/SamplePictFile.cpp"),  # relies on SK_SUPPORT_LEGACY_DRAWFILTER
-      rebase_path("samplecode/SampleSkLayer.cpp"),  # relies on SkMatrix44 which doesn't compile?
-      rebase_path("samplecode/SampleFontCache.cpp"),  # relies on pthread.h
-    ]
-    sources += [
-      "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
-      "experimental/SkSetPoly3To3.cpp",
-      "experimental/SkSetPoly3To3_A.cpp",
-      "experimental/SkSetPoly3To3_D.cpp",
-    ]
+    include_dirs = [ "experimental" ]
+    sources = samples_sources + [
+                "experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp",
+                "experimental/SkSetPoly3To3.cpp",
+                "experimental/SkSetPoly3To3_A.cpp",
+                "experimental/SkSetPoly3To3_D.cpp",
+              ]
     deps = [
       ":experimental_svg_model",
-      ":gm",  # Why does SampleFilterQuality.cpp include gm.h ???
+      ":gm",
       ":tool_utils",
       ":views",
       ":xml",
@@ -1140,18 +1093,8 @@
     testonly = true
   }
 
-  pathops_tests_sources = exec_script("gyp/find.py",
-                                      [
-                                        "PathOps*.cpp",
-                                        rebase_path("tests"),
-                                      ],
-                                      "list lines",
-                                      [])
-
   executable("pathops_unittest") {
-    sources = pathops_tests_sources -
-              [ rebase_path("tests/PathOpsSkpClipTest.cpp") ] +
-              [
+    sources = pathops_tests_sources + [
                 rebase_path("tests/skia_test.cpp"),
                 rebase_path("tests/Test.cpp"),
               ]