| # 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/component/config.gni") |
| import("//build/components.gni") |
| import("//build/images/filesystem_limits.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/testing/environments.gni") |
| import("//tools/fidl/measure-tape/measure_tape.gni") |
| |
| template("component_manager") { |
| _deps = [ |
| ":measure_tape_for_instance_info", |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot-rustc", |
| "//sdk/fidl/fuchsia.component:fuchsia.component-rustc", |
| "//sdk/fidl/fuchsia.component.config:fuchsia.component.config-rustc", |
| "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl-rustc", |
| "//sdk/fidl/fuchsia.component.internal:fuchsia.component.internal-rustc", |
| "//sdk/fidl/fuchsia.component.resolution:fuchsia.component.resolution-rustc", |
| "//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner-rustc", |
| "//sdk/fidl/fuchsia.data:fuchsia.data-rustc", |
| "//sdk/fidl/fuchsia.diagnostics.types:fuchsia.diagnostics.types-rustc", |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel-rustc", |
| "//sdk/fidl/fuchsia.logger:fuchsia.logger-rustc", |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem-rustc", |
| "//sdk/fidl/fuchsia.process:fuchsia.process-rustc", |
| "//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle-rustc", |
| "//sdk/fidl/fuchsia.sys:fuchsia.sys-rustc", |
| "//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc", |
| "//sdk/fidl/fuchsia.time:fuchsia.time-rustc", |
| "//src/lib/by_addr:by_addr", |
| "//src/lib/diagnostics/inspect/contrib/rust", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/diagnostics/log/message/rust", |
| "//src/lib/error/clonable_error", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/from-enum", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/fuchsia-url", |
| "//src/lib/injectable-time", |
| "//src/lib/process_builder", |
| "//src/lib/scoped_task", |
| "//src/lib/storage/vfs/rust:vfs", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zerocopy", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/lib/zircon/rust:fuchsia-zircon-status", |
| "//src/sys/component_manager/lib/logger", |
| "//src/sys/component_manager/lib/runner", |
| "//src/sys/component_manager/lib/task_scope", |
| "//src/sys/component_manager/lib/util", |
| "//src/sys/lib/cm_fidl_validator", |
| "//src/sys/lib/cm_moniker", |
| "//src/sys/lib/cm_rust", |
| "//src/sys/lib/cm_types", |
| "//src/sys/lib/component_id_index", |
| "//src/sys/lib/config_encoder", |
| "//src/sys/lib/fuchsia-bootfs", |
| "//src/sys/lib/fuchsia-zbi", |
| "//src/sys/lib/mem_util", |
| "//src/sys/lib/moniker", |
| "//src/sys/lib/routing", |
| "//src/sys/lib/runner", |
| "//src/sys/lib/task-exceptions", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:maplit", |
| "//third_party/rust_crates:parking_lot", |
| "//third_party/rust_crates:paste", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:tempfile", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| "//third_party/rust_crates:url", |
| "//third_party/rust_crates:void", |
| ] |
| _sources = [ |
| "src/binder.rs", |
| "src/bootfs.rs", |
| "src/builtin/arguments.rs", |
| "src/builtin/capability.rs", |
| "src/builtin/cpu_resource.rs", |
| "src/builtin/crash_introspect.rs", |
| "src/builtin/debug_resource.rs", |
| "src/builtin/factory_items.rs", |
| "src/builtin/fuchsia_boot_resolver.rs", |
| "src/builtin/hypervisor_resource.rs", |
| "src/builtin/info_resource.rs", |
| "src/builtin/ioport_resource.rs", |
| "src/builtin/irq_resource.rs", |
| "src/builtin/items.rs", |
| "src/builtin/kernel_stats.rs", |
| "src/builtin/lifecycle_controller.rs", |
| "src/builtin/log.rs", |
| "src/builtin/mmio_resource.rs", |
| "src/builtin/mod.rs", |
| "src/builtin/power_resource.rs", |
| "src/builtin/process_launcher.rs", |
| "src/builtin/realm_builder.rs", |
| "src/builtin/realm_explorer.rs", |
| "src/builtin/realm_query.rs", |
| "src/builtin/root_job.rs", |
| "src/builtin/root_resource.rs", |
| "src/builtin/route_validator.rs", |
| "src/builtin/runner.rs", |
| "src/builtin/smc_resource.rs", |
| "src/builtin/system_controller.rs", |
| "src/builtin/time.rs", |
| "src/builtin/vmex_resource.rs", |
| "src/builtin_environment.rs", |
| "src/capability.rs", |
| "src/collection.rs", |
| "src/constants.rs", |
| "src/diagnostics/component_stats.rs", |
| "src/diagnostics/component_tree_stats.rs", |
| "src/diagnostics/constants.rs", |
| "src/diagnostics/measurement.rs", |
| "src/diagnostics/mod.rs", |
| "src/diagnostics/runtime_stats_source.rs", |
| "src/diagnostics/task_info.rs", |
| "src/diagnostics/testing.rs", |
| "src/directory_ready_notifier.rs", |
| "src/elf_runner/component.rs", |
| "src/elf_runner/config.rs", |
| "src/elf_runner/crash_handler.rs", |
| "src/elf_runner/error.rs", |
| "src/elf_runner/launcher.rs", |
| "src/elf_runner/mod.rs", |
| "src/elf_runner/runtime_dir.rs", |
| "src/elf_runner/stdout.rs", |
| "src/framework.rs", |
| "src/fuchsia_pkg_resolver.rs", |
| "src/lib.rs", |
| "src/model/actions/destroy.rs", |
| "src/model/actions/destroy_child.rs", |
| "src/model/actions/discover.rs", |
| "src/model/actions/mod.rs", |
| "src/model/actions/resolve.rs", |
| "src/model/actions/shutdown.rs", |
| "src/model/actions/start.rs", |
| "src/model/actions/stop.rs", |
| "src/model/actions/unresolve.rs", |
| "src/model/addable_directory.rs", |
| "src/model/component.rs", |
| "src/model/context.rs", |
| "src/model/dir_tree.rs", |
| "src/model/environment.rs", |
| "src/model/error.rs", |
| "src/model/event_logger.rs", |
| "src/model/events/dispatcher.rs", |
| "src/model/events/error.rs", |
| "src/model/events/event.rs", |
| "src/model/events/mod.rs", |
| "src/model/events/registry.rs", |
| "src/model/events/running_provider.rs", |
| "src/model/events/serve.rs", |
| "src/model/events/source.rs", |
| "src/model/events/source_factory.rs", |
| "src/model/events/stream.rs", |
| "src/model/events/stream_provider.rs", |
| "src/model/events/synthesizer.rs", |
| "src/model/exposed_dir.rs", |
| "src/model/hooks.rs", |
| "src/model/hub.rs", |
| "src/model/mod.rs", |
| "src/model/model.rs", |
| "src/model/namespace.rs", |
| "src/model/ns_dir.rs", |
| "src/model/resolver.rs", |
| "src/model/routing/error.rs", |
| "src/model/routing/mod.rs", |
| "src/model/routing/open.rs", |
| "src/model/routing/providers.rs", |
| "src/model/routing/service.rs", |
| "src/model/routing_fns.rs", |
| "src/model/starter.rs", |
| "src/model/storage/admin_protocol.rs", |
| "src/model/storage/mod.rs", |
| "src/root_stop_notifier.rs", |
| "src/startup.rs", |
| ] |
| |
| if (defined(invoker.is_test) && invoker.is_test) { |
| rustc_test(target_name) { |
| edition = "2021" |
| sources = _sources |
| deps = _deps |
| |
| sources += [ |
| "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/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", |
| ] |
| |
| # Test-only deps. Prefer adding deps used only in tests here instead of |
| # above, which has the benefit of keeping unneeded deps out of the production |
| # binary and allows depending on 'testonly' targets. |
| deps += [ |
| "//examples/components/routing/fidl:echo-rustc", |
| "//src/lib/diagnostics/hierarchy/rust", |
| "//src/lib/process_builder:test-util-fidl-rustc", |
| "//src/sys/lib/cm_rust/testing", |
| "//src/sys/lib/library_loader", |
| "//src/sys/lib/routing/testing:routing_test_helpers", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:pretty_assertions", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:test-case", |
| ] |
| } |
| } else { |
| not_needed([ "invoker" ]) |
| rustc_library(target_name) { |
| name = "component_manager_lib" |
| edition = "2021" |
| |
| sources = _sources |
| deps = _deps |
| |
| # Only for internal use. |
| visibility = [ |
| "//src/session/*", |
| "//src/sys/component_manager/*", |
| ] |
| } |
| } |
| } |
| |
| component_manager("lib") { |
| } |
| component_manager("component_manager_test") { |
| is_test = true |
| } |
| component_manager("component_manager_boot_env_test") { |
| is_test = true |
| } |
| |
| rustc_binary("bin") { |
| name = "component_manager" |
| edition = "2021" |
| |
| configs += [ "//build/config/rust:bootfs" ] |
| |
| deps = [ |
| ":lib", |
| "//sdk/fidl/fuchsia.component.internal:fuchsia.component.internal-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/component_manager/lib/logger", |
| "//src/sys/lib/routing", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| # 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. |
| fuchsia_component("component-manager-cmp") { |
| deps = [ |
| ":bin", |
| ":component_manager_appmgr_config", |
| ":component_manager_debug_config", |
| ] |
| component_name = "component_manager" |
| manifest = "meta/component_manager.cmx" |
| } |
| |
| fuchsia_package("component-manager") { |
| deps = [ ":component-manager-cmp" ] |
| } |
| |
| # This v2 component bundles component manager with a config suitable for running |
| # a nested component manager inside of realm builder. |
| fuchsia_component("component-manager-realm-builder-cmp") { |
| deps = [ |
| ":bin", |
| ":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. |
| fuchsia_component("component-manager-realm-builder-debug-cmp") { |
| deps = [ |
| ":bin", |
| ":component_manager_realm_builder_debug_config", |
| ] |
| component_name = "component_manager" |
| manifest = "meta/component_manager_debug.cml" |
| } |
| |
| fuchsia_component("component-manager-tests-cmp") { |
| testonly = true |
| deps = [ |
| ":component_manager_debug_config", |
| ":component_manager_test", |
| "//src/lib/process_builder:test_util", |
| ] |
| component_name = "component_manager_tests" |
| manifest = "meta/component_manager_tests.cml" |
| } |
| |
| resource("component_manager_tests_invalid_manifest") { |
| sources = [ "meta/component_manager_tests.invalid_cm" ] |
| outputs = [ "meta/{{source_file_part}}" ] |
| } |
| |
| fuchsia_component("component-manager-boot-env-tests-cmp") { |
| testonly = true |
| deps = [ |
| ":component_manager_boot_env_test", |
| ":component_manager_debug_config", |
| "//src/lib/process_builder:root_job_test_runner", |
| "//src/lib/process_builder:test_util", |
| ] |
| component_name = "component_manager_boot_env_tests" |
| manifest = "meta/component_manager_boot_env_tests.cml" |
| } |
| |
| fuchsia_test_package("component-manager-tests") { |
| # Many tests generate routing errors. |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| test_components = [ |
| ":component-manager-tests-cmp", |
| ":component-manager-boot-env-tests-cmp", |
| ] |
| deps = [ |
| ":component_manager_tests_invalid_manifest", |
| "src/elf_runner/tests/lifecycle:run-indefinitely", |
| "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", |
| ] |
| } |
| |
| measure_tape("measure_tape_for_instance_info") { |
| target_binding = "rust" |
| target_types = [ "fuchsia.sys2/InstanceInfo" ] |
| fidls = [ "//sdk/fidl/fuchsia.sys2" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":component-manager", |
| ":component-manager-tests", |
| "lib:tests", |
| "src/elf_runner/tests", |
| "stress_tests", |
| "stress_tests_alt", |
| "tests", |
| ] |
| } |
| |
| group("bootfs") { |
| deps = [ |
| ":bin", |
| "//src/sys/startup:bootfs", |
| ] |
| } |
| |
| component_config("component_manager_appmgr_config") { |
| sources = [ "configs/appmgr_config.json5" ] |
| } |
| |
| component_config("component_manager_realm_builder_config") { |
| sources = [ "configs/realm_builder_config.json5" ] |
| dest = "data/component_manager_realm_builder_config" |
| } |
| |
| component_config("component_manager_realm_builder_debug_config") { |
| sources = [ "configs/realm_builder_debug_config.json5" ] |
| dest = "data/component_manager_realm_builder_debug_config" |
| } |
| |
| component_config("component_manager_debug_config") { |
| sources = [ "configs/debug_config.json5" ] |
| } |
| |
| component_config("component_manager_bootfs_config") { |
| sources = [ |
| "//src/security/policy/component_manager_policy.json5", |
| "configs/bootfs_config.json5", |
| ] |
| dest = "config/component_manager" |
| } |