| # Copyright 2019 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. |
| |
| ########################################## |
| # Though under //zircon, this build file # |
| # is meant to be used in the Fuchsia GN # |
| # build. # |
| # See fxbug.dev/36139. # |
| ########################################## |
| |
| assert(!defined(zx) || zx != "/", |
| "This file can only be used in the Fuchsia GN build.") |
| |
| import("//build/test.gni") |
| import("//zircon/tools/fidl/testdata/info.gni") |
| |
| # The generation depends only on the source, so do it only once. |
| if (current_toolchain == default_toolchain) { |
| action("gen-examples") { |
| visibility = [ ":examples" ] |
| outputs = [ "$target_gen_dir/examples.cc" ] |
| script = "gen-examples.sh" |
| sources = [ |
| "testdata/badformat.fidl.noformat", |
| "testdata/goodformat.test.fidl", |
| ] |
| foreach(info, fidl_testdata_info) { |
| # Only use the standalone libraries since they have predictable filenames. |
| if (get_label_info(info.target, "dir") == |
| "//zircon/tools/fidl/testdata") { |
| sources += [ "//zircon/tools/fidl/testdata/${info.name}.test.fidl" ] |
| } |
| } |
| args = rebase_path(outputs, root_build_dir) + |
| rebase_path(sources, root_build_dir) |
| } |
| } else { |
| test("fidl-compiler") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| sources = [ |
| "alias_tests.cc", |
| "array_tests.cc", |
| "attributes_tests.cc", |
| "bits_tests.cc", |
| "c_generator_tests.cc", |
| "canonical_names_tests.cc", |
| "coded_types_generator_tests.cc", |
| "consts_tests.cc", |
| "declaration_order_tests.cc", |
| "enums_tests.cc", |
| "errors_tests.cc", |
| "flat_ast_tests.cc", |
| "flexible_tests.cc", |
| "formatter_tests.cc", |
| "handle_tests.cc", |
| "json_diagnostics_tests.cc", |
| "json_findings_tests.cc", |
| "lint_findings_tests.cc", |
| "lint_tests.cc", |
| "ordinals_tests.cc", |
| "parsing_tests.cc", |
| "protocol_tests.cc", |
| "recoverable_compilation_tests.cc", |
| "recoverable_parsing_tests.cc", |
| "recursion_detector_tests.cc", |
| "reporter_tests.cc", |
| "resource_tests.cc", |
| "resourceness_tests.cc", |
| "service_tests.cc", |
| "span_tests.cc", |
| "strictness_tests.cc", |
| "structs_tests.cc", |
| "table_tests.cc", |
| "type_alias_tests.cc", |
| "types_tests.cc", |
| "typeshape_tests.cc", |
| "union_tests.cc", |
| "using_tests.cc", |
| "utils_tests.cc", |
| "virtual_source_tests.cc", |
| "visitor_unittests.cc", |
| ] |
| deps = [ |
| ":examples", |
| "//third_party/boringssl", |
| "//zircon/public/lib/zxtest", |
| "//zircon/tools/fidl:fidl", |
| ] |
| } |
| |
| source_set("examples") { |
| gen_label = ":gen-examples($default_toolchain)" |
| gen_dir = get_label_info(gen_label, "target_gen_dir") |
| include_dirs = [ "." ] |
| sources = [ "$gen_dir/examples.cc" ] |
| deps = [ gen_label ] |
| } |
| } |