| # 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. |
| |
| # The generation depends only on the source, so do it only once. |
| if (current_toolchain == default_toolchain) { |
| action("gen-examples") { |
| visibility = [ ":examples" ] |
| examples_dir = "$zx/tools/fidl/examples" |
| outputs = [ |
| "$target_gen_dir/examples.cc", |
| ] |
| sources = [ |
| "$examples_dir/alignment.test.fidl", |
| "$examples_dir/bits.test.fidl", |
| "$examples_dir/empty.test.fidl", |
| "$examples_dir/empty_struct.test.fidl", |
| "$examples_dir/enums.test.fidl", |
| "$examples_dir/errors.test.fidl", |
| "$examples_dir/events.test.fidl", |
| "$examples_dir/example-0.test.fidl", |
| "$examples_dir/example-1.test.fidl", |
| "$examples_dir/example-10.test.fidl", |
| "$examples_dir/example-2.test.fidl", |
| "$examples_dir/example-3.test.fidl", |
| "$examples_dir/example-4.test.fidl", |
| "$examples_dir/example-5.test.fidl", |
| "$examples_dir/example-6.test.fidl", |
| "$examples_dir/example-7.test.fidl", |
| "$examples_dir/example-8.test.fidl", |
| "$examples_dir/example-9.test.fidl", |
| "$examples_dir/library-a/point.test.fidl", |
| "$examples_dir/library-b/view.test.fidl", |
| "$examples_dir/protocol-ordinals.test.fidl", |
| "$examples_dir/simple.test.fidl", |
| "$examples_dir/tables.test.fidl", |
| "$examples_dir/test.test.fidl", |
| "$examples_dir/types.test.fidl", |
| "$examples_dir/xunion.test.fidl", |
| "testdata/badformat.fidl.noformat", |
| "testdata/doc_comments.test.fidl", |
| "testdata/goodformat.test.fidl", |
| ] |
| script = "gen-examples.sh" |
| args = rebase_path(outputs, root_build_dir) + |
| rebase_path(sources, root_build_dir) |
| } |
| } else { |
| zx_test("fidl-compiler") { |
| sources = [ |
| "array_tests.cc", |
| "attributes_tests.cc", |
| "bits_tests.cc", |
| "coded_types_generator_tests.cc", |
| "consts_tests.cc", |
| "declaration_order_tests.cc", |
| "enums_tests.cc", |
| "errors_tests.cc", |
| "flat_ast_tests.cc", |
| "formatter_tests.cc", |
| "json_findings_tests.cc", |
| "json_generator_tests.cc", |
| "lint_findings_tests.cc", |
| "lint_tests.cc", |
| "main.cc", |
| "ordinals_tests.cc", |
| "parsing_tests.cc", |
| "protocol_tests.cc", |
| "recursion_detector_tests.cc", |
| "service_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", |
| "xunion_tests.cc", |
| ] |
| deps = [ |
| ":examples", |
| "$zx/system/ulib/unittest", |
| "$zx/system/ulib/zxtest", |
| "$zx/third_party/ulib/uboringssl", |
| "$zx/tools/fidl", |
| ] |
| public_configs = [ "$zx/public/gn/config:Wno-unused-function" ] |
| } |
| |
| 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, |
| ] |
| } |
| } |