| # 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/config.gni") |
| import("//build/package.gni") |
| import("//build/test.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| import("//src/lib/isolated_devmgr/devmgr_manifest.gni") |
| |
| source_set("lib") { |
| sources = [ |
| "factory_reset.cc", |
| "factory_reset.h", |
| ] |
| |
| public_deps = [ |
| # <factory_reset.h> has #include <fuchsia/recovery/cpp/fidl.h> |
| "//sdk/fidl/fuchsia.recovery", |
| |
| # <factory_reset.h> has #include <fuchsia/device/manager/cpp/fidl.h> |
| "//zircon/system/fidl/fuchsia-device-manager", |
| |
| # <factory_reset.h> has #include <fbl/unique_fd.h> |
| "//zircon/public/lib/fbl", |
| ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_c", |
| "//zircon/public/lib/fdio", |
| "//zircon/public/lib/fzl", |
| "//zircon/public/lib/zx", |
| "//zircon/system/fidl/fuchsia-device:fuchsia-device_c", |
| "//zircon/system/fidl/fuchsia-hardware-block:fuchsia-hardware-block_c", |
| "//zircon/system/ulib/fdio-caller", |
| "//zircon/system/ulib/fs-management", |
| ] |
| } |
| |
| executable("bin") { |
| output_name = "factory_reset" |
| |
| sources = [ "main.cc" ] |
| |
| public_deps = [ |
| ":lib", |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/sys/cpp", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| ] |
| } |
| |
| executable("fdr") { |
| sources = [ "cli_main.cc" ] |
| |
| public_deps = [ |
| "//sdk/fidl/fuchsia.recovery", |
| "//sdk/lib/sys/cpp", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| ] |
| } |
| |
| package("factory_reset_pkg") { |
| package_name = "factory_reset" |
| |
| deps = [ ":bin" ] |
| |
| binaries = [ |
| { |
| name = "factory_reset" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/factory_reset.cmx") |
| dest = "factory_reset.cmx" |
| }, |
| ] |
| } |
| |
| group("factory_reset") { |
| deps = [ |
| ":factory_reset_config", |
| ":factory_reset_pkg", |
| ] |
| } |
| |
| package("fdr_cli") { |
| deps = [ ":fdr" ] |
| |
| binaries = [ |
| { |
| name = "fdr" |
| shell = true |
| }, |
| ] |
| } |
| |
| config_data("factory_reset_config") { |
| for_pkg = "sysmgr" |
| outputs = [ "factory_reset.config" ] |
| sources = [ "service.config" ] |
| } |
| |
| # TODO(45780): Remove this forwarding target once out of tree users are removed. |
| group("configs") { |
| deps = [ ":factory_reset_config" ] |
| } |
| |
| group("tools") { |
| deps = [ ":fdr_cli" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":factory_reset_tests" ] |
| } |
| |
| test("factory_reset_unittests") { |
| testonly = true |
| sources = [ "factory_reset_unittest.cc" ] |
| |
| deps = [ |
| ":lib", |
| "//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume_c", |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fzl", |
| "//zircon/system/fidl/fuchsia-device:fuchsia-device_llcpp", |
| "//zircon/system/fidl/fuchsia-device-manager", |
| "//zircon/system/ulib/devmgr-integration-test", |
| "//zircon/system/ulib/fdio-caller", |
| "//zircon/system/ulib/fs-management", |
| "//zircon/system/ulib/ramdevice-client", |
| "//zircon/system/ulib/zxcrypt:zxcrypt-fdio", |
| ] |
| } |
| |
| # This is required so that the IsolatedDevmgr can properly start up devcoordinator and fshost, |
| # as the package loader service needs access to their binaries. |
| devmgr_manifest("devmgr-manifest") { |
| } |
| |
| test_package("factory_reset_tests") { |
| deps = [ |
| ":devmgr-manifest", |
| ":factory_reset_unittests", |
| ] |
| |
| extra = [ "$target_gen_dir/devmgr.manifest" ] |
| |
| tests = [ |
| { |
| name = "factory_reset_unittests" |
| environments = [ astro_env ] + basic_envs |
| }, |
| ] |
| } |