blob: ec8a0899422c661d7718f4df5d83d8a552823a95 [file] [log] [blame]
# Copyright 2017 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/rust/rustc_binary.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
import("//src/recovery/system/system_recovery_args.gni")
group("system") {
testonly = true
deps = [
# Directory aggregates should not modify the product behavior: ":config",
":system_recovery",
":tests",
]
}
group("fdr") {
testonly = true
deps = [
":system-recovery-fdr",
":tests",
]
}
group("tests") {
testonly = true
deps = [
":system_recovery",
":system_recovery_tests",
"//src/lib/storage/ramdevice_client:ramdisk-isolated-devmgr",
"//src/sys/pkg/lib/isolated-swd:isolated-swd-components",
]
}
rustc_binary("bin") {
name = "system_recovery"
edition = "2018"
with_unit_tests = true
deps = [
"//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume-rustc",
"//sdk/fidl/fuchsia.input.report:fuchsia.input.report-rustc",
"//sdk/fidl/fuchsia.io:fuchsia.io-rustc",
"//sdk/fidl/fuchsia.paver:fuchsia.paver-rustc",
"//sdk/fidl/fuchsia.recovery:fuchsia.recovery-rustc",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-hyper",
"//src/lib/mapped-vmo",
"//src/lib/storage/fs_management",
"//src/lib/ui/carnelian",
"//src/lib/ui/fuchsia-framebuffer",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/sys/pkg/lib/isolated-ota",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:euclid",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:hyper",
"//third_party/rust_crates:png",
"//third_party/rust_crates:rouille",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:tempfile",
"//third_party/rust_crates:thiserror",
]
test_deps = [
"//src/lib/storage/ramdevice_client",
"//src/sys/lib/fidl-fuchsia-pkg-ext",
"//src/sys/pkg/lib/fuchsia-merkle",
"//src/sys/pkg/lib/fuchsia-pkg-testing",
"//src/sys/pkg/testing/blobfs-ramdisk",
"//src/sys/pkg/testing/mock-paver",
]
features = [ "http_setup_server" ]
sources = [
"src/fdr.rs",
"src/main.rs",
"src/ota.rs",
"src/setup.rs",
"src/storage.rs",
]
}
rustc_binary("bin_fdr") {
name = "system_recovery_fdr"
edition = "2018"
with_unit_tests = true
deps = [
"//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume-rustc",
"//sdk/fidl/fuchsia.input.report:fuchsia.input.report-rustc",
"//sdk/fidl/fuchsia.paver:fuchsia.paver-rustc",
"//sdk/fidl/fuchsia.recovery:fuchsia.recovery-rustc",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/mapped-vmo",
"//src/lib/storage/fs_management",
"//src/lib/ui/carnelian",
"//src/lib/ui/fuchsia-framebuffer",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:euclid",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:png",
"//third_party/rust_crates:rouille",
"//third_party/rust_crates:thiserror",
]
sources = [
"src/fdr.rs",
"src/main.rs",
]
}
config_data("config") {
for_pkg = "sysmgr"
sources = [ "config/recovery.config" ]
outputs = [ "recovery.config" ]
}
config_data("config_fdr") {
for_pkg = "sysmgr"
sources = [ "config/recovery_fdr.config" ]
outputs = [ "recovery_fdr.config" ]
}
package("system_recovery") {
meta = [
{
path = rebase_path("meta/system_recovery.cmx")
dest = "system_recovery.cmx"
},
]
deps = [
":bin",
"//garnet/go/src/grand_unified_binary",
"//src/storage/bin/blobfs",
"//src/storage/bin/minfs",
]
binaries = [
{
name = "blobfs"
},
{
name = "minfs"
},
{
name = "system_recovery"
path = "system_recovery"
},
{
name = "pkgsvr"
source = "grand_unified_binary"
},
]
resources = [
{
path = rebase_path(recovery_logo_path)
dest = "logo.png"
},
{
path =
rebase_path("//prebuilt/third_party/fonts/roboto/Roboto-Regular.ttf")
dest = "fonts/Roboto-Regular.ttf"
},
]
}
package("system-recovery-fdr") {
meta = [
{
path = rebase_path("meta/system_recovery_fdr.cmx")
dest = "system_recovery_fdr.cmx"
},
]
deps = [
":bin_fdr",
"//src/storage/bin/blobfs",
"//src/storage/bin/minfs",
]
binaries = [
{
name = "blobfs"
},
{
name = "minfs"
},
{
name = "system_recovery_fdr"
path = "system_recovery_fdr"
},
]
resources = [
{
path = rebase_path(recovery_logo_path)
dest = "logo.png"
},
{
path =
rebase_path("//prebuilt/third_party/fonts/roboto/Roboto-Regular.ttf")
dest = "fonts/Roboto-Regular.ttf"
},
]
}
generate_manifest("empty-repo.manifest") {
visibility = [ ":*" ]
testonly = true
sources = []
args = []
foreach(path,
[
"keys/root.json",
"keys/snapshot.json",
"keys/targets.json",
"keys/timestamp.json",
"repository/1.root.json",
"repository/1.snapshot.json",
"repository/1.targets.json",
"repository/root.json",
"repository/snapshot.json",
"repository/targets.json",
"repository/timestamp.json",
]) {
source = "//src/sys/pkg/tests/pkg-resolver/template/${path}"
sources += [ source ]
args += [ "--entry=empty-repo/${path}=" + rebase_path(source) ]
}
}
empty_repo_manifest_outputs = get_target_outputs(":empty-repo.manifest")
empty_repo_manifest = empty_repo_manifest_outputs[0]
test_package("system_recovery_tests") {
extra = [ empty_repo_manifest ]
deps = [
":bin_test",
":empty-repo.manifest",
"//garnet/go/src/grand_unified_binary",
"//src/storage/bin/blobfs",
"//src/storage/bin/minfs",
"//src/sys/pkg/bin/pm:pm_bin",
]
binaries = [
{
name = "blobfs"
},
{
name = "minfs"
},
{
name = "pkgsvr"
source = "grand_unified_binary"
},
{
name = "pm"
},
]
resources = [
{
path = rebase_path("//src/sys/pkg/lib/fuchsia-pkg-testing/certs/ca.cert")
dest = "ssl/cert.pem"
},
{
path = rebase_path(recovery_logo_path)
dest = "logo.png"
},
{
path =
rebase_path("//prebuilt/third_party/fonts/roboto/Roboto-Regular.ttf")
dest = "fonts/Roboto-Regular.ttf"
},
]
tests = [
{
name = "system_recovery_bin_test"
environments = [ nuc_env ]
},
]
}