blob: 15ab0ccde13008c51fce3b581014ba0722fb508b [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")
# 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("fdr") {
testonly = true
deps = [
":fdr_lib_unittests",
":system_recovery_fdr",
]
}
group("tests") {
testonly = true
deps = [
":fdr_lib_unittests",
":ota_lib_unittests",
]
}
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 = [
"//sdk/rust/zx",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//third_party/rust_crates:futures",
]
source_root = "src/fdr.rs"
sources = [ "src/fdr.rs" ]
}
fuchsia_unittest_package("fdr_lib_unittests") {
deps = [ ":fdr_lib_test" ]
}
# This is used by system_recovery_fdr via the following path:
#
# system_recovery_fdr ->
# //src/recovery/lib/recovery-ui ->
# //src/recovery/lib/recovery-util ->
# //src/recovery/system:ota_lib
#
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.diagnostics:fuchsia.diagnostics_rust",
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//sdk/fidl/fuchsia.logger:fuchsia.logger_rust",
"//sdk/rust/zx",
"//src/lib/diagnostics/data/rust",
"//src/lib/diagnostics/reader/rust",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-hyper",
"//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 = [
"//sdk/fidl/fuchsia.mem:fuchsia.mem_rust",
"//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",
"//third_party/rust_crates:url",
]
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_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",
"//sdk/rust/zx",
"//src/graphics/lib/compute/rive-rs",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/ui/carnelian",
"//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" ]
}
fuchsia_package("system_recovery_fdr") {
deps = [
":component_fdr",
":roboto_regular",
]
}
fuchsia_component_manifest("manifest_android") {
component_name = "system_recovery_android"
manifest = "meta/system_recovery_android.cml"
}
fuchsia_component("component_android") {
cm_label = ":manifest_android"
deps = [ "android:bin" ]
}
fuchsia_package("system_recovery_android") {
deps = [
":component_android",
":roboto_regular",
"//src/sys/pkg/lib/isolated-swd:pkg-component",
]
}