blob: 79b09b6336a681ef6eb1d447791325d78853afb2 [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/config.gni")
import("//build/package.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
source_set("lib") {
sources = [
"allowlist.cc",
"allowlist.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",
"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",
"namespace.cc",
"namespace.h",
"namespace_builder.cc",
"namespace_builder.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_objects_directory.cc",
"system_objects_directory.h",
"util.cc",
"util.h",
]
public_deps = [
"//garnet/lib/loader",
"//garnet/public/lib/json",
"//sdk/fidl/fuchsia.sys",
"//sdk/fidl/fuchsia.sys.internal:fuchsia.sys.internal",
"//sdk/fidl/fuchsia.sys.test",
"//sdk/lib/sys/cpp",
"//src/lib/backoff",
"//src/lib/cmx",
"//src/lib/fsl",
"//src/lib/fxl",
"//src/lib/inspect_deprecated",
"//src/lib/pkg_url",
"//third_party/rapidjson",
"//zircon/public/lib/async-loop-cpp",
"//zircon/public/lib/async-loop-default",
"//zircon/public/lib/fdio-caller",
"//zircon/public/lib/fit",
"//zircon/public/lib/fs",
"//zircon/public/lib/inspector",
"//zircon/public/lib/loader-service",
"//zircon/public/lib/trace-provider-with-fdio",
"//zircon/public/lib/zx",
"//zircon/system/fidl/fuchsia-process",
]
defines = [ "_ALL_SOURCE=1" ]
}
source_set("appmgr_for_test") {
testonly = true
sources = [
"appmgr.cc",
"appmgr.h",
]
public_deps = [
":lib",
"//sdk/fidl/fuchsia.sys",
"//sdk/fidl/fuchsia.sys.test",
"//sdk/lib/sys/cpp",
"//src/lib/fxl",
"//zircon/public/lib/fs",
"//zircon/public/lib/zx",
]
}
executable("bin") {
output_name = "appmgr"
sources = [
"appmgr.cc",
"appmgr.h",
"main.cc",
]
deps = [
":lib",
"//sdk/lib/sys/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 = [
"allowlist_unittest.cc",
"component_controller_unittest.cc",
"hub/hub_holder_unittest.cc",
"namespace_builder_unittest.cc",
"namespace_unittest.cc",
"realm_unittest.cc",
"scheme_map_unittest.cc",
"service_provider_dir_unittest.cc",
"storage_watchdog_unittest.cc",
"util_unittest.cc",
]
deps = [
":appmgr_for_test",
":lib",
"//garnet/examples/fidl/services:echo",
"//garnet/public/lib/gtest",
"//sdk/lib/sys/cpp",
"//sdk/lib/sys/cpp/testing:unit",
"//sdk/lib/vfs/cpp",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gmock",
"//zircon/public/lib/memfs",
]
}
package("appmgr") {
deps = [ ":bin" ]
binaries = [
{
name = "appmgr"
},
]
meta = [
{
path = rebase_path("meta/appmgr.cml")
dest = "appmgr.cm"
},
]
}
config_data("appmgr_scheme_config") {
for_pkg = "appmgr"
sources = [ "scheme_map.config" ]
outputs = [ "scheme_map/default.config" ]
}
config_data("appmgr_global_data_allowlist") {
for_pkg = "appmgr"
sources = [ "global_data_allowlist.txt" ]
outputs = [ "allowlist/global_data.txt" ]
}
config_data("appmgr_deprecated_shell_allowlist") {
for_pkg = "appmgr"
sources = [ "deprecated_shell_allowlist.txt" ]
outputs = [ "allowlist/deprecated_shell.txt" ]
}
config_data("appmgr_deprecated_ambient_replace_as_executable_allowlist") {
for_pkg = "appmgr"
sources = [ "deprecated_ambient_replace_as_executable_allowlist.txt" ]
outputs = [ "allowlist/deprecated_ambient_replace_as_executable.txt" ]
}
config_data("appmgr_component_event_provider_allowlist") {
for_pkg = "appmgr"
sources = [ "component_event_provider_allowlist.txt" ]
outputs = [ "allowlist/component_event_provider.txt" ]
}
group("unittests") {
testonly = true
public_deps = [
":appmgr_unittests",
":system_data_file",
]
}
test_package("appmgr_unittests") {
deps = [ ":unittest_bin" ]
tests = [
{
name = "appmgr_unittests"
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",
]
}