| # Copyright 2023 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. | |
| # Parameters | |
| # | |
| # atom_target (required) | |
| # The taret for which to generate runtime dependencies metadata. | |
| # | |
| # runtime_deps_file (required) | |
| # Path to the output file listing the runtime dependencies. | |
| # | |
| template("generate_runtime_deps") { | |
| # Collect all sdk_runtime_deps metadata entry from the dependencies of | |
| # `atom_target`. The metadata.sdk_runtime_deps list entries should be scopes | |
| # describing shared libraries, with the following schema: | |
| # | |
| # label: the GN label that defines the shared library target, including | |
| # its toolchain suffix, e.g. | |
| # '//sdk/lib/fdio:fdio(//build/toolchain/fuchsa:x64-shared)' | |
| # | |
| # source: (optional) the source path to the shared library binary, | |
| # relative to the build directory (e.g. 'x64-shared/libfdio.so'). | |
| # This MUST ONLY be set for regular shared_library() instances | |
| # (i.e. not those from sdk_shared_library()). | |
| # | |
| # sdk_id: (optional) the SDK atom id that generates the library | |
| # (e.g. '//pkg:fdio'). This MUST ONLY be set for sdk_shared_library() | |
| # targets, and not regular shared_library() ones. | |
| # | |
| generated_file(target_name) { | |
| deps = [ invoker.atom_target ] | |
| outputs = [ invoker.runtime_deps_file ] | |
| output_conversion = "json" | |
| data_keys = [ "sdk_runtime_deps" ] | |
| walk_keys = [ "sdk_runtime_deps_barrier" ] | |
| } | |
| } |