blob: 74a1cd30ed76356be8f3be6f2c48c794633f1cb6 [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/config.gni")
import("//build/package.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
import("//src/sys/build/components.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_watchdog.cc",
"storage_watchdog.h",
"system_diagnostics_directory.cc",
"system_diagnostics_directory.h",
"util.cc",
"util.h",
]
public_deps = [
"//garnet/lib/loader",
"//garnet/public/lib/json",
"//sdk/fidl/fuchsia.hardware.power.statecontrol",
"//sdk/fidl/fuchsia.process",
"//sdk/fidl/fuchsia.sys",
"//sdk/fidl/fuchsia.sys.internal",
"//sdk/fidl/fuchsia.sys.test",
"//sdk/fidl/fuchsia.sys2",
"//sdk/lib/sys/cpp",
"//sdk/lib/sys/inspect/cpp",
"//src/lib/cmx",
"//src/lib/fsl",
"//src/lib/fxl",
"//src/lib/loader_service",
"//src/lib/pkg_url",
"//third_party/googletest:gtest_prod",
"//zircon/public/lib/fit",
"//zircon/public/lib/zx",
"//zircon/public/lib/zxc",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/fdio-caller",
"//zircon/system/ulib/fs",
"//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",
# TODO(fxbug.dev/57392): Move it back to //third_party once unification completes.
"//zircon/third_party/rapidjson",
]
configs += [ "//build/config:all_source" ]
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
}
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/sys/lib/stdout-to-debuglog/cpp",
"//zircon/public/lib/zx",
"//zircon/system/ulib/fidl-async:fidl-async-cpp",
"//zircon/system/ulib/fs",
]
}
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 = [ "//garnet/public/lib/fostr/*" ]
}
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_unittest.cc",
"storage_watchdog_unittest.cc",
"util_unittest.cc",
]
deps = [
":appmgr_for_test",
":lib",
"//garnet/public/lib/gtest",
"//sdk/fidl/fuchsia.sys.internal",
"//sdk/lib/sys/cpp",
"//sdk/lib/sys/cpp/testing:unit",
"//sdk/lib/vfs/cpp",
"//src/lib/fxl/test:gtest_main",
"//src/testing/fidl:placeholders",
"//third_party/googletest:gmock",
"//zircon/system/ulib/memfs",
]
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
configs += [ "//build/config:Wno-conversion" ]
}
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.json"
}
# 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.json"
}
group("unittests") {
testonly = true
public_deps = [
":appmgr_unittests",
":system_data_file",
]
}
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") {
deps = [
":test_component_using_storage",
":unittest_bin",
]
manifest = "meta/appmgr_unittests.cmx"
test_specs = {
log_settings = {
max_severity = "ERROR"
}
environments = basic_envs
}
}
package("system_data_file") {
__deprecated_system_image = true
resources = [
{
path = "test_file.txt"
dest = "test_file.txt"
},
{
path = "test_file.txt"
dest = "subdir/test_file.txt"
},
]
}
group("tests") {
testonly = true
deps = [
":appmgr_unittests",
":system_data_file",
"integration_tests",
]
}