Only define test_runner_py when standalone

Only defines the //testing/tools:test_runner_py target when
pdf_is_standalone, as this target is only useful and valid for the
PDFium CQ and CI builders.

Bug: pdfium:1933
Change-Id: I57d242086c0ed8b4d81f7c94feb753ca2a67106f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/110590
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: K. Moon <kmoon@chromium.org>
Auto-Submit: K. Moon <kmoon@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 2d90fca..ca85e44 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -579,8 +579,11 @@
     ":pdfium_unittests",
     "samples",
     "testing/fuzzers",
-    "testing/tools:test_runner_py",
   ]
+
+  if (pdf_is_standalone) {
+    deps += [ "testing/tools:test_runner_py" ]
+  }
 }
 
 # Makes additional targets reachable only for "gn check". These are not always
diff --git a/testing/tools/BUILD.gn b/testing/tools/BUILD.gn
index f60f413..8815b53 100644
--- a/testing/tools/BUILD.gn
+++ b/testing/tools/BUILD.gn
@@ -2,42 +2,46 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-# Generates the list of inputs required by `test_runner.py` tests.
-action("test_runner_py") {
-  testonly = true
+import("../../pdfium.gni")
 
-  write_runtime_deps = "${root_out_dir}/${target_name}.runtime_deps"
+if (pdf_is_standalone) {
+  # Generates the list of inputs required by `test_runner.py` tests.
+  action("test_runner_py") {
+    testonly = true
 
-  sources = [ write_runtime_deps ]
-  outputs = [ "${root_out_dir}/${target_name}.json" ]
+    write_runtime_deps = "${root_out_dir}/${target_name}.runtime_deps"
 
-  script = "generate_cas_paths.py"
-  args = [
-           "--root",
-           rebase_path("../..", root_build_dir),
-         ] + rebase_path(sources + outputs, root_build_dir)
+    sources = [ write_runtime_deps ]
+    outputs = [ "${root_out_dir}/${target_name}.json" ]
 
-  # Unbuilt runtime dependencies.
-  data = [
-    ".",
-    "../SUPPRESSIONS",
-    "../SUPPRESSIONS_EXACT_MATCHING",
-    "../SUPPRESSIONS_IMAGE_DIFF",
-    "../corpus/",
-    "../../.vpython3",
-    "../../build/skia_gold_common/",
-    "../../build/util/lib/",
-    "../../third_party/test_fonts/",
-    "../../tools/resultdb/",
-    "../../tools/skia_goldctl/",
-  ]
+    script = "generate_cas_paths.py"
+    args = [
+             "--root",
+             rebase_path("../..", root_build_dir),
+           ] + rebase_path(sources + outputs, root_build_dir)
 
-  # Built runtime dependencies.
-  data_deps = [
-    "../../:pdfium_diff",
-    "../../samples:pdfium_test",
-  ]
+    # Unbuilt runtime dependencies.
+    data = [
+      ".",
+      "../SUPPRESSIONS",
+      "../SUPPRESSIONS_EXACT_MATCHING",
+      "../SUPPRESSIONS_IMAGE_DIFF",
+      "../corpus/",
+      "../../.vpython3",
+      "../../build/skia_gold_common/",
+      "../../build/util/lib/",
+      "../../third_party/test_fonts/",
+      "../../tools/resultdb/",
+      "../../tools/skia_goldctl/",
+    ]
 
-  # Force `data_deps` to be built before this target, rather than in parallel.
-  deps = data_deps
+    # Built runtime dependencies.
+    data_deps = [
+      "../../:pdfium_diff",
+      "../../samples:pdfium_test",
+    ]
+
+    # Force `data_deps` to be built before this target, rather than in parallel.
+    deps = data_deps
+  }
 }