blob: ac8adb5efe6f8c96a6cf1cf3a1ec2806692ec6a1 [file] [log] [blame]
# Copyright 2016 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/component_id_index.gni")
import("//build/components.gni")
import("//build/config.gni")
import("//build/images/fvm.gni")
source_set("lib") {
sources = [
"allow_list.cc",
"allow_list.h",
"cache_control.cc",
"cache_control.h",
"component_controller_impl.cc",
"component_controller_impl.h",
"component_event_provider_impl.cc",
"component_event_provider_impl.h",
"component_id_index.cc",
"component_id_index.h",
"constants.h",
"cpu_watcher.cc",
"cpu_watcher.h",
"crash_introspector.cc",
"crash_introspector.h",
"debug_info_retriever.cc",
"debug_info_retriever.h",
"dynamic_library_loader.cc",
"dynamic_library_loader.h",
"environment_controller_impl.cc",
"environment_controller_impl.h",
"hub/component_hub.cc",
"hub/component_hub.h",
"hub/hub.cc",
"hub/hub.h",
"hub/hub_info.cc",
"hub/hub_info.h",
"hub/realm_hub.cc",
"hub/realm_hub.h",
"job_provider_impl.cc",
"job_provider_impl.h",
"log_connector_impl.cc",
"log_connector_impl.h",
"moniker.cc",
"moniker.h",
"namespace.cc",
"namespace.h",
"namespace_builder.cc",
"namespace_builder.h",
"policy_checker.cc",
"policy_checker.h",
"realm.cc",
"realm.h",
"runner_holder.cc",
"runner_holder.h",
"scheme_map.cc",
"scheme_map.h",
"service_provider_dir_impl.cc",
"service_provider_dir_impl.h",
"storage_metrics.cc",
"storage_metrics.h",
"storage_watchdog.cc",
"storage_watchdog.h",
"system_diagnostics_directory.cc",
"system_diagnostics_directory.h",
"util.cc",
"util.h",
]
public_deps = [
"//garnet/lib/loader",
"//sdk/fidl/fuchsia.hardware.power.statecontrol",
"//sdk/fidl/fuchsia.io:fuchsia.io_llcpp",
"//sdk/fidl/fuchsia.process",
"//sdk/fidl/fuchsia.sys",
"//sdk/fidl/fuchsia.sys.internal",
"//sdk/fidl/fuchsia.sys.test",
"//sdk/fidl/fuchsia.sys2",
"//sdk/lib/fit-promise",
"//sdk/lib/stdcompat",
"//sdk/lib/sys/cpp",
"//sdk/lib/sys/inspect/cpp",
"//src/lib/cmx",
"//src/lib/fsl",
"//src/lib/fxl",
"//src/lib/json_parser",
"//src/lib/loader_service",
"//src/lib/pkg_url",
"//src/lib/storage/vfs/cpp",
"//third_party/googletest:gtest_prod",
"//third_party/rapidjson",
"//third_party/re2",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/fdio-caller",
"//zircon/system/ulib/inspector",
"//zircon/system/ulib/syslog",
"//zircon/system/ulib/task-utils",
"//zircon/system/ulib/trace",
"//zircon/system/ulib/trace-provider:trace-provider-with-fdio",
"//zircon/system/ulib/zx",
"//zircon/system/ulib/zxc",
]
configs += [ "//build/config:all_source" ]
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
# TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated.
# Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>).
# See linked bug for details.
configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ]
}
source_set("appmgr_for_test") {
testonly = true
sources = [
"appmgr.cc",
"appmgr.h",
"lifecycle.cc",
"lifecycle.h",
"startup_service.cc",
"startup_service.h",
]
public_deps = [
":lib",
"fidl/fuchsia.appmgr",
"//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle",
"//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle_llcpp",
"//sdk/fidl/fuchsia.sys",
"//sdk/fidl/fuchsia.sys.test",
"//sdk/lib/sys/cpp",
"//src/lib/fxl",
"//src/lib/storage/vfs/cpp",
"//src/sys/lib/stdout-to-debuglog/cpp",
"//zircon/system/ulib/fidl-async:fidl-async-cpp",
"//zircon/system/ulib/zx",
]
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
# TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated.
# Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>).
# See linked bug for details.
configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ]
}
executable("bin") {
output_name = "appmgr"
sources = [
"appmgr.cc",
"appmgr.h",
"lifecycle.cc",
"lifecycle.h",
"main.cc",
"startup_service.cc",
"startup_service.h",
]
deps = [
":lib",
"fidl/fuchsia.appmgr",
"//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle",
"//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle_llcpp",
"//sdk/lib/sys/cpp",
"//src/sys/lib/stdout-to-debuglog/cpp",
"//zircon/system/ulib/fidl-async:fidl-async-cpp",
]
# appmgr starts early in the boot sequence before shared libraries from
# packages are available, so it has to avoid dynamically linking against
# libraries outside of /boot/lib. These rules ensure that appmgr statically
# links against the C++ standard library and prevents dependencies on some
# shared library targets that are easy to pull in unintentionally.
configs += [ "//build/config/fuchsia:static_cpp_standard_library" ]
assert_no_deps = [ "//src/lib/fostr/*" ]
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
# TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated.
# Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>).
# See linked bug for details.
configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ]
}
executable("unittest_bin") {
testonly = true
output_name = "appmgr_unittests"
sources = [
"allow_list_unittest.cc",
"component_controller_unittest.cc",
"component_event_provider_unittest.cc",
"component_id_index_unittest.cc",
"cpu_watcher_unittest.cc",
"hub/hub_holder_unittest.cc",
"log_connector_impl_unittest.cc",
"moniker_unittest.cc",
"namespace_builder_unittest.cc",
"namespace_unittest.cc",
"policy_checker_unittest.cc",
"scheme_map_unittest.cc",
"service_provider_dir_unittest.cc",
"storage_metrics_unittest.cc",
"storage_unittest.cc",
"storage_watchdog_unittest.cc",
"util_unittest.cc",
]
deps = [
":appmgr_for_test",
":lib",
"//sdk/fidl/fuchsia.sys.internal",
"//sdk/lib/fit-promise",
"//sdk/lib/sys/cpp",
"//sdk/lib/sys/cpp/testing:unit",
"//sdk/lib/vfs/cpp",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/loop_fixture",
"//src/storage/memfs",
"//src/testing/fidl:placeholders",
"//third_party/googletest:gmock",
]
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
# TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated.
# Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>).
# See linked bug for details.
configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ]
}
fuchsia_package_with_single_component("appmgr") {
manifest = "meta/appmgr.cml"
deps = [ ":bin" ]
}
config_data("appmgr_scheme_config") {
for_pkg = "appmgr"
sources = [ "scheme_map.config" ]
outputs = [ "scheme_map/default.config" ]
}
# Supply a component ID index to appmgr. This index contains component ID
# entries for components whose source-code lives in this repository
# (fuchsia.git).
component_id_index("core_component_id_index") {
source = "config/core_component_id_index.json5"
}
# If this target is included in the build, all components are allowed to use
# isolated-persistent-storage, even if they are not in the component ID index.
component_id_index("component_id_index_no_restrict_storage") {
source = "config/component_id_index_no_restrict_storage.json5"
}
executable("test_component_using_storage_bin") {
output_name = "test_component_using_storage"
sources = [ "test/test_component_using_storage.cc" ]
}
fuchsia_component("test_component_using_storage") {
deps = [ ":test_component_using_storage_bin" ]
manifest = "meta/test_component_using_storage.cmx"
}
fuchsia_unittest_package("appmgr_unittests") {
package_deps_for_infra_only = [ "//third_party/sbase:sleep" ]
deps = [
":test_component_using_storage",
":unittest_bin",
]
manifest = "meta/appmgr_unittests.cmx"
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
group("tests") {
testonly = true
deps = [
":appmgr_unittests",
"integration_tests",
]
}