blob: 9f9cb1e56ee8b451eb947b9cf3b589d5175f68bb [file]
# 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.
assert(is_fuchsia, "component manager is for the Fuchsia toolchain only")
import("//build/assembly/bootfs_files_for_assembly.gni")
import("//build/bazel/bazel_test_suite.gni")
import("//build/component/component_id_index.gni")
import("//build/component/config.gni")
import("//build/components.gni")
import("//build/dist/renamed_binary.gni")
import("//build/rust/rustc_binary.gni")
import("//build/toolchain/concurrent_jobs.gni")
import("//tools/fidl/measure-tape/measure_tape.gni")
# LINT.IfChange(optimize-for-size)
config("optimize-for-size") {
# "opt-level=z" saves 400 KiB compared to "s" on component framework binary
# On arm64 release build, component_manager size goes from 4216440 to 3884664
# bytes.
rustflags = [
"-Copt-level=z",
"-Cpanic=abort",
]
}
# LINT.ThenChange(BUILD.bazel:optimize-for-size)
# Add the compiled manifest of the ELF runner as a dependency, such that it
# may later be included into the binary via
# `include_bytes_from_working_dir_env`.
#
# Note: get_target_outputs would have been more robust, but that function does
# not support querying targets in other toolchains. component_manager may get
# built in e.g. asan toolchain.
elf_runner_cm_out_dir =
get_label_info(":elf_runner_cm($default_toolchain)", "target_out_dir")
elf_runner_cm = "$elf_runner_cm_out_dir/cml/elf_runner_cm/elf_runner.cm"
elf_runner_cm_path = rebase_path(elf_runner_cm, root_build_dir)
dispatcher_cm_out_dir =
get_label_info(":dispatcher_cm($default_toolchain)", "target_out_dir")
dispatcher_cm = "$dispatcher_cm_out_dir/cml/dispatcher_cm/dispatcher.cm"
dispatcher_cm_path = rebase_path(dispatcher_cm, root_build_dir)
# Retained in GN because //src/performance/memory/heapdump/instrumentation:rust
# is GN-only.
rustc_binary("bin_with_tracing_and_heapdump") {
output_name = "component_manager_with_tracing_and_heapdump"
edition = "2024"
configs += [
"//build/config/rust:bootfs",
":optimize-for-size",
]
# As this is a large binary that uses many resources to compile (and takes
# minutes when LTO is enabled, shift it to the large RBE worker pool)
_concurrent_jobs = concurrent_jobs.rust_highmem
configs += _concurrent_jobs.configs
forward_variables_from(_concurrent_jobs.vars, "*")
features = [
"heapdump",
"tracing",
]
deps = [
":dispatcher_cm($default_toolchain)",
":dispatcher_config",
":elf_runner_cm($default_toolchain)",
":measure_tape_for_events",
":measure_tape_for_instance",
"lib/errors",
"lib/router_error",
"//sdk/fidl/fuchsia.boot:fuchsia.boot_rust",
"//sdk/fidl/fuchsia.component:fuchsia.component_rust",
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust",
"//sdk/fidl/fuchsia.component.internal:fuchsia.component.internal_rust",
"//sdk/fidl/fuchsia.component.resolution:fuchsia.component.resolution_rust",
"//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner_rust",
"//sdk/fidl/fuchsia.component.runtime:fuchsia.component.runtime_rust",
"//sdk/fidl/fuchsia.component.sandbox:fuchsia.component.sandbox_rust",
"//sdk/fidl/fuchsia.data:fuchsia.data_rust",
"//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust",
"//sdk/fidl/fuchsia.inspect:fuchsia.inspect_rust",
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//sdk/fidl/fuchsia.kernel:fuchsia.kernel_rust",
"//sdk/fidl/fuchsia.logger:fuchsia.logger_rust",
"//sdk/fidl/fuchsia.mem:fuchsia.mem_rust",
"//sdk/fidl/fuchsia.memory.attribution:fuchsia.memory.attribution_rust",
"//sdk/fidl/fuchsia.pkg:fuchsia.pkg_rust",
"//sdk/fidl/fuchsia.process:fuchsia.process_rust",
"//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle_rust",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2_rust",
"//sdk/fidl/fuchsia.time:fuchsia.time_rust",
"//sdk/fidl/fuchsia.tracing.provider:fuchsia.tracing.provider_rust",
"//sdk/rust/zx",
"//sdk/rust/zx-status",
"//src/devices/bin/devfs:lib",
"//src/lib/async-utils",
"//src/lib/diagnostics/inspect/runtime/rust:unchecked_includes",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/diagnostics/log/rust",
"//src/lib/directed_graph",
"//src/lib/error/clonable_error",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-fs",
"//src/lib/fuchsia-runtime",
"//src/lib/fuchsia-sync",
"//src/lib/fuchsia-url",
"//src/lib/include_bytes_from_working_dir",
"//src/lib/trace/rust:trace",
"//src/lib/trace/rust:trace-provider",
"//src/lib/versioning/version-history/rust",
"//src/lib/versioning/version-history/rust/data",
"//src/performance/memory/heapdump/instrumentation:rust",
"//src/performance/memory/scudo:rust",
"//src/power/shutdown-shim:lib",
"//src/storage/lib/vfs/rust:vfs",
"//src/sys/component_manager/lib/builtins",
"//src/sys/component_manager/lib/diagnostics",
"//src/sys/component_manager/lib/hooks",
"//src/sys/component_manager/lib/logger",
"//src/sys/component_manager/lib/serve_processargs",
"//src/sys/component_manager/lib/util",
"//src/sys/lib/capability_source",
"//src/sys/lib/cm_config",
"//src/sys/lib/cm_fidl_validator",
"//src/sys/lib/cm_graph",
"//src/sys/lib/cm_rust",
"//src/sys/lib/cm_types",
"//src/sys/lib/component_id_index",
"//src/sys/lib/config_encoder",
"//src/sys/lib/elf_runner",
"//src/sys/lib/fidl-fuchsia-component-abi-ext",
"//src/sys/lib/fuchsia-bootfs",
"//src/sys/lib/fuchsia-zbi",
"//src/sys/lib/mem_util",
"//src/sys/lib/moniker",
"//src/sys/lib/namespace",
"//src/sys/lib/routing",
"//src/sys/lib/runner",
"//src/sys/lib/runtime_capabilities",
"//src/sys/pkg/fidl/fuchsia.update.verify:fuchsia.update.verify_rust",
"//src/sys/pkg/lib/context-authenticator",
"//src/sys/pkg/lib/fuchsia-pkg",
"//src/sys/pkg/lib/package-directory",
"//src/sys/pkg/lib/system-image",
"//src/sys/service-broker:lib",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:derivative",
"//third_party/rust_crates:flyweights",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:itertools",
"//third_party/rust_crates:log",
"//third_party/rust_crates:num-traits",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:thiserror",
]
sources = [
"src/bootfs.rs",
"src/builtin/boot_controller.rs",
"src/builtin/builtin_resolver.rs",
"src/builtin/builtin_runner.rs",
"src/builtin/crash_introspect.rs",
"src/builtin/dispatcher.rs",
"src/builtin/fuchsia_boot_resolver.rs",
"src/builtin/log.rs",
"src/builtin/mod.rs",
"src/builtin/ota_health_verification.rs",
"src/builtin/realm_builder.rs",
"src/builtin/runner.rs",
"src/builtin/svc_stash_provider.rs",
"src/builtin/system_controller.rs",
"src/builtin/time.rs",
"src/builtin_environment.rs",
"src/capability.rs",
"src/framework/binder.rs",
"src/framework/capabilities.rs",
"src/framework/capability_store.rs",
"src/framework/component_sandbox_retriever.rs",
"src/framework/config_override.rs",
"src/framework/controller.rs",
"src/framework/introspector.rs",
"src/framework/lifecycle_controller.rs",
"src/framework/mod.rs",
"src/framework/namespace.rs",
"src/framework/pkg_dir.rs",
"src/framework/realm.rs",
"src/framework/realm_query.rs",
"src/framework/route_validator.rs",
"src/main.rs",
"src/model/actions/coordinator.rs",
"src/model/actions/destroy.rs",
"src/model/actions/mod.rs",
"src/model/actions/resolve.rs",
"src/model/actions/set.rs",
"src/model/actions/shutdown.rs",
"src/model/actions/start.rs",
"src/model/actions/stop.rs",
"src/model/actions/unresolve.rs",
"src/model/component/instance.rs",
"src/model/component/manager.rs",
"src/model/component/mod.rs",
"src/model/context.rs",
"src/model/escrow.rs",
"src/model/event_logger.rs",
"src/model/events/hook_observer.rs",
"src/model/events/mod.rs",
"src/model/events/use_router.rs",
"src/model/logger.rs",
"src/model/mod.rs",
"src/model/model.rs",
"src/model/namespace.rs",
"src/model/program/component_controller.rs",
"src/model/program/mod.rs",
"src/model/resolver.rs",
"src/model/routing/aggregate_router.rs",
"src/model/routing/mod.rs",
"src/model/routing/service.rs",
"src/model/start.rs",
"src/model/storage/admin_protocol.rs",
"src/model/storage/mod.rs",
"src/model/testing/echo_service.rs",
"src/model/testing/mocks.rs",
"src/model/testing/mod.rs",
"src/model/testing/out_dir.rs",
"src/model/testing/routing_test_helpers.rs",
"src/model/testing/test_helpers.rs",
"src/model/testing/test_hook.rs",
"src/model/tests/availability.rs",
"src/model/tests/config.rs",
"src/model/tests/diagnostics.rs",
"src/model/tests/dictionary.rs",
"src/model/tests/directory.rs",
"src/model/tests/lifecycle.rs",
"src/model/tests/mod.rs",
"src/model/tests/policy.rs",
"src/model/tests/rights.rs",
"src/model/tests/routing.rs",
"src/model/tests/storage.rs",
"src/model/tests/storage_admin.rs",
"src/model/token.rs",
"src/root_input_builder.rs",
"src/root_stop_notifier.rs",
"src/runner.rs",
"src/sandbox_util.rs",
"src/startup.rs",
]
inputs = [
dispatcher_cm,
elf_runner_cm,
]
rustenv = [
"DISPATCHER_CM_PATH=$dispatcher_cm_path",
"ELF_RUNNER_CM_PATH=$elf_runner_cm_path",
]
assert_no_deps = [
"//third_party/rust_crates:regex",
"//third_party/rust_crates:serde_json5($current_toolchain)",
]
exclude_toolchain_tags = [ "heapdump" ]
}
# This v2 component bundles component manager with a config suitable for running
# a nested component manager inside of realm builder.
# Retained in GN because `:component_manager_realm_builder_config` uses the
# GN-only `component_config()` template.
fuchsia_component("component-manager-realm-builder-cmp") {
testonly = true
deps = [
":bin_with_tracing",
":component_manager_realm_builder_config",
]
component_name = "component_manager"
manifest = "meta/component_manager.cml"
}
# This v2 component bundles component manager with a debug config suitable for
# running a nested component manager inside of realm builder.
# Retained in GN because `:component_id_index_for_debug_config` uses the GN-only
# `component_id_index_config()` template.
fuchsia_component("component-manager-realm-builder-debug-cmp") {
testonly = true
deps = [
":bin_with_tracing",
":component_id_index_for_debug_config",
":component_manager_realm_builder_debug_config",
]
component_name = "component_manager"
manifest = "meta/component_manager.cml"
}
# Retained in GN because `component-manager-tests` packages
# `//examples/hello_world/rust:hello-world-rust-component`, which remains in GN
# to preserve fuchsia.dev doc snippet regions in
# `examples/hello_world/rust/BUILD.gn`.
resource("component_manager_tests_invalid_manifest") {
sources = [ "meta/component_manager_tests.invalid_cm" ]
outputs = [ "meta/{{source_file_part}}" ]
}
fuchsia_test_component("model-tests-cmp") {
deps = [ ":src_model_tests" ]
component_name = "component_manager_src_model_tests"
manifest = "meta/component_manager_src_model_tests.cml"
}
fuchsia_test_component("component-manager-tests-cmp") {
deps = [ ":bin_test" ]
component_name = "component_manager_tests"
manifest = "meta/component_manager_tests.cml"
test_type = "system"
}
fuchsia_test_package("component-manager-tests") {
# Many tests generate routing errors.
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
test_components = [
":component-manager-tests-cmp",
":model-tests-cmp",
]
deps = [
":component_manager_tests_invalid_manifest",
"testing/signal_then_hang",
"tests/crash_introspect:panic_on_start",
"//examples/hello_world/rust:hello-world-rust-component",
"//src/sys/component_manager/testing/echo_server",
"//src/sys/component_manager/testing/lifecycle",
]
}
group("tests") {
testonly = true
deps = [
":bazel_tests",
":component-manager-tests",
":hermetic_tests",
"lib:non_hermetic_tests",
"tests:non_hermetic_tests",
]
}
# Included in //src/sys:tests via group("tests") above.
bazel_test_suite("bazel_tests") {
target_tests =
[ "//src/sys/component_manager:component_manager_target_tests" ]
}
# Included in //src/sys:tests (via group("tests") -> group("hermetic_tests"))
# and in //bundles/buildbot/target_tests.gni (minimal_hermetic_target_tests).
bazel_test_suite("bazel_hermetic_tests") {
target_tests =
[ "//src/sys/component_manager:component_manager_hermetic_target_tests" ]
}
group("hermetic_tests") {
testonly = true
deps = [
":bazel_hermetic_tests",
"lib:hermetic_tests",
"stress_tests_alt:component-manager-stress-tests-short",
"tests:hermetic_tests",
]
}
# Retained in GN because `:bin` links the dual-built `rustc_dylib`
# `//src/storage/lib/vfs/rust:vfs_dylib` and shared C/C++ libraries
# (`libcrypto.so`, `libfdio.so`, `libtrace-engine.so`), which collide in
# BootFS with GN-built `bootfs_files_package` targets.
bootfs_files_for_assembly("bootfs") {
deps = [ ":bin" ]
}
renamed_binary("renamed_bin_with_tracing") {
dest = "bin/component_manager"
source = "$root_out_dir/component_manager_with_tracing"
source_deps = [ ":bin_with_tracing" ]
}
# Retained in GN because `:bin_with_tracing` links the dual-built `rustc_dylib`
# `//src/storage/lib/vfs/rust:vfs_dylib` and shared C/C++ libraries
# (`libcrypto.so`, `libfdio.so`, `libtrace-engine.so`, `libasync-default.so`),
# which collide in BootFS with GN-built `bootfs_files_package` targets.
bootfs_files_for_assembly("bootfs_with_tracing") {
deps = [ ":renamed_bin_with_tracing" ]
}
renamed_binary("renamed_bin_with_tracing_and_heapdump") {
dest = "bin/component_manager"
source = "$root_out_dir/component_manager_with_tracing_and_heapdump"
source_deps = [ ":bin_with_tracing_and_heapdump" ]
}
bootfs_files_for_assembly("bootfs_with_tracing_and_heapdump") {
deps = [ ":renamed_bin_with_tracing_and_heapdump" ]
}
component_config("component_manager_realm_builder_config") {
sources = [
"configs/no_debug.json5",
"configs/test_config.base.json5",
]
dest = "data/component_manager_config"
}
component_config("component_manager_realm_builder_debug_config") {
sources = [
"configs/debug.json5",
"configs/test_config.base.json5",
]
dest = "data/component_manager_config"
}
component_config("component_manager_bootfs_config") {
build_type = "eng"
dest = "config/component_manager"
}
component_id_index("component_id_index_for_debug") {
source = "configs/component_id_index_for_debug.json5"
}
component_id_index_config("component_id_index_for_debug_config") {
deps = [ ":component_id_index_for_debug" ]
}
# Retained in GN because `fuchsia.sys2/InstanceInfo` was removed from
# `//sdk/fidl/fuchsia.sys2` in commit 5e77dfe88df8859a5f1b837b36bf24c407bb11ae,
# so `measure-tape` panics if invoked on this unused target in `bazel build
# :all`.
measure_tape("measure_tape_for_instance_info") {
target_binding = "rust"
target_types = [ "fuchsia.sys2/InstanceInfo" ]
fidls = [ "//sdk/fidl/fuchsia.sys2" ]
}
## BAZEL2GN SENTINEL - DO NOT EDIT BELOW THIS LINE ##
#
# ________ _________ ________ ________
# |\ ____\|\___ ___\\ __ \|\ __ \
# \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \
# \ \_____ \ \ \ \ \ \ \\\ \ \ ____\
# \|____|\ \ \ \ \ \ \ \\\ \ \ \___|
# ____\_\ \ \ \__\ \ \_______\ \__\
# |\_________\ \|__| \|_______|\|__|
# \|_________|
#
#
# AUTO-GENERATED - DO NOT EDIT
#
# The targets below are auto-generated based on the targets defined in the
# BUILD.bazel file from the same directory. If you made changes to targets in
# Bazel, instead of editing this file manually, run:
#
# > fx bazel2gn
#
# Please do NOT edit this file directly. Instead, edit the BUILD.bazel file and
# rerun bazel2gn.
import("//build/tools/bazel2gn/bazel_migration.gni")
_COMPONENT_MANAGER_SRCS = [
"src/bootfs.rs",
"src/builtin/boot_controller.rs",
"src/builtin/builtin_resolver.rs",
"src/builtin/builtin_runner.rs",
"src/builtin/crash_introspect.rs",
"src/builtin/dispatcher.rs",
"src/builtin/fuchsia_boot_resolver.rs",
"src/builtin/log.rs",
"src/builtin/mod.rs",
"src/builtin/ota_health_verification.rs",
"src/builtin/realm_builder.rs",
"src/builtin/runner.rs",
"src/builtin/svc_stash_provider.rs",
"src/builtin/system_controller.rs",
"src/builtin/time.rs",
"src/builtin_environment.rs",
"src/capability.rs",
"src/framework/binder.rs",
"src/framework/capabilities.rs",
"src/framework/capability_store.rs",
"src/framework/component_sandbox_retriever.rs",
"src/framework/config_override.rs",
"src/framework/controller.rs",
"src/framework/introspector.rs",
"src/framework/lifecycle_controller.rs",
"src/framework/mod.rs",
"src/framework/namespace.rs",
"src/framework/pkg_dir.rs",
"src/framework/realm.rs",
"src/framework/realm_query.rs",
"src/framework/route_validator.rs",
"src/main.rs",
"src/model/actions/coordinator.rs",
"src/model/actions/destroy.rs",
"src/model/actions/mod.rs",
"src/model/actions/resolve.rs",
"src/model/actions/set.rs",
"src/model/actions/shutdown.rs",
"src/model/actions/start.rs",
"src/model/actions/stop.rs",
"src/model/actions/unresolve.rs",
"src/model/component/instance.rs",
"src/model/component/manager.rs",
"src/model/component/mod.rs",
"src/model/context.rs",
"src/model/escrow.rs",
"src/model/event_logger.rs",
"src/model/events/hook_observer.rs",
"src/model/events/mod.rs",
"src/model/events/use_router.rs",
"src/model/logger.rs",
"src/model/mod.rs",
"src/model/model.rs",
"src/model/namespace.rs",
"src/model/program/component_controller.rs",
"src/model/program/mod.rs",
"src/model/resolver.rs",
"src/model/routing/aggregate_router.rs",
"src/model/routing/mod.rs",
"src/model/routing/service.rs",
"src/model/start.rs",
"src/model/storage/admin_protocol.rs",
"src/model/storage/mod.rs",
"src/model/testing/echo_service.rs",
"src/model/testing/mocks.rs",
"src/model/testing/mod.rs",
"src/model/testing/out_dir.rs",
"src/model/testing/routing_test_helpers.rs",
"src/model/testing/test_helpers.rs",
"src/model/testing/test_hook.rs",
"src/model/tests/availability.rs",
"src/model/tests/config.rs",
"src/model/tests/diagnostics.rs",
"src/model/tests/dictionary.rs",
"src/model/tests/directory.rs",
"src/model/tests/lifecycle.rs",
"src/model/tests/mod.rs",
"src/model/tests/policy.rs",
"src/model/tests/rights.rs",
"src/model/tests/routing.rs",
"src/model/tests/storage.rs",
"src/model/tests/storage_admin.rs",
"src/model/token.rs",
"src/root_input_builder.rs",
"src/root_stop_notifier.rs",
"src/runner.rs",
"src/sandbox_util.rs",
"src/startup.rs",
]
# To avoid "Assignment had no effect" from GN.
# It's possible this variable is only used in if conditions (e.g. is_host).
not_needed([ "_COMPONENT_MANAGER_SRCS" ])
_COMPONENT_MANAGER_DEPS = [
":dispatcher_config",
":measure_tape_for_events",
":measure_tape_for_instance",
"//sdk/fidl/fuchsia.boot:fuchsia.boot_rust",
"//sdk/fidl/fuchsia.component:fuchsia.component_rust",
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust",
"//sdk/fidl/fuchsia.component.internal:fuchsia.component.internal_rust",
"//sdk/fidl/fuchsia.component.resolution:fuchsia.component.resolution_rust",
"//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner_rust",
"//sdk/fidl/fuchsia.component.runtime:fuchsia.component.runtime_rust",
"//sdk/fidl/fuchsia.component.sandbox:fuchsia.component.sandbox_rust",
"//sdk/fidl/fuchsia.data:fuchsia.data_rust",
"//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust",
"//sdk/fidl/fuchsia.inspect:fuchsia.inspect_rust",
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//sdk/fidl/fuchsia.kernel:fuchsia.kernel_rust",
"//sdk/fidl/fuchsia.logger:fuchsia.logger_rust",
"//sdk/fidl/fuchsia.mem:fuchsia.mem_rust",
"//sdk/fidl/fuchsia.memory.attribution:fuchsia.memory.attribution_rust",
"//sdk/fidl/fuchsia.pkg:fuchsia.pkg_rust",
"//sdk/fidl/fuchsia.process:fuchsia.process_rust",
"//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle_rust",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2_rust",
"//sdk/fidl/fuchsia.time:fuchsia.time_rust",
"//sdk/rust/zx",
"//sdk/rust/zx-status",
"//src/devices/bin/devfs:lib",
"//src/lib/async-utils",
"//src/lib/diagnostics/inspect/runtime/rust:unchecked_includes",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/diagnostics/log/rust",
"//src/lib/directed_graph",
"//src/lib/error/clonable_error",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-fs",
"//src/lib/fuchsia-runtime",
"//src/lib/fuchsia-sync",
"//src/lib/fuchsia-url",
"//src/lib/trace/rust:trace",
"//src/lib/versioning/version-history/rust",
"//src/lib/versioning/version-history/rust/data",
"//src/performance/memory/scudo:rust",
"//src/power/shutdown-shim:lib",
"//src/storage/lib/vfs/rust:vfs",
"//src/sys/component_manager/lib/builtins",
"//src/sys/component_manager/lib/diagnostics",
"//src/sys/component_manager/lib/errors",
"//src/sys/component_manager/lib/hooks",
"//src/sys/component_manager/lib/logger",
"//src/sys/component_manager/lib/router_error",
"//src/sys/component_manager/lib/serve_processargs",
"//src/sys/component_manager/lib/util",
"//src/sys/lib/capability_source",
"//src/sys/lib/cm_config",
"//src/sys/lib/cm_fidl_validator",
"//src/sys/lib/cm_graph",
"//src/sys/lib/cm_rust",
"//src/sys/lib/cm_types",
"//src/sys/lib/component_id_index",
"//src/sys/lib/config_encoder",
"//src/sys/lib/elf_runner",
"//src/sys/lib/fidl-fuchsia-component-abi-ext",
"//src/sys/lib/fuchsia-bootfs",
"//src/sys/lib/fuchsia-zbi",
"//src/sys/lib/mem_util",
"//src/sys/lib/moniker",
"//src/sys/lib/namespace",
"//src/sys/lib/routing",
"//src/sys/lib/runner",
"//src/sys/lib/runtime_capabilities",
"//src/sys/pkg/fidl/fuchsia.update.verify:fuchsia.update.verify_rust",
"//src/sys/pkg/lib/context-authenticator",
"//src/sys/pkg/lib/fuchsia-pkg",
"//src/sys/pkg/lib/package-directory",
"//src/sys/pkg/lib/system-image",
"//src/sys/service-broker:lib",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:flyweights",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:itertools",
"//third_party/rust_crates:log",
"//third_party/rust_crates:num-traits",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:thiserror",
]
# To avoid "Assignment had no effect" from GN.
# It's possible this variable is only used in if conditions (e.g. is_host).
not_needed([ "_COMPONENT_MANAGER_DEPS" ])
_COMPONENT_MANAGER_PROC_MACRO_DEPS = [
"//src/lib/include_bytes_from_working_dir",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:derivative",
]
# To avoid "Assignment had no effect" from GN.
# It's possible this variable is only used in if conditions (e.g. is_host).
not_needed([ "_COMPONENT_MANAGER_PROC_MACRO_DEPS" ])
_COMPONENT_MANAGER_TEST_DEPS = [
"//examples/components/routing/fidl:echo_rust",
"//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions",
"//src/lib/fuchsia",
"//src/sys/lib/cm_rust/testing",
"//src/sys/lib/routing/testing:routing_test_helpers",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:camino",
"//third_party/rust_crates:maplit",
"//third_party/rust_crates:tempfile",
"//third_party/rust_crates:test-case",
]
# To avoid "Assignment had no effect" from GN.
# It's possible this variable is only used in if conditions (e.g. is_host).
not_needed([ "_COMPONENT_MANAGER_TEST_DEPS" ])
cm("elf_runner_cm") {
manifest = "meta/elf_runner.cml"
output_name = "cml/elf_runner_cm/elf_runner.cm"
config_values_package_path = "meta/elf_runner.cvf"
}
cm("dispatcher_cm") {
manifest = "meta/dispatcher.cml"
output_name = "cml/dispatcher_cm/dispatcher.cm"
config_values_package_path = "meta/dispatcher.cvf"
restricted_features = [ "dynamic_dictionaries" ]
visibility = [
":*",
"//tools/cmc/build/restricted_features:*",
]
}
fuchsia_structured_config_rust_lib("dispatcher_config") {
cm_label = ":dispatcher_cm"
}
rustc_binary("bin") {
sources = _COMPONENT_MANAGER_SRCS
configs += [
"//build/config/rust:bootfs",
":optimize-for-size",
]
inputs = [
"${dispatcher_cm}",
"${elf_runner_cm}",
]
output_name = "component_manager"
non_rust_deps = [
":dispatcher_cm($default_toolchain)",
":elf_runner_cm($default_toolchain)",
]
edition = "2024"
_concurrent_jobs = concurrent_jobs.rust_highmem
configs += _concurrent_jobs.configs
forward_variables_from(_concurrent_jobs.vars, "*")
proc_macro_deps = _COMPONENT_MANAGER_PROC_MACRO_DEPS
rustenv = [
"DISPATCHER_CM_PATH=${dispatcher_cm_path}",
"ELF_RUNNER_CM_PATH=${elf_runner_cm_path}",
]
assert_no_deps = [
"//src/lib/trace/rust:trace-provider",
"//third_party/rust_crates:regex",
"//third_party/rust_crates:serde_json5($current_toolchain)",
]
exclude_toolchain_tags = [ "heapdump" ]
deps = _COMPONENT_MANAGER_DEPS
}
rustc_test("bin_test") {
sources = _COMPONENT_MANAGER_SRCS
inputs = [
"${dispatcher_cm}",
"${elf_runner_cm}",
]
edition = "2024"
proc_macro_deps =
_COMPONENT_MANAGER_PROC_MACRO_DEPS + [ "//third_party/rust_crates:paste" ]
rustenv = [
"DISPATCHER_CM_PATH=${dispatcher_cm_path}",
"ELF_RUNNER_CM_PATH=${elf_runner_cm_path}",
]
deps = _COMPONENT_MANAGER_DEPS + _COMPONENT_MANAGER_TEST_DEPS + [
"//src/lib/test_util",
"//src/sys/pkg/lib/fuchsia-pkg-testing",
"//third_party/rust_crates:pretty_assertions",
"//third_party/rust_crates:proptest",
]
source_root = "src/main.rs"
configs += [
"//build/config/rust:bootfs",
":optimize-for-size",
]
output_name = "component_manager_bin_test"
non_rust_deps = [
":dispatcher_cm($default_toolchain)",
":elf_runner_cm($default_toolchain)",
"//src/sys/lib/fuchsia-bootfs:testdata_bootfs",
]
_concurrent_jobs = concurrent_jobs.rust_highmem
configs += _concurrent_jobs.configs
forward_variables_from(_concurrent_jobs.vars, "*")
exclude_toolchain_tags = [ "heapdump" ]
}
rustc_test("src_model_tests") {
sources = _COMPONENT_MANAGER_SRCS
configs += [
"//build/config/rust:bootfs",
":optimize-for-size",
]
inputs = [
"${dispatcher_cm}",
"${elf_runner_cm}",
]
output_name = "component_manager_src_model_tests"
source_root = "src/main.rs"
non_rust_deps = [
":dispatcher_cm($default_toolchain)",
":elf_runner_cm($default_toolchain)",
"//src/sys/lib/fuchsia-bootfs:testdata_bootfs",
]
edition = "2024"
_concurrent_jobs = concurrent_jobs.rust_highmem
configs += _concurrent_jobs.configs
forward_variables_from(_concurrent_jobs.vars, "*")
proc_macro_deps = _COMPONENT_MANAGER_PROC_MACRO_DEPS
rustenv = [
"DISPATCHER_CM_PATH=${dispatcher_cm_path}",
"ELF_RUNNER_CM_PATH=${elf_runner_cm_path}",
]
rustflags = [ "--cfg=feature=\"src_model_tests\"" ]
exclude_toolchain_tags = [ "heapdump" ]
deps = _COMPONENT_MANAGER_DEPS + _COMPONENT_MANAGER_TEST_DEPS +
[ "//src/lib/diagnostics/hierarchy/rust" ]
}
rustc_binary("bin_with_tracing") {
sources = _COMPONENT_MANAGER_SRCS
configs += [
"//build/config/rust:bootfs",
":optimize-for-size",
]
inputs = [
"${dispatcher_cm}",
"${elf_runner_cm}",
]
features = [ "tracing" ]
output_name = "component_manager_with_tracing"
non_rust_deps = [
":dispatcher_cm($default_toolchain)",
":elf_runner_cm($default_toolchain)",
]
edition = "2024"
_concurrent_jobs = concurrent_jobs.rust_highmem
configs += _concurrent_jobs.configs
forward_variables_from(_concurrent_jobs.vars, "*")
proc_macro_deps = _COMPONENT_MANAGER_PROC_MACRO_DEPS
rustenv = [
"DISPATCHER_CM_PATH=${dispatcher_cm_path}",
"ELF_RUNNER_CM_PATH=${elf_runner_cm_path}",
]
assert_no_deps = [
"//third_party/rust_crates:regex",
"//third_party/rust_crates:serde_json5($current_toolchain)",
]
exclude_toolchain_tags = [ "heapdump" ]
visibility = [
":*",
"//src/lib/fuchsia-component-test/tests:*",
"//src/sys/component_manager/tests/*",
]
deps = _COMPONENT_MANAGER_DEPS + [
"//sdk/fidl/fuchsia.tracing.provider:fuchsia.tracing.provider_rust",
"//src/lib/trace/rust:trace-provider",
]
}
fuchsia_component_manifest("elf_runner-manifest") {
component_name = "elf_runner"
manifest = "meta/elf_runner.cml"
}
fuchsia_component("elf_runner") {
cm_label = ":elf_runner-manifest"
visibility = [
":*",
"//examples/components/runner/colocated/integration_tests:*",
"//src/sys/component_manager/tests/builtin_runner:*",
]
}
measure_tape("measure_tape_for_events") {
fidls = [
"//sdk/fidl/fuchsia.component",
"//sdk/fidl/fuchsia.io",
]
target_binding = "rust"
target_types = [ "fuchsia.component/Event" ]
}
measure_tape("measure_tape_for_instance") {
fidls = [ "//sdk/fidl/fuchsia.sys2" ]
target_binding = "rust"
target_types = [ "fuchsia.sys2/Instance" ]
}