| # 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("//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 = [ | 
 |     "//zircon/public/lib/fdio", | 
 |     "//zircon/public/lib/fs-management", | 
 |     "//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/fidl/fuchsia-sysinfo:fuchsia-sysinfo_c", | 
 |   ] | 
 | } | 
 |  | 
 | 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") { | 
 |   output_name = "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") { | 
 |   deps = [ | 
 |     ":bin", | 
 |     ":fdr", | 
 |   ] | 
 |  | 
 |   binaries = [ | 
 |     { | 
 |       name = "factory_reset" | 
 |     }, | 
 |     { | 
 |       name = "fdr" | 
 |       shell = true | 
 |     }, | 
 |   ] | 
 |  | 
 |   meta = [ | 
 |     { | 
 |       path = rebase_path("meta/factory_reset.cmx") | 
 |       dest = "factory_reset.cmx" | 
 |     }, | 
 |   ] | 
 | } | 
 |  | 
 | group("configs") { | 
 |   deps = [ ":factory_reset_config" ] | 
 | } | 
 |  | 
 | config_data("factory_reset_config") { | 
 |   for_pkg = "sysmgr" | 
 |   outputs = [ "factory_reset.config" ] | 
 |   sources = [ "service.config" ] | 
 | } | 
 |  | 
 | group("tests") { | 
 |   testonly = true | 
 |   deps = [ ":factory_reset_tests" ] | 
 | } | 
 |  | 
 | test("factory_reset_unittests") { | 
 |   testonly = true | 
 |   sources = [ "factory_reset_unittest.cc" ] | 
 |  | 
 |   deps = [ | 
 |     ":lib", | 
 |     "//src/lib/fxl/test:gtest_main", | 
 |     "//zircon/public/lib/async-loop-cpp", | 
 |     "//zircon/public/lib/async-loop-default", | 
 |     "//zircon/public/lib/devmgr-integration-test", | 
 |     "//zircon/public/lib/fbl", | 
 |     "//zircon/public/lib/fs-management", | 
 |     "//zircon/public/lib/fzl", | 
 |     "//zircon/public/lib/ramdevice-client", | 
 |     "//zircon/system/fidl/fuchsia-device-manager", | 
 |     "//zircon/system/fidl/fuchsia-hardware-block-volume:fuchsia-hardware-block-volume_c", | 
 |   ] | 
 | } | 
 |  | 
 | # 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 = basic_envs | 
 |     }, | 
 |   ] | 
 | } |