| # 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/components.gni") |
| import("//build/config.gni") |
| import("//build/test.gni") |
| import("//build/testing/environments.gni") |
| import("//src/storage/fshost/generated_fshost_config.gni") |
| import("//src/sys/core/build/core_shard.gni") |
| |
| source_set("lib") { |
| sources = [ |
| "factory_reset.cc", |
| "factory_reset.h", |
| ] |
| |
| public_deps = [ |
| # <factory_reset.h> has #include <fidl/fuchsia.fshost/cpp.wire.h> |
| "//sdk/fidl/fuchsia.fshost:fuchsia.fshost_cpp", |
| |
| # <factory_reset.h> has #include <fidl/fuchsia.hardware.power.statecontrol/cpp/wire.h> |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_cpp", |
| |
| # <factory_reset.h> has #include <fidl/fuchsia.recovery/cpp/wire.h> |
| ":factory_reset_config", |
| "//sdk/fidl/fuchsia.recovery:fuchsia.recovery_cpp", |
| ] |
| |
| deps = [ |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/syslog/cpp", |
| "//src/security/lib/kms-stateless", |
| "//src/security/lib/zxcrypt:zxcrypt-client", |
| "//src/storage/lib/block_client/cpp", |
| "//src/storage/lib/fs_management", |
| "//zircon/system/ulib/fdio-caller", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/zx", |
| ] |
| |
| visibility = [ ":*" ] |
| } |
| |
| executable("bin") { |
| output_name = "factory_reset" |
| |
| sources = [ "main.cc" ] |
| |
| deps = [ ":factory_reset_config" ] |
| public_deps = [ |
| ":lib", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| executable("fdr") { |
| sources = [ "cli_main.cc" ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.recovery:fuchsia.recovery_cpp", |
| "//sdk/lib/component/incoming/cpp", |
| ] |
| } |
| |
| core_shard("factory_reset_core_shard") { |
| shard_file = "meta/factory_reset.core_shard.cml" |
| } |
| |
| fuchsia_component_manifest("manifest") { |
| component_name = "factory_reset" |
| manifest = "meta/factory_reset.cml" |
| } |
| |
| fuchsia_structured_config_cpp_elf_lib("factory_reset_config") { |
| cm_label = ":manifest" |
| visibility = [ ":*" ] |
| } |
| |
| fuchsia_structured_config_values("config_values_from_gn") { |
| cm_label = ":manifest" |
| values = { |
| use_fxblob = fxfs_blob |
| } |
| visibility = [ ":*" ] |
| } |
| |
| fuchsia_package_with_single_component("factory_reset_pkg") { |
| package_name = "factory_reset" |
| cm_label = ":manifest" |
| deps = [ |
| ":bin", |
| ":config_values_from_gn", |
| ] |
| } |
| |
| group("factory_reset") { |
| deps = [ ":factory_reset_pkg" ] |
| } |
| |
| fuchsia_package("fdr_cli") { |
| deps = [ ":fdr" ] |
| } |
| |
| group("tools") { |
| deps = [ ":fdr_cli" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":factory_reset_tests_pkg" ] |
| } |
| |
| test("factory_reset_unittests") { |
| testonly = true |
| sources = [ "factory_reset_unittest.cc" ] |
| |
| deps = [ |
| ":lib", |
| "////src/lib/testing/loop_fixture", |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", |
| "//sdk/fidl/fuchsia.fshost:fuchsia.fshost_cpp_testing", |
| "//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume_cpp", |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_cpp_testing", |
| "//sdk/lib/component/incoming/cpp", |
| "//src/devices/testing/driver-integration-test-shim", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/uuid", |
| "//src/security/lib/fcrypto", |
| "//src/security/lib/zxcrypt:zxcrypt-client", |
| "//src/storage/lib/block_client/cpp", |
| "//src/storage/lib/fs_management", |
| "//src/storage/lib/ramdevice_client/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fdio-caller", |
| ] |
| } |
| |
| fuchsia_unittest_package("factory_reset_tests_pkg") { |
| test_specs = { |
| environments = [ |
| astro_env, |
| emu_env, |
| ] |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| |
| deps = [ |
| ":factory_reset_unittests", |
| "//src/devices/block/drivers/core", |
| "//src/devices/block/drivers/ftl", |
| "//src/devices/block/drivers/ramdisk", |
| "//src/devices/block/drivers/zxcrypt", |
| "//src/devices/bus/drivers/platform", |
| "//src/storage/fvm/driver", |
| ] |
| } |
| |
| group("factory_reset_tests") { |
| testonly = true |
| deps = [ ":factory_reset_tests_pkg" ] |
| } |