| # 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/components.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_fuzzer.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/rust/rustc_staticlib.gni") |
| |
| group("bind") { |
| deps = [ ":lib" ] |
| } |
| |
| rustc_staticlib("bind-lib") { |
| name = "bind_lib_c" |
| version = "0.1.0" |
| with_unit_tests = true |
| edition = "2018" |
| |
| public = [ "ffi_bindings.h" ] |
| |
| deps = [ |
| ":lib", |
| "//third_party/rust_crates:libc", |
| ] |
| |
| source_root = "src/ffi.rs" |
| |
| sources = [ "src/ffi.rs" ] |
| } |
| |
| rustc_binary("bin") { |
| name = "bind" |
| edition = "2018" |
| |
| with_unit_tests = true |
| |
| deps = [ |
| ":lib", |
| "//sdk/fidl/fuchsia.device.manager:fuchsia.device.manager-rustc", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:structopt", |
| ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| rustc_library("lib") { |
| name = "bind" |
| edition = "2018" |
| |
| with_unit_tests = true |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.device.manager:fuchsia.device.manager-rustc", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:bitfield", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:nom", |
| "//third_party/rust_crates:nom_locate", |
| "//third_party/rust_crates:num-derive", |
| "//third_party/rust_crates:num-traits", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:valico", |
| ] |
| |
| sources = [ |
| "src/bind_library.rs", |
| "src/bind_program.rs", |
| "src/bind_program_v2_constants.rs", |
| "src/bytecode_common.rs", |
| "src/compiler.rs", |
| "src/ddk_bind_constants.rs", |
| "src/debugger.rs", |
| "src/decoded_bind_program.rs", |
| "src/dependency_graph.rs", |
| "src/device_specification.rs", |
| "src/encode_bind_program_v1.rs", |
| "src/encode_bind_program_v2.rs", |
| "src/errors.rs", |
| "src/instruction.rs", |
| "src/lib.rs", |
| "src/linter.rs", |
| "src/match_bind.rs", |
| "src/offline_debugger.rs", |
| "src/parser_common.rs", |
| "src/test.rs", |
| ] |
| inputs = [ "tests_schema.json" ] |
| } |
| |
| rustc_fuzzer("bind_rules_bytecode_fuzzer") { |
| source_root = "src/bytecode_fuzzer.rs" |
| sources = [ "src/bytecode_fuzzer.rs" ] |
| deps = [ ":lib" ] |
| } |
| |
| rustc_fuzzer("instruction_section_fuzzer") { |
| source_root = "src/bytecode_section_fuzzer.rs" |
| sources = [ "src/bytecode_section_fuzzer.rs" ] |
| deps = [ ":lib" ] |
| } |
| |
| rustc_fuzzer("symbol_table_section_fuzzer") { |
| source_root = "src/bytecode_section_fuzzer.rs" |
| sources = [ "src/bytecode_section_fuzzer.rs" ] |
| deps = [ ":lib" ] |
| } |
| |
| fuzzers_package("bind-fuzzers") { |
| rust_fuzzers = [ |
| ":bind_rules_bytecode_fuzzer", |
| ":instruction_section_fuzzer", |
| ":symbol_table_section_fuzzer", |
| ] |
| } |
| |
| fuchsia_unittest_package("bind_tests") { |
| manifest = "meta/bind_tests.cmx" |
| deps = [ ":lib_test" ] |
| test_specs = { |
| environments = basic_envs |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":bind-fuzzers", |
| ":bind_tests", |
| ] |
| } |
| |
| fuchsia_package_with_single_component("bind_debugger") { |
| deps = [ ":bin" ] |
| manifest = "meta/bind.cmx" |
| } |