| # 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("//sdk/config.gni") |
| |
| import("//build/sdk/config.gni") |
| |
| # Verifies that the contents of the IDK have not changed. |
| # |
| # Parameters |
| # |
| # golden (required) |
| # Path to the golden file listing the current IDK contents. |
| # |
| # idk_exported_label (required) |
| # Label for the `idk` build rule. |
| # |
| # idk_name (required) |
| # Name of the IDK, i.e., the directory name under $root_build_dir/sdk/exported |
| # |
| # inherit_golden (optional) |
| # Path to a golden file that `golden` can be thought of as "extending". The |
| # golden file we compare to will effectively be the concatenation of `golden` |
| # and `inherit_golden`, if the latter is supplied. |
| # |
| template("sdk_final_manifest_golden") { |
| assert(defined(invoker.golden), "Must provide path to golden file") |
| assert(defined(invoker.idk_exported_label), |
| "Must provide GN label for the final IDK") |
| assert(defined(invoker.idk_name), "Must provide the name of the IDK") |
| |
| action(target_name) { |
| forward_variables_from(invoker, [ "testonly" ]) |
| |
| script = "//build/sdk/verify_final_manifest.py" |
| |
| _manifest_path = |
| "$root_build_dir/sdk/exported/${invoker.idk_name}/meta/manifest.json" |
| inputs = [ _manifest_path ] |
| args = [ |
| "--manifest", |
| rebase_path(_manifest_path, root_build_dir), |
| ] |
| |
| inputs += [ invoker.golden ] |
| args += [ |
| "--golden", |
| rebase_path(invoker.golden, root_build_dir), |
| ] |
| |
| if (defined(invoker.inherit_golden)) { |
| inputs += [ invoker.inherit_golden ] |
| args += [ |
| "--inherit_golden", |
| rebase_path(invoker.inherit_golden, root_build_dir), |
| ] |
| } |
| |
| if (!sdk_cross_compile_host_tools) { |
| args += [ |
| "--only_verify_host_tools_for_cpu", |
| host_cpu, |
| ] |
| } |
| |
| outputs = [ "$target_gen_dir/${target_name}.updated_golden" ] |
| args += [ |
| "--updated_golden", |
| rebase_path(outputs[0], root_build_dir), |
| ] |
| |
| args += [ |
| "--label", |
| get_label_info(":${target_name}", "label_with_toolchain"), |
| ] |
| |
| deps = [ invoker.idk_exported_label ] |
| } |
| } |