blob: 99a06f67921c7cd67d41b0e2a37f3250e608e77c [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/board.gni")
import("//build/components.gni")
import("//build/dist/resource.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_library.gni")
import("//build/testing/environments.gni")
import("//src/recovery/system/system_recovery_args.gni")
import("//src/sys/core/build/core_shard.gni")
# Generate rust library for the config
fuchsia_component_manifest("ui_config_manifest") {
# Note: This component name is unused since this manifest target is only added to
# generate the rust config library
component_name = "config_system_recovery"
# Config structure is currently defined in this shard
manifest = "meta/shards/ui.shard.cml"
}
fuchsia_structured_config_rust_lib("recovery_ui_config") {
cm_label = ":ui_config_manifest"
}
group("system") {
testonly = true
deps = [
":system_recovery",
":system_recovery_tests",
]
}
group("fdr") {
testonly = true
deps = [
":fdr_lib_unittests",
":system_recovery_fdr",
# TODO(https://fxbug.dev/42054096): Handle FDR via integration tests.
# ":system_recovery_fdr_test",
]
}
group("installer") {
testonly = true
deps = [
":system_recovery_installer",
# TODO(https://fxbug.dev/42053153): This directive does not pick up any tests.
#":system_recovery_installer_tests",
]
}
group("ota") {
testonly = true
deps = [
":component_ota",
":ota_lib_unittests",
":ota_unittests",
]
}
group("tests") {
testonly = true
deps = [
":fdr",
":installer",
":ota",
":system",
]
}
core_shard("system_recovery_core_shard") {
shard_file = "meta/core_shards/system_recovery.core_shard.cml"
}
core_shard("system_recovery_fdr_core_shard") {
shard_file = "meta/core_shards/system_recovery_fdr.core_shard.cml"
}
core_shard("system_recovery_installer_core_shard") {
shard_file = "meta/core_shards/system_recovery_installer.core_shard.cml"
}
resource("recovery_logo") {
sources = [ recovery_logo_path ]
outputs = [ "data/logo.riv" ]
}
resource("icons") {
sources = [ icons_path ]
outputs = [ "data/ota_icons.riv" ]
}
resource("instructions") {
sources = [ instructions_path ]
outputs = [ "data/instructions.txt" ]
}
resource("qr_codes") {
sources = [ qr_codes_path ]
outputs = [ "data/qr_codes.riv" ]
}
resource("roboto_regular") {
sources = [ "//prebuilt/third_party/fonts/roboto/Roboto-Regular.ttf" ]
outputs = [ "data/fonts/Roboto-Regular.ttf" ]
}
rustc_library("fdr_lib") {
edition = "2021"
with_unit_tests = true
deps = [
"//sdk/fidl/fuchsia.input.report:fuchsia.input.report_rust",
"//sdk/fidl/fuchsia.paver:fuchsia.paver_rust",
"//sdk/fidl/fuchsia.recovery:fuchsia.recovery_rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-component",
"//src/lib/ui/carnelian",
"//third_party/rust_crates:anyhow",
]
test_deps = [
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:futures",
]
source_root = "src/fdr.rs"
sources = [ "src/fdr.rs" ]
}
fuchsia_unittest_package("fdr_lib_unittests") {
deps = [ ":fdr_lib_test" ]
}
rustc_library("ota_lib") {
edition = "2021"
with_unit_tests = true
deps = [
":fdr_lib",
"//sdk/fidl/fuchsia.boot:fuchsia.boot_rust",
"//sdk/fidl/fuchsia.buildinfo:fuchsia.buildinfo_rust",
"//sdk/fidl/fuchsia.component:fuchsia.component_rust",
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust",
"//sdk/fidl/fuchsia.fshost:fuchsia.fshost_rust",
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//sdk/fidl/fuchsia.logger:fuchsia.logger_rust",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-hyper",
"//src/lib/syslog/rust:syslog-listener",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/storage/lib/vfs/rust:vfs",
"//src/sys/pkg/lib/isolated-ota",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:bytes",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:hyper",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:tempfile",
]
test_deps = [
"//src/lib/fuchsia",
"//src/lib/fuchsia-runtime",
"//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-boot-arguments:lib",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:maplit",
"//third_party/rust_crates:pretty_assertions",
]
source_root = "src/ota_lib.rs"
sources = [
"src/config.rs",
"src/ota.rs",
"src/ota_lib.rs",
"src/setup.rs",
"src/storage.rs",
]
}
fuchsia_unittest_package("ota_lib_unittests") {
deps = [ ":ota_lib_test" ]
}
rustc_binary("bin") {
name = "system_recovery"
edition = "2021"
with_unit_tests = true
deps = [
":fdr_lib",
":ota_lib",
":recovery_ui_config",
"//sdk/fidl/fuchsia.input.report:fuchsia.input.report_rust",
"//sdk/fidl/fuchsia.recovery.policy:fuchsia.recovery.policy_rust",
"//sdk/fidl/fuchsia.recovery.ui:fuchsia.recovery.ui_rust",
"//sdk/fidl/fuchsia.wlan.policy:fuchsia.wlan.policy_rust",
"//src/graphics/lib/compute/rive-rs",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-runtime",
"//src/lib/ui/carnelian",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/recovery/lib/recovery-ui",
"//src/recovery/lib/recovery-util",
"//src/sys/lib/stdout-to-debuglog/rust",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:async-channel",
"//third_party/rust_crates:euclid",
"//third_party/rust_crates:futures",
]
test_deps = [
"//src/lib/fuchsia",
"//src/storage/testing:storage_driver_test_realm",
"//third_party/rust_crates:async-trait",
]
features = [
"debug_console",
"http_setup_server",
]
sources = [ "src/main.rs" ]
if (enable_recovery_ui_v2) {
deps += [
":icons",
":qr_codes",
]
features += [ "ota_ui" ]
sources += [ "src/ui_v2.rs" ]
}
}
rustc_binary("bin_ota") {
name = "system_recovery_ota"
edition = "2021"
with_unit_tests = true
source_root = "src/ota_main.rs"
deps = [
":ota_lib",
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//sdk/fidl/fuchsia.recovery.ui:fuchsia.recovery.ui_rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-runtime",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/storage/lib/vfs/rust:vfs",
"//src/sys/lib/stdout-to-debuglog/rust",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
]
features = [
"http_setup_server",
"debug_console",
]
test_deps = [ "//third_party/rust_crates:assert_matches" ]
sources = [ "src/ota_main.rs" ]
}
# Start system_recovery_ota component
fuchsia_component_manifest("manifest_ota") {
component_name = "system_recovery_ota"
manifest = "meta/system_recovery_ota.cml"
}
fuchsia_component("component_ota") {
cm_label = ":manifest_ota"
deps = [
":bin_ota",
"//src/storage/blobfs/bin:blobfs-component",
"//src/sys/pkg/lib/isolated-swd:pkg-component",
]
}
fuchsia_unittest_package("ota_unittests") {
deps = [ ":bin_ota_test" ]
}
# End system_recovery_ota component
# Start system_recovery component
fuchsia_component_manifest("manifest") {
component_name = "system_recovery"
manifest = "meta/system_recovery.cml"
}
fuchsia_component("component") {
cm_label = ":manifest"
deps = [
":bin",
":instructions",
":recovery_logo",
":roboto_regular",
]
}
fuchsia_structured_config_values("values_from_gn") {
cm_label = ":manifest"
values = {
display_rotation = board_display_rotation
}
}
fuchsia_package("system_recovery") {
deps = [
":component",
":component_ota",
":values_from_gn",
]
}
# End system_recovery component
rustc_binary("bin_fdr") {
name = "system_recovery_fdr"
edition = "2021"
with_unit_tests = true
deps = [
":fdr_lib",
":recovery_ui_config",
"//sdk/fidl/fuchsia.input.report:fuchsia.input.report_rust",
"//sdk/fidl/fuchsia.recovery.policy:fuchsia.recovery.policy_rust",
"//src/graphics/lib/compute/rive-rs",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/ui/carnelian",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/recovery/lib/recovery-ui",
"//src/sys/lib/stdout-to-debuglog/rust",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:euclid",
"//third_party/rust_crates:futures",
]
test_deps = [ "//src/lib/fuchsia" ]
sources = [ "src/main.rs" ]
}
# Start system_recovery_fdr component TODO(https://fxbug.dev/42056807)
fuchsia_component_manifest("manifest_fdr") {
component_name = "system_recovery_fdr"
manifest = "meta/system_recovery_fdr.cml"
}
fuchsia_component("component_fdr") {
cm_label = ":manifest_fdr"
deps = [
":bin_fdr",
":instructions",
":recovery_logo",
":roboto_regular",
]
}
fuchsia_structured_config_values("values_from_gn_fdr") {
cm_label = ":manifest_fdr"
values = {
display_rotation = board_display_rotation
}
}
fuchsia_package("system_recovery_fdr") {
deps = [
":component_fdr",
":values_from_gn_fdr",
]
}
# End system_recovery_fdr component
fuchsia_test_component("system_recovery_bin_test") {
deps = [ ":bin_test" ]
manifest = "meta/tests/system_recovery_bin_test.cml"
}
fuchsia_test_package("system_recovery_tests") {
test_components = [ ":system_recovery_bin_test" ]
deps = [
":instructions",
":recovery_logo",
":roboto_regular",
"//src/sys/pkg/lib/fuchsia-pkg-testing/certs",
"//src/sys/pkg/tests/pkg-resolver:empty-repo",
]
test_specs = {
environments = [ nuc_env ]
log_settings = {
max_severity = "ERROR"
}
}
}
rustc_binary("bin_installer") {
name = "system_recovery_installer"
edition = "2021"
source_root = "installer/main.rs"
with_unit_tests = true
deps = [
":recovery_ui_config",
"//sdk/fidl/fuchsia.boot:fuchsia.boot_rust",
"//sdk/fidl/fuchsia.hardware.display:fuchsia.hardware.display_rust",
"//src/graphics/lib/compute/rive-rs",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-fs",
"//src/lib/ui/carnelian",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/recovery/lib/installer",
"//src/recovery/lib/recovery-util-block",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:euclid",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:tracing",
]
test_deps = [ "//src/storage/testing:storage_driver_test_realm" ]
sources = [
"installer/main.rs",
"installer/menu.rs",
]
}
# Start system_recovery_installer component
fuchsia_component_manifest("manifest_installer") {
component_name = "system_recovery_installer"
manifest = "meta/system_recovery_installer.cml"
}
fuchsia_component("component_installer") {
cm_label = ":manifest_installer"
deps = [
":bin_installer",
":instructions",
":recovery_logo",
":roboto_regular",
]
}
fuchsia_structured_config_values("values_from_gn_installer") {
cm_label = ":manifest_installer"
values = {
display_rotation = board_display_rotation
}
}
fuchsia_package("system_recovery_installer") {
deps = [
":component_installer",
":values_from_gn_installer",
]
}
# End system_recovery_installer component
fuchsia_component("system_recovery_installer_bin_test") {
testonly = true
deps = [ ":bin_installer_test" ]
manifest = "meta/tests/system_recovery_installer_bin_test.cml"
}
fuchsia_test_package("system_recovery_installer_tests") {
test_components = [ ":system_recovery_installer_bin_test" ]
deps = [
":instructions",
":recovery_logo",
":roboto_regular",
"//src/sys/pkg/lib/fuchsia-pkg-testing/certs",
"//src/sys/pkg/tests/pkg-resolver:empty-repo",
]
test_specs = {
environments = [ nuc_env ]
log_settings = {
max_severity = "ERROR"
}
}
}