| # Copyright 2021 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/drivers/driver_manifest.gni") |
| import("//build/drivers/fuchsia_driver_package.gni") |
| import("//build/rust/rustc_binary.gni") |
| |
| group("driver-index") { |
| deps = [ ":package" ] |
| } |
| |
| group("bootfs") { |
| deps = [ ":component" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":driver-index-unittests" ] |
| } |
| |
| rustc_binary("bin") { |
| edition = "2021" |
| output_name = "driver_index" |
| |
| configs += [ "//build/config/rust:bootfs" ] |
| |
| # Generates a GN target for unit-tests with the label `bin_test`, and |
| # a binary named `driver_index_bin_test`. |
| with_unit_tests = true |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot-rustc", |
| "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl-rustc", |
| "//sdk/fidl/fuchsia.data:fuchsia.data-rustc", |
| "//sdk/fidl/fuchsia.driver.development:fuchsia.driver.development-rustc", |
| "//sdk/fidl/fuchsia.driver.framework:fuchsia.driver.framework-rustc", |
| "//sdk/fidl/fuchsia.driver.index:fuchsia.driver.index-rustc", |
| "//sdk/fidl/fuchsia.driver.registrar:fuchsia.driver.registrar-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg-rustc", |
| "//src/devices/lib/bind:lib", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/fuchsia-url", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/lib/cm_rust", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:url", |
| ] |
| |
| sources = [ |
| "src/device_group.rs", |
| "src/main.rs", |
| "src/match_common.rs", |
| "src/package_resolver.rs", |
| "src/resolved_driver.rs", |
| ] |
| } |
| |
| fuchsia_component("component") { |
| component_name = "driver-index" |
| manifest = "meta/driver-index.cml" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_package("package") { |
| package_name = "driver-index" |
| deps = [ ":component" ] |
| } |
| |
| fuchsia_driver("fake-driver") { |
| } |
| |
| driver_bind_rules("test-bind") { |
| rules = "test.bind" |
| } |
| |
| fuchsia_driver_component("test-bind-component") { |
| deps = [ |
| ":fake-driver", |
| ":test-bind", |
| ] |
| colocate = true |
| info = "test-bind-component-info.json" |
| } |
| |
| fuchsia_driver("fake-driver2") { |
| } |
| |
| driver_bind_rules("test-bind2") { |
| rules = "test2.bind" |
| } |
| |
| fuchsia_driver_component("test-bind2-component") { |
| deps = [ |
| ":fake-driver2", |
| ":test-bind2", |
| ] |
| info = "test-bind2-component-info.json" |
| } |
| |
| fuchsia_driver("fake-fallback-driver") { |
| } |
| |
| driver_bind_rules("test-fallback-bind") { |
| rules = "test-fallback.bind" |
| } |
| |
| fuchsia_driver_component("test-fallback-component") { |
| deps = [ |
| ":fake-fallback-driver", |
| ":test-fallback-bind", |
| ] |
| info = "test-fallback-component-info.json" |
| is_v1_driver = false |
| fallback = true |
| } |
| |
| driver_manifest("driver-manifest") { |
| manifest_name = "base-driver-manifest.json" |
| install_as_config_resource = true |
| package_url = "fuchsia-pkg://fuchsia.com/driver-index-unittests" |
| deps = [ |
| ":test-bind-component", |
| ":test-bind2-component", |
| ":test-fallback-component", |
| ] |
| } |
| |
| # Run with `fx test driver-index-unittests`. |
| fuchsia_unittest_package("driver-index-unittests") { |
| manifest = "meta/driver-index-unittests.cml" |
| deps = [ |
| ":bin_test", |
| ":driver-manifest", |
| ":test-bind-component", |
| ":test-bind2-component", |
| ":test-fallback-component", |
| ] |
| } |