blob: d1e9bd870a2e4c11a07677d2db84cb9365edcc70 [file] [log] [blame]
# 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/bazel/bazel_inputs.gni")
import("//build/components.gni")
import("//build/components/fuchsia_package_archive.gni")
import("//build/rust/rustc_binary.gni")
rustc_binary("element_manager_bin") {
name = "element_manager"
with_unit_tests = true
edition = "2021"
deps = [
":element_config",
"//sdk/fidl/fuchsia.component:fuchsia.component_rust",
"//sdk/fidl/fuchsia.element:fuchsia.element_rust",
"//sdk/fidl/fuchsia.element:fuchsia.element_rust",
"//sdk/fidl/fuchsia.mem:fuchsia.mem_rust",
"//sdk/fidl/fuchsia.ui.app:fuchsia.ui.app_rust",
"//sdk/fidl/fuchsia.ui.scenic:fuchsia.ui.scenic_rust",
"//src/lib/async-utils",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/ui/fuchsia-scenic",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/session/lib/realm_management",
"//src/sys/lib/fidl-connector",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:derivative",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:tracing",
]
test_deps = [
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//src/lib/test_util",
"//src/session/testing",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:maplit",
]
sources = [
"src/annotation.rs",
"src/element.rs",
"src/element_manager.rs",
"src/main.rs",
]
}
fuchsia_component_manifest("manifest") {
component_name = "element_manager"
manifest = "meta/element_manager.cml"
}
fuchsia_structured_config_rust_lib("element_config") {
cm_label = ":manifest"
}
fuchsia_structured_config_values("sc_values") {
cm_label = ":manifest"
values = {
url_to_collection = []
default_collection = "elements"
}
}
fuchsia_component("element_manager_comp") {
cm_label = ":manifest"
deps = [ ":element_manager_bin" ]
}
fuchsia_package("element_manager") {
deps = [
":element_manager_comp",
":sc_values",
]
}
# Make `element_manager` available to products assembed with Bazel.
#
# TODO(fxbug.dev/122492): Make this less verbose.
fuchsia_package_archive("element_manager_archive") {
package = ":element_manager"
}
bazel_input_resource("element_manager_bazel_inputs") {
deps = [ ":element_manager_archive" ]
sources = get_target_outputs(":element_manager_archive")
outputs = [ "{{source_file_part}}" ]
}
# TODO(fxbug.dev/117065): Remove this once parents can configure their children.
fuchsia_structured_config_values("sc_values_gazelle") {
cm_label = ":manifest"
values = {
url_to_collection = [
"fuchsia-pkg://fuchsia.com/shell_settings#meta/shell_settings.cm|shell_settings",
"fuchsia-pkg://fuchsia.com/terminal#meta/terminal.cm|terminal",
]
default_collection = "elements"
}
}
fuchsia_package("element_manager_gazelle") {
deps = [
":element_manager_comp",
":sc_values_gazelle",
]
}
fuchsia_unittest_package("element_manager_tests") {
manifest = "meta/element_manager_bin_test.cml"
deps = [ ":element_manager_bin_test" ]
}