| # 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/fidl/fidl_ir.gni") |
| import("//build/fidl/fidl_summary.gni") |
| import("//build/testing/config.gni") |
| |
| template("fidl_api_compatibility_test") { |
| assert(defined(invoker.target_api_level), "target_api_level is required") |
| assert(defined(invoker.golden), "golden is required") |
| assert(defined(invoker.current), "current is required") |
| |
| policy = "no_breaking_changes" |
| if (defined(invoker.policy)) { |
| policy = invoker.policy |
| } |
| |
| # Let command-line build args override values from target declarations. |
| if (bless_goldens) { |
| policy = "update_golden" |
| } |
| |
| # Run the test. |
| action(target_name) { |
| forward_variables_from(invoker, "*", [ "policy" ]) |
| |
| script = "//sdk/cts/build/scripts/fidl_api_compatibility_test.py" |
| stamp_file = "$target_gen_dir/$target_name.verified" |
| |
| current_summary = current |
| golden_summary = golden |
| |
| inputs = [ |
| current_summary, |
| golden_summary, |
| "//sdk/cts/build/scripts/plasa_differ.py", |
| ] |
| |
| outputs = [ stamp_file ] |
| |
| args = [ |
| "--api-level", |
| "$target_api_level", |
| "--golden", |
| rebase_path(golden_summary, root_build_dir), |
| "--current", |
| rebase_path(current_summary, root_build_dir), |
| "--stamp", |
| rebase_path(stamp_file, root_build_dir), |
| "--fidl_api_diff_path", |
| rebase_path("$root_build_dir/host_x64/fidl_api_diff", root_build_dir), |
| "--policy", |
| policy, |
| ] |
| |
| warn_on_changes = |
| defined(invoker.warn_on_changes) && invoker.warn_on_changes |
| if (warn_on_changes) { |
| args += [ "--warn_on_changes" ] |
| } |
| |
| deps += [ "//tools/fidl/fidl_api_diff:host" ] |
| } |
| } |