blob: ecab54538a67a51c685d3005b7c1a21d2e59197e [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/rust/rustc_binary.gni")
import("//src/sys/build/components.gni")
group("driver-index") {
deps = [ ":package" ]
}
group("tests") {
testonly = true
deps = [ ":driver-index-unittests" ]
}
rustc_binary("bin") {
output_name = "driver_index"
# 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.driver.framework:fuchsia.driver.framework-rustc",
"//src/devices/lib/bind:lib",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
]
sources = [ "src/main.rs" ]
}
fuchsia_component("component") {
component_name = "driver-index"
manifest = "meta/driver-index.cml"
deps = [ ":bin" ]
}
fuchsia_package("package") {
package_name = "driver-index"
deps = [ ":component" ]
}
bind_rules("test-bind") {
rules = "test.bind"
driver_url = "fuchsia-pkg://my-test-driver#meta/my-driver.cm"
output_bytecode = true
}
bind_rules("test-bind2") {
rules = "test2.bind"
driver_url = "fuchsia-pkg://my-test-driver#meta/my-driver2.cm"
output_bytecode = true
}
bind_index_metadata("drivers_for_test") {
testonly = true
deps = [
":test-bind",
":test-bind2",
]
outputs = [ "config/drivers_for_test.json" ]
}
# Run with `fx test driver-index-unittests`.
fuchsia_unittest_package("driver-index-unittests") {
manifest = "meta/driver-index-unittests.cml"
deps = [
":bin_test",
":drivers_for_test",
]
}