blob: b7e441909692426218b05192d3ba7080304f4c1f [file] [log] [blame]
# Copyright 2020 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/sdk/sdk_host_tool.gni")
import("//build/testing/golden_files.gni")
import("//tools/fidl/fidlc/testdata/info.gni")
source_set("lib") {
sources = [
"src/attribute_schema.cc",
"src/attributes.cc",
"src/availability_step.cc",
"src/compile_step.cc",
"src/compiler.cc",
"src/constraints.cc",
"src/consume_step.cc",
"src/diagnostic_types.cc",
"src/diagnostics_json.cc",
"src/experimental_flags.cc",
"src/findings_json.cc",
"src/flat_ast.cc",
"src/formatter.cc",
"src/index_json_generator.cc",
"src/json_generator.cc",
"src/lexer.cc",
"src/linter.cc",
"src/linting_tree_callbacks.cc",
"src/name.cc",
"src/names.cc",
"src/parser.cc",
"src/raw_ast.cc",
"src/reference.cc",
"src/replacement_step.cc",
"src/reporter.cc",
"src/resolve_step.cc",
"src/source_file.cc",
"src/source_manager.cc",
"src/source_span.cc",
"src/span_sequence.cc",
"src/span_sequence_tree_visitor.cc",
"src/template_string.cc",
"src/transport.cc",
"src/tree_visitor.cc",
"src/type_resolver.cc",
"src/type_shape_step.cc",
"src/types.cc",
"src/typespace.cc",
"src/utils.cc",
"src/values.cc",
"src/verify_steps.cc",
"src/versioning_types.cc",
"src/virtual_source_file.cc",
]
public_deps = [
"//sdk/lib/fit",
"//src/lib/fxl",
"//third_party/re2",
"//zircon/system/ulib/cmdline",
]
deps = [ ":json_schema" ]
deps += [ "//third_party/boringssl" ]
visibility = [
":fidl-format",
":fidl-lint",
":fidlc",
"tests:*",
"//src/tests/benchmarks/fidl/fidlc:*",
]
}
source_set("json_schema") {
visibility = [ ":*" ]
sources = [ "$target_gen_dir/json_schema.cc" ]
deps = [ ":gen-json-schema" ]
}
action("gen-json-schema") {
visibility = [ ":json_schema" ]
outputs = [ "$target_gen_dir/json_schema.cc" ]
sources = [ "schema.json" ]
script = "gen-json-schema.sh"
args = rebase_path(outputs, root_build_dir) +
rebase_path(sources, root_build_dir)
}
group("host") {
if (current_os != "fuchsia") {
deps = [ ":fidlc" ]
}
}
if (is_host) {
executable("fidlc") {
sources = [ "cmd/fidlc/main.cc" ]
deps = [ ":lib" ]
}
executable("fidl-format") {
sources = [ "cmd/fidl-format/main.cc" ]
deps = [ ":lib" ]
}
executable("fidl-lint") {
sources = [
"cmd/fidl-lint/command_line_options.cc",
"cmd/fidl-lint/main.cc",
]
deps = [ ":lib" ]
}
sdk_host_tool("fidlc_sdk") {
category = "partner"
output_name = "fidlc"
deps = [ ":fidlc" ]
}
sdk_host_tool("fidl-format_sdk") {
category = "partner"
output_name = "fidl-format"
deps = [ ":fidl-format" ]
}
}
install_host_tools("fidl-lint.host") {
deps = [ ":fidl-lint" ]
outputs = [ "fidl-lint" ]
}
golden_files("fidlc_golden_tests") {
testonly = true
deps = []
comparisons = []
foreach(info, fidl_testdata_info) {
deps += [ "${info.target}($fidl_toolchain)" ]
comparisons += [
{
golden = "goldens/${info.name}.json.golden"
candidate = "${info.fidl_gen_dir}/${info.target_name}.fidl.json"
},
{
golden = "goldens/${info.name}.index.json.golden"
candidate = "${info.fidl_gen_dir}/${info.target_name}.fidl.index.json"
},
]
}
}
group("tests") {
testonly = true
deps = [
":fidlc_golden_tests",
"testdata:verify_files_exist",
"tests($host_toolchain)",
]
}