blob: 356d3b34829280847d9c8a47793a50120728ee47 [file] [log] [blame]
# Copyright 2019 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/package.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_library.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
rustc_library("lib") {
name = "component_manager_lib"
with_unit_tests = true
edition = "2018"
# Only for internal use.
visibility = [ "//src/sys/component_manager/*" ]
deps = [
"//garnet/lib/rust/cm_fidl_translator",
"//garnet/lib/rust/cm_rust",
"//garnet/lib/rust/io_util",
"//garnet/public/lib/fidl/rust/fidl",
"//garnet/public/rust/fdio",
"//garnet/public/rust/fuchsia-async",
"//garnet/public/rust/fuchsia-component",
"//garnet/public/rust/fuchsia-runtime",
"//garnet/public/rust/fuchsia-vfs/pseudo-fs",
"//garnet/public/rust/fuchsia-zircon",
"//sdk/fidl/fuchsia.data:fuchsia.data-rustc",
"//sdk/fidl/fuchsia.data:fuchsia.data-rustc",
"//sdk/fidl/fuchsia.pkg:fuchsia.pkg-rustc",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc",
"//src/lib/process_builder",
"//src/sys/lib/fuchsia_url:fuchsia_url",
"//third_party/rust_crates:byteorder",
"//third_party/rust_crates:failure",
"//third_party/rust_crates:futures-preview",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:log",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:url",
"//third_party/rust_crates:void",
"//zircon/public/fidl/fuchsia-io:fuchsia-io-rustc",
"//zircon/public/fidl/fuchsia-ldsvc:fuchsia-ldsvc-rustc",
"//zircon/public/fidl/fuchsia-process:fuchsia-process-rustc",
# Test-only deps
"//garnet/examples/fidl/services:echo-rustc",
"//src/lib/process_builder:test-util-fidl-rustc",
]
}
rustc_binary("bin") {
name = "component_manager"
with_unit_tests = true
edition = "2018"
deps = [
":lib",
"//garnet/public/lib/fidl/rust/fidl",
"//garnet/public/rust/fuchsia-async",
"//garnet/public/rust/fuchsia-runtime",
"//garnet/public/rust/fuchsia-vfs/pseudo-fs",
"//third_party/rust_crates:failure",
"//third_party/rust_crates:futures-preview",
"//third_party/rust_crates:log",
"//zircon/public/fidl/fuchsia-io:fuchsia-io-rustc",
]
}
# This manifest is consumed by the ZBI rule in //build/images to add component_manager to bootfs.
generate_manifest("component_manager.bootfs") {
deps = [
":bin",
]
args = [ "--entry=bin/component_manager=" +
rebase_path("$root_build_dir/component_manager", root_build_dir) ]
}
deprecated_fuchsia_component("component_manager_as_v1_component") {
deps = [
":bin",
]
manifest = rebase_path("meta/component_manager.cmx")
binary = "component_manager"
}
# Note that this package and the component it contains wrap component_manager
# as a v1 Component for interactive testing purposes through the shell. This
# will eventually go away.
package("component_manager") {
components = [ ":component_manager_as_v1_component" ]
}
test_package("component_manager_tests") {
deps = [
":lib_test",
"//examples/components/basic:hello_world_bin",
"//src/lib/process_builder:root_job_test_runner",
"//src/lib/process_builder:test_util",
]
components =
[ "//garnet/examples/fidl/echo_server_rust:echo_server_rust_component" ]
tests = [
{
name = "component_manager_lib_lib_test"
dest = "component_manager_tests"
environments = basic_envs
},
{
name = "component_manager_lib_lib_test"
dest = "component_manager_boot_env_tests"
environments = basic_envs
},
]
resources = [
{
path = rebase_path("meta/component_manager_tests_invalid.cm")
dest = "component_manager_tests_invalid.cm"
},
]
meta = [
{
path = rebase_path("meta/component_manager_tests_hello_world.cml")
dest = "component_manager_tests_hello_world.cm"
},
]
binaries = [
{
name = "hello_world"
},
{
name = "process_builder_test_util"
},
{
name = "root_job_test_runner"
},
]
}