blob: 99775a7fc6c7a6c912e47664e45e3dba579e1a4d [file] [log] [blame]
# 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/sys/core/build/core_shard.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.fs",
"//sdk/fidl/fuchsia.hardware.power.statecontrol",
# <factory_reset.h> has #include <fuchsia/hardware/power/statecontrol/cpp/fidl.h>
"//sdk/fidl/fuchsia.recovery",
# <factory_reset.h> has #include <fbl/unique_fd.h>
"//zircon/system/ulib/fbl",
]
deps = [
"//sdk/fidl/fuchsia.hardware.block",
"//sdk/lib/fdio",
"//sdk/lib/syslog/cpp",
"//src/lib/storage/fs_management",
"//src/security/kms-stateless",
"//src/security/zxcrypt:zxcrypt-client",
"//zircon/system/ulib/fdio-caller",
"//zircon/system/ulib/fzl",
"//zircon/system/ulib/zx",
]
}
executable("bin") {
output_name = "factory_reset"
sources = [ "main.cc" ]
deps = []
public_deps = [
":lib",
"//sdk/lib/fidl/cpp",
"//sdk/lib/sys/cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
]
}
executable("fdr") {
sources = [ "cli_main.cc" ]
public_deps = [
"//sdk/fidl/fuchsia.recovery",
"//sdk/lib/sys/cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
]
}
core_shard("factory_reset_core_shard") {
shard_file = "meta/factory_reset.core_shard.cml"
}
fuchsia_package_with_single_component("factory_reset_pkg") {
package_name = "factory_reset"
manifest = "meta/factory_reset.cml"
deps = [ ":bin" ]
}
group("factory_reset") {
deps = [ ":factory_reset_pkg" ]
}
fuchsia_shell_package("fdr_cli") {
deps = [ ":fdr" ]
}
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.device:fuchsia.device_llcpp",
"//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume_llcpp",
"//sdk/fidl/fuchsia.hardware.power.statecontrol",
"//src/devices/testing/driver-integration-test-shim",
"//src/lib/fxl/test:gtest_main",
"//src/lib/storage/fs_management",
"//src/lib/storage/ramdevice_client/cpp",
"//src/security/fcrypto",
"//src/security/zxcrypt:zxcrypt-client",
"//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",
"//zircon/system/ulib/fzl",
]
# TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated.
# Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>).
# See linked bug for details.
configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ]
# TODO(fxbug.dev/95833): This target uses the deprecated C bindings.
# Consider switching to the C++ bindings. See linked bug for details.
configs += [ "//build/c:fidl-deprecated-c-bindings" ]
}
fuchsia_unittest_package("factory-reset-tests") {
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" ]
}