blob: fb2af1c1b76802c1d1777f1aa451c5db9c09fc46 [file] [log] [blame]
# 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"
depfile = "$target_gen_dir/$target_name.d"
stamp_file = "$target_gen_dir/$target_name.verified"
current_summary = current
golden_summary = golden
inputs = [ "//sdk/cts/build/scripts/plasa_differ.py" ]
outputs = [ stamp_file ]
args = [
"--depfile",
rebase_path(depfile, root_build_dir),
"--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_${host_cpu}/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" ]
}
}