| # 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. |
| |
| import("$zx/public/gn/host_tool_action.gni") |
| |
| if (defined(zx)) { |
| config("kazoo_config") { |
| visibility = [ ":*" ] |
| include_dirs = [ rebase_path("../..") ] |
| |
| # rapidjson is header-only, but sets these defines from its build file. We |
| # can't depend on it directly until build unification. |
| defines = [ |
| "RAPIDJSON_HAS_STDSTRING", |
| "RAPIDJSON_HAS_CXX11_RANGE_FOR", |
| "RAPIDJSON_HAS_CXX11_RVALUE_REFS", |
| "RAPIDJSON_HAS_CXX11_TYPETRAITS", |
| "RAPIDJSON_HAS_CXX11_NOEXCEPT", |
| ] |
| include_dirs += [ "$zx/../third_party/rapidjson/include" ] |
| } |
| |
| zx_library("kazoo_lib") { |
| host = true |
| |
| configs += [ ":kazoo_config" ] |
| |
| sources = [ |
| "alias_workaround.cc", |
| "alias_workaround.h", |
| "c_ulib_header_output.cc", |
| "category_output.cc", |
| "cdecl_output.cc", |
| "go_syscalls_output.cc", |
| "go_vdso_output.cc", |
| "json_output.cc", |
| "kernel_wrappers_output.cc", |
| "ktrace_output.cc", |
| "output_util.cc", |
| "output_util.h", |
| "outputs.h", |
| "rust_output.cc", |
| "string_util.cc", |
| "string_util.h", |
| "syscall_library.cc", |
| "syscall_library.h", |
| "syscall_numbers_output.cc", |
| "writer.cc", |
| "writer.h", |
| ] |
| |
| deps = [ "$zx/system/public" ] |
| } |
| |
| zx_host_tool("kazoo") { |
| configs += [ ":kazoo_config" ] |
| |
| sources = [ "main.cc" ] |
| |
| deps = [ |
| ":kazoo_lib", |
| "$zx/system/ulib/cmdline", |
| ] |
| } |
| |
| zx_test("tests") { |
| configs += [ ":kazoo_config" ] |
| output_name = "kazoo-test" |
| |
| deps = [ |
| ":generate_test_files", |
| ":kazoo_lib", |
| ] |
| |
| # The "../.." is so that the generated files can be included with a |
| # "tools/kazoo/" prefix. |
| include_dirs = [ "$target_gen_dir/../.." ] |
| |
| sources = [ |
| "alias_workaround_test.cc", |
| "c_ulib_header_output_test.cc", |
| "category_output_test.cc", |
| "cdecl_output_test.cc", |
| "go_syscalls_output_test.cc", |
| "go_vdso_output_test.cc", |
| "json_output_test.cc", |
| "kernel_wrappers_output_test.cc", |
| "ktrace_output_test.cc", |
| "output_util_test.cc", |
| "rust_output_test.cc", |
| "string_util_test.cc", |
| "syscall_library_test.cc", |
| "syscall_numbers_output_test.cc", |
| "test_main.cc", |
| "writer_test.cc", |
| ] |
| } |
| |
| host_tool_action_foreach("test_files_fidl_to_json") { |
| tool = "$zx/tools/fidl:fidlc" |
| |
| args = [ |
| "--json", |
| rebase_path("$target_gen_dir") + "/{{source_name_part}}.json", |
| "--files", |
| "{{source}}", |
| ] |
| |
| outputs = [ "$target_gen_dir/{{source_name_part}}.json" ] |
| |
| sources = [ |
| "test_aliases.test.fidl", |
| "test_go_nonblocking.test.fidl", |
| "test_go_reserved_words.test.fidl", |
| "test_kernel_cases.test.fidl", |
| "test_kernelwrappers.test.fidl", |
| "test_no_methods.test.fidl", |
| "test_one_protocol_one_method.test.fidl", |
| "test_one_protocol_two_methods.test.fidl", |
| "test_one_protocol_two_methods_with_internal.test.fidl", |
| "test_out_voidptr.test.fidl", |
| "test_ownership_annotations.test.fidl", |
| "test_pointers_and_vectors.test.fidl", |
| "test_rights_specs.test.fidl", |
| "test_rust_selection.test.fidl", |
| "test_selection.test.fidl", |
| "test_ulib_bits.test.fidl", |
| "test_ulib_enums.test.fidl", |
| "test_ulib_tables.test.fidl", |
| "test_ulib_type_aliases.test.fidl", |
| "test_various_categories.test.fidl", |
| "test_vdsowrappers.test.fidl", |
| ] |
| } |
| |
| action_foreach("generate_test_files") { |
| script = "fidl_to_h.py" |
| |
| deps = [ ":test_files_fidl_to_json" ] |
| |
| args = [ |
| "{{source}}", |
| rebase_path("$target_gen_dir") + "/test_ir_{{source_name_part}}.h", |
| "{{source_name_part}}", |
| ] |
| |
| outputs = [ "$target_gen_dir/test_ir_{{source_name_part}}.h" ] |
| |
| sources = get_target_outputs(":test_files_fidl_to_json") |
| } |
| } |