| # 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. |
| |
| import("//build/compiled_action.gni") |
| |
| # Generate the transfer manifest of a given product bundle. |
| # This actually outputs four different files: |
| # |
| # all_blobs.json |
| # targets.json |
| # images.json |
| # transfer.json |
| # |
| # Arguments: |
| # product_bundle_target: (required) |
| # Target generating the product bundle. |
| # Type: GN label string. |
| # |
| # product_bundir_dir: (required) |
| # Input product bundle directory. |
| # Type: GN path string. |
| # |
| # outputs: (required) |
| # The usual GN meaning. Must be a singleton list. |
| # Type: GN path string. |
| # |
| # testonly, visibility |
| # Usual GN meaning. |
| # |
| template("product_bundle_transfer_manifest") { |
| assert( |
| defined(invoker.outputs), |
| "product_bundle_transfer_manifest(${target_name}) must define `outputs`") |
| _product_bundle_dir = invoker.product_bundle_dir |
| _product_bundle_target = invoker.product_bundle_target |
| |
| compiled_action(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "outputs", |
| "testonly", |
| "visibility", |
| ]) |
| |
| assert(outputs != [], "no outputs defined") |
| assert(outputs == [ outputs[0] ], "too many outputs defined") |
| |
| tool = "//tools/pbtool" |
| |
| # Constructing the transfer manifest requires walking the TUF metadata and |
| # reading meta.fars from the blobs directory. Determining exactly which |
| # files are read is quite difficult, therefore we ignore some entire |
| # directories. |
| hermetic_action_ignored_prefixes = [ |
| "${_product_bundle_dir}/blobs", |
| "${_product_bundle_dir}/repository", |
| "${_product_bundle_dir}/recovery_repository", |
| "${_product_bundle_dir}/virtual_devices", |
| ] |
| |
| deps = [ _product_bundle_target ] |
| inputs = [ "${_product_bundle_dir}/product_bundle.json" ] |
| |
| args = [ |
| "generate-transfer-manifest", |
| "--product-bundle", |
| rebase_path(_product_bundle_dir, root_build_dir), |
| "--output", |
| rebase_path(outputs[0], root_build_dir), |
| ] |
| } |
| } |