blob: 7023b18df9f368dc8b5aec87206e35f80d6cd75a [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/rust/rustc_binary.gni")
import("//build/rust/rustc_macro.gni")
import("//build/rust/rustc_test.gni")
declare_args() {
# Whether wayland protocol logging should be enabled
starnix_wayland_protocol_logging = false
}
group("starnix") {
if (target_cpu == "x64") {
deps = [ ":starnix_package" ]
}
}
group("tests") {
testonly = true
if (target_cpu == "x64") {
deps = [ ":starnix-tests" ]
}
}
if (target_cpu == "x64") {
rustc_binary("starnix_runner_bin") {
name = "starnix_runner"
edition = "2018"
with_unit_tests = true
source_root = "main.rs"
deps = [
":starnix_runner_config",
"//sdk/fidl/fuchsia.component:fuchsia.component-rustc",
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl-rustc",
"//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner-rustc",
"//sdk/fidl/fuchsia.io:fuchsia.io-rustc",
"//sdk/fidl/fuchsia.kernel:fuchsia.kernel-rustc",
"//sdk/fidl/fuchsia.mem:fuchsia.mem-rustc",
"//sdk/fidl/fuchsia.process:fuchsia.process-rustc",
"//sdk/fidl/fuchsia.starnix.developer:fuchsia.starnix.developer-rustc",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc",
"//sdk/fidl/fuchsia.sysmem:fuchsia.sysmem-rustc",
"//sdk/fidl/fuchsia.ui.app:fuchsia.ui.app-rustc",
"//sdk/fidl/fuchsia.ui.composition:fuchsia.ui.composition-rustc",
"//sdk/fidl/fuchsia.virtualization:fuchsia.virtualization-rustc",
"//sdk/fidl/fuchsia.wayland:fuchsia.wayland-rustc",
"//src/graphics/lib/magma/src/libmagma",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-image-format",
"//src/lib/fuchsia-runtime",
"//src/lib/fuchsia-url",
"//src/lib/process_builder",
"//src/lib/ui/fuchsia-scenic",
"//src/lib/ui/fuchsia-vulkan",
"//src/lib/ui/wayland/server",
"//src/lib/vulkan",
"//src/lib/zerocopy",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/proc/lib/linux_uapi",
"//src/proc/lib/magma",
"//src/proc/lib/syncio",
"//src/storage/ext4/read-only:ext4-read-only",
"//src/sys/lib/library_loader",
"//src/sys/lib/runner",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:bitflags",
"//third_party/rust_crates:derivative",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:log",
"//third_party/rust_crates:maplit",
"//third_party/rust_crates:memchr",
"//third_party/rust_crates:memoffset",
"//third_party/rust_crates:once_cell",
"//third_party/rust_crates:parking_lot",
"//third_party/rust_crates:paste",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:scopeguard",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:slab",
"//third_party/rust_crates:tracing",
"//third_party/rust_crates:vk-sys",
]
if (is_debug) {
deps += [ "//third_party/rust_crates:tracing-mutex" ]
}
test_deps = [
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:itertools",
"//third_party/rust_crates:tracing-mutex",
]
sources = [
"auth.rs",
"collections/mod.rs",
"collections/range_map.rs",
"device/binder.rs",
"device/features.rs",
"device/logd.rs",
"device/magma/device.rs",
"device/magma/ffi.rs",
"device/magma/file.rs",
"device/magma/magma.rs",
"device/magma/mod.rs",
"device/mem.rs",
"device/mod.rs",
"device/registry.rs",
"device/terminal.rs",
"device/wayland/bridge_client.rs",
"device/wayland/buffer_collection_file.rs",
"device/wayland/dma_buf_file.rs",
"device/wayland/file_creation.rs",
"device/wayland/image_file.rs",
"device/wayland/mod.rs",
"device/wayland/vulkan.rs",
"device/wayland/wayland.rs",
"execution/component_runner.rs",
"execution/exception_executor.rs",
"execution/galaxy.rs",
"execution/mod.rs",
"execution/serve_protocols.rs",
"execution/shared.rs",
"fs/anon_node.rs",
"fs/buffers/message_queue.rs",
"fs/buffers/message_types.rs",
"fs/buffers/mod.rs",
"fs/devpts.rs",
"fs/devtmpfs.rs",
"fs/dir_entry.rs",
"fs/directory_file.rs",
"fs/dirent_sink.rs",
"fs/epoll.rs",
"fs/eventfd.rs",
"fs/ext4.rs",
"fs/fd_events.rs",
"fs/fd_number.rs",
"fs/fd_table.rs",
"fs/file_object.rs",
"fs/file_system.rs",
"fs/fs_context.rs",
"fs/fs_node.rs",
"fs/fuchsia/mod.rs",
"fs/fuchsia/remote.rs",
"fs/fuchsia/syslog.rs",
"fs/fuchsia/timer.rs",
"fs/memfd.rs",
"fs/mod.rs",
"fs/namespace.rs",
"fs/null_file.rs",
"fs/path.rs",
"fs/pipe.rs",
"fs/proc/directory.rs",
"fs/proc/fs.rs",
"fs/proc/mod.rs",
"fs/proc/pid_directory.rs",
"fs/proc/proc_directory.rs",
"fs/seq_file.rs",
"fs/simple_file.rs",
"fs/socket/mod.rs",
"fs/socket/socket.rs",
"fs/socket/socket_file.rs",
"fs/socket/socket_fs.rs",
"fs/socket/socket_inet.rs",
"fs/socket/socket_types.rs",
"fs/socket/socket_unix.rs",
"fs/socket/socket_vsock.rs",
"fs/socket/syscalls.rs",
"fs/symlink_node.rs",
"fs/syscalls.rs",
"fs/sysfs.rs",
"fs/tmpfs.rs",
"fs/vmo_file.rs",
"fs/xattr.rs",
"loader.rs",
"lock.rs",
"logging.rs",
"main.rs",
"mm/futex_table.rs",
"mm/memory_manager.rs",
"mm/mod.rs",
"mm/syscalls.rs",
"mm/vmo.rs",
"mutable_state.rs",
"selinux.rs",
"signals/mod.rs",
"signals/signal_handling.rs",
"signals/signalfd.rs",
"signals/syscalls.rs",
"signals/types.rs",
"syscalls/decls.rs",
"syscalls/mod.rs",
"syscalls/syscall_result.rs",
"syscalls/system.rs",
"syscalls/table.rs",
"task/abstract_socket_namespace.rs",
"task/kernel.rs",
"task/mod.rs",
"task/pid_table.rs",
"task/process_group.rs",
"task/session.rs",
"task/syscalls.rs",
"task/task.rs",
"task/thread_group.rs",
"task/waiter.rs",
"testing.rs",
"types/as_any.rs",
"types/device_type.rs",
"types/errno.rs",
"types/file_mode.rs",
"types/ioctl.rs",
"types/mod.rs",
"types/mount_flags.rs",
"types/open_flags.rs",
"types/range_ext.rs",
"types/resource_limits.rs",
"types/signals.rs",
"types/time.rs",
"types/uapi.rs",
"types/union.rs",
"types/user_address.rs",
"types/user_buffer.rs",
"vmex_resource.rs",
]
features = []
if (starnix_wayland_protocol_logging) {
features += [ "wayland_protocol_logging" ]
}
}
# The starnix runner manifest, used by all galaxies.
fuchsia_component_manifest("starnix_runner_manifest") {
manifest = "meta/starnix_runner.cml"
restricted_features = [ "structured_config" ]
}
# The starnix runner configuration library, used by the Rust binary to parse configuration.
fuchsia_structured_config_rust_lib("starnix_runner_config") {
cm_label = ":starnix_runner_manifest"
}
resource("starnix-test-files") {
sources = [ "data/testfile.txt" ]
outputs = [ "data/testfile.txt" ]
}
fuchsia_unittest_package("starnix-tests") {
manifest = "meta/starnix-tests.cml"
deps = [
":starnix-test-files",
":starnix_runner_bin_test",
"//src/proc/examples/hello_starnix:bin",
]
test_specs = {
log_settings = {
# Tests exercise failure cases, so ERROR logs are expected.
max_severity = "ERROR"
}
}
}
}
fuchsia_component("starnix_manager") {
manifest = "meta/starnix_manager.cml"
}
fuchsia_package("starnix_package") {
package_name = "starnix"
deps = [ ":starnix_manager" ]
}