| # 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/toolchain/basic_toolchain.gni") |
| |
| assert(current_toolchain == default_toolchain) |
| |
| basic_toolchain("fidling") { |
| expected_label = fidl_toolchain |
| } |
| |
| # A generated file that lists the IR files for all FIDL libraries in the IDK |
| # (and "partner_internal" SDK category). |
| generated_file("sdk_fidl") { |
| # Ensure that the `..._sdk` target for all relevant FIDL libraries have been |
| # built since that is how `sdk_fidl_json_data` is populated. |
| 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, root_build_dir), |
| 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" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ "tests($host_toolchain)" ] |
| } |