| # Copyright 2018 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/toolchain.gni") |
| import("//build/json/validate_json.gni") |
| import("//build/python/python_host_test.gni") |
| import("//build/toolchain/basic_toolchain.gni") |
| |
| basic_toolchain("fidling") { |
| expected_label = fidl_toolchain |
| } |
| |
| # A generated file that lists fidl sdk files |
| generated_file("sdk_fidl") { |
| deps = [ "//sdk/fidl" ] |
| outputs = [ "$root_build_dir/sdk_fidl_json.json" ] |
| data_keys = [ "sdk_fidl_json_data" ] |
| output_conversion = "json" |
| } |
| |
| # A generated file that lists all of the .fidl.json files. |
| generated_file("all_fidl_json") { |
| testonly = true |
| deps = [ "//:default" ] |
| |
| outputs = [ "$root_build_dir/all_fidl_json.txt" ] |
| data_keys = [ "fidl_json" ] |
| } |
| |
| # Generates a fidl_project.json file. |
| # fidl_project.json is a declarative file that lists FIDL libraries and their |
| # constituent files, dependencies, and build artifacts. It is used by the FIDL |
| # LSP Language Server to compile FIDL libraries. |
| action("gen_fidl_project") { |
| testonly = true |
| script = "//scripts/generate-fidl-project.py" |
| deps = [ "//:generated_sources" ] |
| |
| _input = "$root_build_dir/generated_sources.json" |
| _output = "$root_build_dir/fidl_project.json" |
| |
| inputs = [ _input ] |
| outputs = [ _output ] |
| |
| args = [ |
| rebase_path("//", root_build_dir), |
| rebase_path(_input, root_build_dir), |
| rebase_path(_output, root_build_dir), |
| ] |
| } |
| |
| validate_json("validate_fidl_project_json") { |
| testonly = true |
| data = "$root_build_dir/fidl_project.json" |
| schema = "//scripts/fidl_project_schema.json" |
| deps = [ ":gen_fidl_project" ] |
| } |
| |
| normalize_test_stamp = "$target_gen_dir/normalize_unittest.stamp" |
| action("normalize_unittest") { |
| testonly = true |
| script = "normalize_unittest.py" |
| inputs = [ "normalize.py" ] |
| outputs = [ normalize_test_stamp ] |
| args = [ |
| "--stamp", |
| rebase_path(normalize_test_stamp, root_build_dir), |
| ] |
| } |
| |
| if (is_host) { |
| python_host_test("gen_fidldocs_test") { |
| main_source = "gen_fidldocs_test.py" |
| sources = [ "gen_fidldocs.py" ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":gen_fidldocs_test($host_toolchain)", |
| ":normalize_unittest", |
| ] |
| } |