blob: 3d488f9c73c7a2248f6f0a06932a2f19a6e15ca0 [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/assembly/bootfs_files_for_assembly.gni")
import("//build/components.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_library.gni")
import("//src/bringup/bin/virtcon/virtcon_args.gni")
# Mandatory portion of virtcon that's included in all products.
fuchsia_component("component") {
component_name = "virtual-console"
manifest = "meta/virtual-console.cml"
deps = [ ":bin" ]
}
fuchsia_package("package") {
package_name = "virtual-console"
deps = [
":component",
":font",
]
}
# The boot animation, which is added to all products, but the source path is
# controlled by product gni files.
# TODO(118048) Add Product Assembly feature to allow products to specify a path
# to the boot animation file to use.
bootfs_files_for_assembly("boot_animation") {
deps = [ ":boot_animation_resource" ]
}
resource("boot_animation_resource") {
sources = [ virtcon_boot_animation_path ]
outputs = [ "data/boot-animation.riv" ]
visibility = [ ":*" ]
}
group("tests") {
testonly = true
deps = [ ":virtual_console_tests" ]
}
# Extra fonts added to bootfs by workstation
group("extra_fonts") {
deps = [
":bold_font",
":bold_italic_font",
":italic_font",
]
}
#########
#
# Internal targets
#
# Set all targets below here to only be visible within this file.
visibility = [ ":*" ]
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 = [ "//prebuilt/third_party/fonts/robotomono/RobotoMono-Regular.ttf" ]
outputs = [ "data/font.ttf" ]
}
resource("bold_font") {
sources = [ "//prebuilt/third_party/fonts/robotomono/RobotoMono-Bold.ttf" ]
outputs = [ "data/bold-font.ttf" ]
}
resource("italic_font") {
sources = [ "//prebuilt/third_party/fonts/robotomono/RobotoMono-Italic.ttf" ]
outputs = [ "data/italic-font.ttf" ]
}
resource("bold_italic_font") {
sources =
[ "//prebuilt/third_party/fonts/robotomono/RobotoMono-BoldItalic.ttf" ]
outputs = [ "data/bold-italic-font.ttf" ]
}
rustc_binary("bin") {
name = "virtual_console"
edition = "2021"
source_root = "src/main.rs"
sources = [ "src/main.rs" ]
deps = [
":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",
]
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" ]
}