| # 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. |
| |
| # Tests that no changes have been made to local JSON schemas. |
| # |
| # Parameters |
| # |
| # golden (required) |
| # A list of golden JSON schema files. |
| # |
| # current (required) |
| # A list of local JSON schema files. |
| # |
| template("verify_json_schemas") { |
| assert(defined(invoker.golden), "golden directory is required") |
| assert(defined(invoker.current), "current directory is required") |
| |
| # Run the test. |
| action(target_name) { |
| forward_variables_from(invoker, "*", [ "policy" ]) |
| |
| script = "//sdk/ctf/build/scripts/verify_json_schemas.py" |
| stamp_file = "$target_gen_dir/$target_name.verified" |
| |
| rebased_goldens = [] |
| foreach(file, golden) { |
| rebased_goldens += [ rebase_path(file, root_build_dir) ] |
| } |
| |
| rebased_currents = [] |
| foreach(file, current) { |
| rebased_currents += [ rebase_path(file, root_build_dir) ] |
| } |
| |
| inputs = [] |
| inputs += golden |
| inputs += current |
| |
| outputs = [ stamp_file ] |
| |
| args = [ "--golden" ] |
| args += rebased_goldens |
| args += [ "--current" ] |
| args += rebased_currents |
| args += [ "--stamp" ] |
| args += [ rebase_path(stamp_file, root_build_dir) ] |
| } |
| } |