Remove dependency on fuzzer impls from pdfium target. (try 2)

Add the dependency to the fuzzers target instead for PDFium's compile
checking purposes.

To make the fuzzers actually build properly:
- Add missing dependencies that show up when linking the fuzzer
  executables in Chromium component builds, now that the pdfium target
  no longer depends on the set of all dependencies from all fuzzers.
  All of these are missing because the //fxjs target has circular
  dependencies with the missing targets and cannot depend on them.
- Change the Chromium-side fuzzer build rules to have direct
  dependencies on what it needs, rather than indirectly go through the
  pdfium target. [1]

Then update the pdfium_fuzzer GN template comment to explain the new
approach.

[1] https://crrev.com/c/2946810

Bug: chromium:1217515
Change-Id: Id17f43c2a329d2e7836f0e25c0d2a2ee407c90a5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/81634
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index bf0994a..4e69f0b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -213,10 +213,6 @@
     complete_static_lib = true
     configs -= [ "//build/config/compiler:thin_archive" ]
   }
-
-  if (is_component_build) {
-    deps += [ "testing/fuzzers:fuzzer_impls" ]
-  }
 }
 
 # Targets below this are only visible within this file (and to the
diff --git a/testing/fuzzers/BUILD.gn b/testing/fuzzers/BUILD.gn
index 2eeb807..8cbec03 100644
--- a/testing/fuzzers/BUILD.gn
+++ b/testing/fuzzers/BUILD.gn
@@ -71,12 +71,18 @@
   fuzzer_list += [ "pdf_nametree_fuzzer" ]
 }
 
+# Note that this only compiles all the fuzzers, to prevent compile breakages.
+# It does not link and create fuzzer executables. That is done in Chromium.
 group("fuzzers") {
   testonly = true
   deps = []
   foreach(fuzzer, fuzzer_list) {
     deps += [ ":${fuzzer}_src" ]
   }
+
+  if (is_component_build) {
+    deps += [ ":fuzzer_impls" ]
+  }
 }
 
 source_set("fuzzer_init") {
@@ -170,11 +176,12 @@
   }
   if (is_component_build) {
     # In component builds, fuzzers are split into "_impl" and "_src" targets.
-    # The "_impl" target exports the fuzzer implementation and gets statically
-    # linked into the PDFium shared library.  The "_src" target is a thin
-    # wrapper that imports the fuzzer from PDFium; this gets linked into the
-    # real fuzzer executable.  In static builds, there's only a single "_src"
-    # target that contains the implementation and statically links in PDFium.
+    # The "_impl" target exports the fuzzer implementation. The "_src" target
+    # is a thin wrapper that imports the fuzzer from PDFium; this gets linked
+    # into the real fuzzer executable. The real fuzzer target has to depend on
+    # both the "_impl" and "_src" targets.
+    # In static builds, there's only a single "_src" target that contains the
+    # implementation and statically links in PDFium.
 
     impl_name = target_name + "_impl"
     template_target_name = target_name
@@ -225,6 +232,7 @@
     sources = [ "pdf_cjs_util_fuzzer.cc" ]
     deps = [
       "../../core/fxcrt",
+      "../../fpdfsdk",
       "../../fxjs",
     ]
   }
@@ -232,6 +240,7 @@
     sources = [ "pdf_fx_date_helpers_fuzzer.cc" ]
     deps = [
       "../../core/fxcrt",
+      "../../fpdfsdk",
       "../../fxjs",
     ]
   }
@@ -254,8 +263,10 @@
       deps = [
         ":fuzzer_utils",
         "../../core/fxcrt",
+        "../../fpdfsdk",
         "../../fxjs:gc",
         "../../xfa/fgas/crt",
+        "../../xfa/fxfa",
         "../../xfa/fxfa/parser",
       ]
       public_fuzzer = true
@@ -364,6 +375,7 @@
       deps = [
         ":fuzzer_utils",
         "../../core/fxcrt",
+        "../../fpdfsdk",
         "../../fxjs",
       ]
       public_fuzzer = true