| # Copyright 2022 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/bind/bind.gni") | |
| import("//build/components.gni") | |
| import("//build/drivers.gni") | |
| import("//build/rust/rustc_test.gni") | |
| import("//build/test.gni") | |
| group("bindlib-codegen-test") { | |
| testonly = true | |
| deps = [ | |
| ":bindlib-codegen-rust-test-pkg", | |
| ":bindlib-codegen-test-pkg", | |
| ] | |
| } | |
| test("test") { | |
| output_name = "bindlib-codegen-test" | |
| sources = [ "bindlib-codegen-test.cc" ] | |
| deps = [ | |
| ":bindlib.codegen.testlib_cpp", | |
| ":bindlibparent.codegen.testlib_cpp", | |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", | |
| "//sdk/fidl/fuchsia.device.test:fuchsia.device.test_cpp", | |
| "//sdk/fidl/fuchsia.driver.development:fuchsia.driver.development_hlcpp", | |
| "//sdk/fidl/fuchsia.driver.test:fuchsia.driver.test_hlcpp", | |
| "//sdk/lib/async-loop:async-loop-cpp", | |
| "//sdk/lib/device-watcher/cpp", | |
| "//sdk/lib/driver_test_realm/realm_builder/cpp", | |
| "//sdk/lib/fdio", | |
| "//sdk/lib/sys/cpp", | |
| "//src/devices/bind/fuchsia:fuchsia_cpp", | |
| "//src/lib/ddk", | |
| "//src/lib/fxl", | |
| "//src/lib/fxl/test:gtest_main", | |
| "//zircon/system/ulib/fbl", | |
| ] | |
| } | |
| fuchsia_unittest_package("bindlib-codegen-test-pkg") { | |
| deps = [ | |
| ":child-driver", | |
| ":parent-driver", | |
| ":test", | |
| "//src/devices/misc/drivers/test-parent", | |
| ] | |
| } | |
| fuchsia_unittest_package("bindlib-codegen-rust-test-pkg") { | |
| deps = [ ":bindlib-codegen-rust-test" ] | |
| } | |
| bind_library("bindlibparent.codegen.testlib") { | |
| source = "testbindlib_parent.bind" | |
| } | |
| bind_library("bindlib.codegen.testlib") { | |
| source = "testbindlib.bind" | |
| public_deps = [ | |
| ":bindlibparent.codegen.testlib", | |
| "//src/devices/bind/fuchsia.pci", | |
| ] | |
| } | |
| fuchsia_driver_dml("parent-driver-dml") { | |
| dml = "meta/parent-driver.dml" | |
| driver_name = "parent-driver" | |
| } | |
| driver_bind_rules("parent-driver-bind") { | |
| bind_output = "parent-driver.bindbc" | |
| dml_label = ":parent-driver-dml" | |
| deps = [ "//src/devices/bind/fuchsia.test" ] | |
| } | |
| fuchsia_cc_driver("parent-driver-driver") { | |
| legacy = true | |
| output_name = "bindlib-codegen-parent" | |
| configs += [ | |
| "//build/config:all_source", | |
| "//build/config/fuchsia:enable_zircon_asserts", | |
| ] | |
| sources = [ "parent-driver.cc" ] | |
| deps = [ | |
| ":bindlib.codegen.testlib_cpp", | |
| ":bindlibparent.codegen.testlib_cpp", | |
| ":parent-driver-bind", | |
| "//src/devices/bind/fuchsia:fuchsia_cpp", | |
| "//src/devices/lib/driver", | |
| "//src/lib/ddk", | |
| ] | |
| } | |
| fuchsia_driver_component("parent-driver") { | |
| dml_label = ":parent-driver-dml" | |
| component_name = "bindlib-codegen-parent" | |
| deps = [ ":parent-driver-driver" ] | |
| info = "meta/parent-driver-info.json" | |
| } | |
| driver_bind_rules("child-driver-bind") { | |
| rules = "meta/child-driver.bind" | |
| deps = [ | |
| ":bindlib.codegen.testlib", | |
| ":bindlibparent.codegen.testlib", | |
| "//src/devices/bind/fuchsia.test", | |
| ] | |
| } | |
| fuchsia_cc_driver("child-driver-driver") { | |
| legacy = true | |
| output_name = "bindlib-codegen-child" | |
| configs += [ | |
| "//build/config:all_source", | |
| "//build/config/fuchsia:enable_zircon_asserts", | |
| ] | |
| sources = [ "child-driver.cc" ] | |
| deps = [ | |
| ":child-driver-bind", | |
| "//src/devices/lib/driver", | |
| "//src/lib/ddk", | |
| ] | |
| } | |
| fuchsia_driver_component("child-driver") { | |
| component_name = "bindlib-codegen-child" | |
| deps = [ ":child-driver-driver" ] | |
| info = "meta/child-driver-info.json" | |
| manifest = "meta/child-driver.cml" | |
| } | |
| rustc_test("bindlib-codegen-rust-test") { | |
| edition = "2024" | |
| testonly = true | |
| source_root = "rust_test.rs" | |
| sources = [ "rust_test.rs" ] | |
| deps = [ | |
| ":bindlib.codegen.testlib_rust", | |
| "//src/devices/bind/fuchsia.pci:fuchsia.pci_rust", | |
| "//src/lib/fuchsia", | |
| "//third_party/rust_crates:anyhow", | |
| ] | |
| } |