| # 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/python/python_action.gni") |
| |
| # Compares that the Image Assembly Config that's created by Product Assembly |
| # 'matches' that created by the 'legacy' mechanism, which uses the |
| # generated_image_assembly_config() template and GN metadata to find all the |
| # base, cache, and system pkgs, bootfs files, config data, etc. |
| # |
| # Arguments: |
| # |
| # legacy_image_assembly_config |
| # [path] This is the path to the image assembly config that is to be |
| # compared with the generated one. |
| # |
| # generated_image_assembly_config |
| # [path] This is the path to the image assembly config that's generated by |
| # product assembly. |
| # |
| # product_assembly_config [optional] |
| # [path] This is the path to the Product Assembly config that was used to |
| # make 'generated_image_assembly_config'. This is used to confirm that |
| # items in 'generated_image_assembly_config' that aren't in |
| # 'legacy_image_assembly_config' are provided by the Product Assembly |
| # config. |
| # |
| # GN Usual: |
| # deps |
| # public_deps |
| # testonly |
| # visibility |
| |
| template("compare_image_assembly_configs") { |
| python_action(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "public_deps", |
| "testonly", |
| "visibility", |
| ]) |
| |
| assert(defined(invoker.legacy_image_assembly_config), |
| "'legacy_image_assembly_config' must be defined") |
| assert(defined(invoker.generated_image_assembly_config), |
| "'generated_image_assembly_config' must be defined") |
| |
| # This reads a LOT of files to validate that the image assembly configs |
| # point to manifests for the same package (as they may have different paths |
| # but are the same merkles) |
| hermetic_deps = false |
| |
| binary_label = "//build/assembly/scripts:compare_image_assembly_configs" |
| |
| inputs = [ |
| invoker.legacy_image_assembly_config, |
| invoker.generated_image_assembly_config, |
| ] |
| outputs = [ "$target_out_dir/$target_name" ] |
| args = [ |
| "--stamp", |
| rebase_path(outputs[0], root_build_dir), |
| "--legacy-image-assembly-config", |
| rebase_path(invoker.legacy_image_assembly_config, root_build_dir), |
| "--generated-image-assembly-config", |
| rebase_path(invoker.generated_image_assembly_config, root_build_dir), |
| ] |
| |
| if (defined(invoker.product_assembly_config)) { |
| inputs += [ invoker.product_assembly_config ] |
| args += [ |
| "--product-assembly-config", |
| rebase_path(invoker.product_assembly_config, root_build_dir), |
| ] |
| } |
| } |
| } |