chromium/build/private_code_test/BUILD.gn

# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/python.gni")
import("//build_overrides/build.gni")
import("private_code_test.gni")

action("private_paths") {
  script = "list_gclient_deps.py"
  outputs = [ "$target_gen_dir/private_paths.txt" ]
  args = [
    "--source-filter",
    "chrome-internal",
    "--output",
    rebase_path(outputs[0], root_build_dir),
  ]
  inputs = [ "//../.gclient_entries" ]
}

# --collect-inputs-only requires a source_set dep or !is_component_build.
if (!is_component_build) {
  action("private_code_test_gclient_deps") {
    script = "list_gclient_deps.py"
    outputs = [ "$target_gen_dir/test_private_paths.txt" ]
    args = [
      "--source-filter",
      "v8.git",
      "--output",
      rebase_path(outputs[0], root_build_dir),
    ]
    inputs = [ "//../.gclient_entries" ]
  }

  shared_library("private_code_test_inputs") {
    deps = [ "//v8" ]
    ldflags = [ "--collect-inputs-only" ]
  }

  # Test that ensures the checker fails when it is supposed to.
  private_code_test("private_code_failure_test") {
    linker_inputs_dep = ":private_code_test_inputs"
    private_paths_dep = ":private_code_test_gclient_deps"
    private_paths_file = "$target_gen_dir/test_private_paths.txt"
    expect_failure = true
  }
}