| # 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/package.gni") |
| import("//build/test.gni") |
| import("//build/test/test_package.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/public/fidl/fuchsia-device-manager", |
| |
| # <factory_reset.h> has #include <fbl/unique_fd.h> |
| "//zircon/public/lib/fbl", |
| ] |
| |
| deps = [ |
| "//zircon/public/fidl/fuchsia-device:fuchsia-device_c", |
| "//zircon/public/fidl/fuchsia-hardware-block:fuchsia-hardware-block_c", |
| "//zircon/public/fidl/fuchsia-sysinfo:fuchsia-sysinfo_c", |
| "//zircon/public/lib/fdio", |
| "//zircon/public/lib/fs-management", |
| "//zircon/public/lib/fzl", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| 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", |
| ] |
| } |
| |
| 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", |
| ] |
| } |
| |
| 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("tests") { |
| testonly = true |
| deps = [ |
| ":factory_reset_tests", |
| ] |
| } |
| |
| test("factory_reset_unittests") { |
| testonly = true |
| sources = [ |
| "factory_reset_unittest.cc", |
| ] |
| |
| deps = [ |
| ":lib", |
| "//third_party/googletest:gtest_main", |
| "//zircon/public/fidl/fuchsia-device-manager", |
| "//zircon/public/fidl/fuchsia-hardware-block-volume:fuchsia-hardware-block-volume_c", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/devmgr-integration-test", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fs-management", |
| "//zircon/public/lib/fzl", |
| "//zircon/public/lib/ramdevice-client", |
| ] |
| } |
| |
| # This is required so that the IsolatedDevmgr can properly start up devcoordinator and fshost, |
| # as the package loader service needs access to their binaries. |
| action("devmgr-manifest") { |
| visibility = [ ":*" ] |
| sources = zircon_boot_manifests |
| outputs = [ |
| "$target_gen_dir/devmgr.manifest", |
| ] |
| script = "//build/images/manifest.py" |
| args = [ |
| "--include=bin/devcoordinator", |
| "--include=bin/fshost", |
| "--output=" + rebase_path(outputs[0], root_build_dir), |
| ] |
| foreach(manifest, sources) { |
| args += [ |
| "--cwd=" + rebase_path(get_path_info(manifest, "dir"), root_build_dir), |
| "--manifest=" + rebase_path(manifest, root_build_dir), |
| ] |
| } |
| } |
| |
| 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 |
| }, |
| ] |
| } |