blob: ee987742d6b71a90b357e97d0f32ec97895dc44d [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/config.gni")
import("//build/package.gni")
import("//build/test.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
import("//zircon/system/ulib/devmgr-integration-test/isolated_devmgr.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/hardware/power/statecontrol/cpp/fidl.h>
"//sdk/fidl/fuchsia.hardware.power.statecontrol",
# <factory_reset.h> has #include <fbl/unique_fd.h>
"//zircon/public/lib/fbl",
]
deps = [
"//sdk/fidl/fuchsia.device:fuchsia.device_c",
"//sdk/fidl/fuchsia.hardware.block:fuchsia.hardware.block_c",
"//sdk/fidl/fuchsia.hardware.block.encrypted:fuchsia.hardware.block.encrypted_c",
"//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_c",
"//sdk/lib/fdio",
"//src/security/zxcrypt:zxcrypt-fdio",
"//zircon/public/lib/zx",
"//zircon/system/ulib/fdio-caller",
"//zircon/system/ulib/fs-management",
"//zircon/system/ulib/fzl",
"//zircon/system/ulib/kms-stateless",
]
}
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",
]
}
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(fxbug.dev/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.device:fuchsia.device_llcpp",
"//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume_c",
"//sdk/fidl/fuchsia.hardware.power.statecontrol",
"//src/lib/fxl/test:gtest_main",
"//src/security/zxcrypt:zxcrypt-fdio",
"//zircon/public/lib/fbl",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/devmgr-integration-test",
"//zircon/system/ulib/fdio-caller",
"//zircon/system/ulib/fs-management",
"//zircon/system/ulib/fzl",
"//zircon/system/ulib/ramdevice-client",
]
}
isolated_devmgr_unittest_package("factory-reset-tests") {
executable_path = "test/factory_reset_unittests"
test_specs = {
environments = [
astro_env,
emu_env,
]
}
deps = [
":factory_reset_unittests",
"//src/devices/block/drivers/core",
"//src/devices/block/drivers/ftl",
"//src/devices/block/drivers/fvm",
"//src/devices/block/drivers/ramdisk",
"//src/devices/block/drivers/zxcrypt",
"//src/devices/misc/drivers/test",
"//src/devices/tests/sysdev",
]
}
group("factory_reset_tests") {
testonly = true
deps = [ ":factory-reset-tests" ]
}