blob: 9297ccfc0da580fe776587379a3ed925654dfef0 [file] [log] [blame]
# Copyright 2021 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/dist/component_manifest_resources.gni")
import("//build/drivers.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_library.gni")
import("//src/bringup/bin/virtcon/virtcon_args.gni")
group("bootfs") {
deps = [
":bin",
":meta",
]
}
group("tests") {
testonly = true
deps = [ ":virtual_console_tests" ]
}
component_manifest_resources("meta") {
sources = [ "meta/virtual-console.cml" ]
}
rustc_library("lib") {
name = "virtual_console_lib"
edition = "2021"
with_unit_tests = true
sources = [
"src/app.rs",
"src/args.rs",
"src/colors.rs",
"src/lib.rs",
"src/log.rs",
"src/session_manager.rs",
"src/terminal.rs",
"src/text_grid.rs",
"src/view.rs",
]
deps = [
"//sdk/fidl/fuchsia.boot:fuchsia.boot_rust",
"//sdk/fidl/fuchsia.hardware.display:fuchsia.hardware.display_rust",
"//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust",
"//sdk/fidl/fuchsia.hardware.pty:fuchsia.hardware.pty_rust",
"//sdk/fidl/fuchsia.virtualconsole:fuchsia.virtualconsole_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/pty",
"//src/lib/trace/rust:trace",
"//src/lib/ui/carnelian",
"//src/lib/ui/terminal",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/alacritty/alacritty_terminal:term_model",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
]
}
resource("font") {
sources = [ virtcon_font_path ]
outputs = [ "data/font.ttf" ]
}
if (virtcon_bold_font_path != "") {
resource("bold_font") {
sources = [ virtcon_bold_font_path ]
outputs = [ "data/bold-font.ttf" ]
}
}
if (virtcon_italic_font_path != "") {
resource("italic_font") {
sources = [ virtcon_italic_font_path ]
outputs = [ "data/italic-font.ttf" ]
}
}
if (virtcon_bold_italic_font_path != "") {
resource("bold_italic_font") {
sources = [ virtcon_bold_italic_font_path ]
outputs = [ "data/bold-italic-font.ttf" ]
}
}
if (virtcon_fallback_font_paths != []) {
resource_group("fallback_fonts") {
files = []
suffix = 1
foreach(path, virtcon_fallback_font_paths) {
files += [
{
source = path
dest = "data/fallback-font-$suffix.ttf"
},
]
suffix += 1
}
}
}
resource("boot_animation") {
sources = [ virtcon_boot_animation_path ]
outputs = [ "data/boot-animation.riv" ]
}
rustc_binary("bin") {
name = "virtual_console"
edition = "2021"
source_root = "src/main.rs"
sources = [ "src/main.rs" ]
deps = [
":boot_animation",
":font",
":lib",
"//sdk/fidl/fuchsia.boot:fuchsia.boot_rust",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/trace/rust:trace-provider",
"//src/lib/ui/carnelian",
"//src/sys/lib/stdout-to-debuglog/rust",
"//third_party/rust_crates:anyhow",
]
if (virtcon_bold_font_path != "") {
deps += [ ":bold_font" ]
}
if (virtcon_italic_font_path != "") {
deps += [ ":italic_font" ]
}
if (virtcon_bold_italic_font_path != "") {
deps += [ ":bold_italic_font" ]
}
if (virtcon_fallback_font_paths != []) {
deps += [ ":fallback_fonts" ]
}
configs += [ "//build/config/rust:bootfs" ]
}
resource("font_test") {
sources = [ "data/test.ttf" ]
outputs = [ "data/font.ttf" ]
}
resource("boot_animation_test") {
sources = [ "data/test.riv" ]
outputs = [ "data/boot-animation.riv" ]
}
fuchsia_test_component("virtual_console_tests_component") {
deps = [
":boot_animation_test",
":font_test",
":lib_test",
"//src/bringup/bin/ptysvc:component",
]
manifest = "meta/virtual-console-tests.cml"
}
fuchsia_test_package("virtual_console_tests") {
test_components = [ ":virtual_console_tests_component" ]
}