| # Copyright 2022 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/components/fuchsia_test_component.gni") |
| import("//build/fuzzing/internal/fuchsia_fuzzer_component_manifest.gni") |
| |
| # Creates a component for a library fuzzer. |
| # |
| # The component created by this template correspond to the binary created by an invocation of |
| # `fuchsia_library_fuzzer`. |
| # |
| # Parameters: |
| # Same as `fuchsia_test_component`, except for `manifest`: |
| # manifest (optional) |
| # [path] The component manifest. Only CML manifests are supported. If omitted, the template |
| # will generate a manifest using metadata added by `fuchsia_library_fuzzer` deps. |
| # |
| template("fuchsia_fuzzer_component") { |
| if (current_toolchain == default_toolchain) { |
| if (defined(invoker.manifest)) { |
| manifest = invoker.manifest |
| manifest_deps = [] |
| } else { |
| manifest_target = "${target_name}_manifest" |
| fuchsia_fuzzer_component_manifest(manifest_target) { |
| deps = invoker.deps |
| } |
| manifest = get_target_outputs(":$manifest_target") |
| manifest = manifest[0] |
| manifest_deps = [ ":$manifest_target" ] |
| } |
| fuchsia_test_component(target_name) { |
| manifest = manifest |
| deps = [] |
| forward_variables_from(invoker, |
| "*", |
| [ |
| "manifest", |
| "visibility", |
| ]) |
| forward_variables_from(invoker, [ "visibility" ]) |
| deps += manifest_deps |
| } |
| } else { |
| group(target_name) { |
| testonly = true |
| forward_variables_from(invoker, [ "visibility" ]) |
| deps = [ ":$target_name($default_toolchain)" ] |
| } |
| not_needed(invoker, "*") |
| } |
| } |