blob: 6d338d48fca901ef01c7496e21b419578e2f206e [file] [log] [blame]
# 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("tests") {
testonly = true
deps = [ ":driver-index-unittests" ]
}
fuchsia_component_manifest("manifest") {
component_name = "driver-index"
manifest = "meta/driver-index.cml"
}
fuchsia_structured_config_rust_lib("driver_index_config") {
cm_label = ":manifest"
}
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 = [
":driver_index_config",
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust",
"//sdk/fidl/fuchsia.component.resolution:fuchsia.component.resolution_rust",
"//sdk/fidl/fuchsia.data:fuchsia.data_rust",
"//sdk/fidl/fuchsia.driver.development:fuchsia.driver.development_rust",
"//sdk/fidl/fuchsia.driver.framework:fuchsia.driver.framework_rust",
"//sdk/fidl/fuchsia.driver.index:fuchsia.driver.index_rust",
"//sdk/fidl/fuchsia.driver.registrar:fuchsia.driver.registrar_rust",
"//src/devices/lib/bind:lib",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-fs",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/sys/lib/cm_rust",
"//src/sys/lib/fidl-fuchsia-pkg-ext",
"//src/sys/lib/mem_util",
"//src/sys/pkg/lib/fuchsia-hash",
"//src/sys/pkg/lib/fuchsia-pkg",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:regex",
"//third_party/rust_crates:tracing",
"//third_party/rust_crates:url",
]
test_deps = [
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//sdk/fidl/fuchsia.mem:fuchsia.mem_rust",
]
sources = [
"src/composite_node_spec_manager.rs",
"src/driver_loading_fuzzer.rs",
"src/indexer.rs",
"src/load_driver.rs",
"src/main.rs",
"src/match_common.rs",
"src/resolved_driver.rs",
]
}
fuchsia_component("component") {
cm_label = ":manifest"
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",
]
info = "test-bind-component-info.json"
manifest = "meta/test-bind-component.cml"
}
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"
manifest = "meta/test-bind2-component.cml"
}
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
manifest = "meta/test-fallback-component.cml"
}
# Run with `fx test driver-index-unittests`.
fuchsia_unittest_package("driver-index-unittests") {
manifest = "meta/driver-index-unittests.cml"
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
deps = [
":bin_test",
":test-bind-component",
":test-bind2-component",
":test-fallback-component",
]
}