blob: e6c27ccb52e88e90c3b926f3848d6ed89bc2eeb0 [file] [log] [blame]
# Copyright 2018 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/product.gni")
import("//build/rust/rustc_library.gni")
import("//build/rust/rustc_staticlib.gni")
import("//build/testing/environments.gni")
config("trace_level_logging") {
rustflags = [ "--cfg=trace_level_logging" ]
visibility = [ ":*" ]
}
rustc_library("fuchsia-async") {
name = "fuchsia_async"
edition = "2021"
version = "0.1.0"
with_unit_tests = true
# TODO(fxbug.dev/97697) Remove --nocapture when this flake is found and fixed.
if (is_host) {
args = [ "--nocapture" ]
}
deps = [
"//src/lib/fuchsia-async-macro",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:pin-utils",
]
sources = [
"src/atomic_future.rs",
"src/handle/mod.rs",
"src/lib.rs",
"src/net/mod.rs",
"src/runtime/mod.rs",
"src/runtime/stub.rs",
"src/test_support.rs",
]
if (is_fuchsia) {
deps += [
"//src/lib/zerocopy",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:crossbeam",
"//third_party/rust_crates:libc",
"//third_party/rust_crates:parking_lot",
"//third_party/rust_crates:socket2",
]
if (fuchsia_async_trace_level_logging) {
configs += [ ":trace_level_logging" ]
deps += [ "//third_party/rust_crates:tracing" ]
}
sources += [
"src/handle/zircon/channel.rs",
"src/handle/zircon/fifo.rs",
"src/handle/zircon/mod.rs",
"src/handle/zircon/on_signals.rs",
"src/handle/zircon/rwhandle.rs",
"src/handle/zircon/socket.rs",
"src/net/fuchsia/mod.rs",
"src/net/fuchsia/tcp.rs",
"src/net/fuchsia/udp.rs",
"src/runtime/fuchsia/executor/common.rs",
"src/runtime/fuchsia/executor/instrumentation.rs",
"src/runtime/fuchsia/executor/local.rs",
"src/runtime/fuchsia/executor/mod.rs",
"src/runtime/fuchsia/executor/packets.rs",
"src/runtime/fuchsia/executor/send.rs",
"src/runtime/fuchsia/executor/time.rs",
"src/runtime/fuchsia/mod.rs",
"src/runtime/fuchsia/task.rs",
"src/runtime/fuchsia/timer.rs",
]
} else {
deps += [
"//src/lib/zircon/rust:fuchsia-zircon-status",
"//third_party/rust_crates:bitflags",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:slab",
]
if (current_toolchain != unknown_wasm32_toolchain) {
deps += [
"//third_party/rust_crates:async-channel",
"//third_party/rust_crates:async-executor",
"//third_party/rust_crates:async-io",
"//third_party/rust_crates:async-net",
"//third_party/rust_crates:blocking",
"//third_party/rust_crates:easy-parallel",
"//third_party/rust_crates:futures-lite",
]
sources += [ "src/net/portable/udp.rs" ]
}
sources += [
"src/handle/emulated/channel.rs",
"src/handle/emulated/mod.rs",
"src/handle/emulated/socket.rs",
"src/net/portable/mod.rs",
"src/runtime/portable.rs",
]
}
test_deps = [ "//third_party/rust_crates:futures-test" ]
}
rustc_staticlib("fuchsia-async-staticlib") {
edition = "2021"
deps = [
":fuchsia-async",
"//src/lib/zircon/rust:fuchsia-zircon-status",
"//src/lib/zircon/rust:fuchsia-zircon-types",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:parking_lot",
]
if (is_fuchsia) {
deps += [ "//src/lib/zircon/rust:fuchsia-zircon" ]
}
source_root = "src/ffi.rs"
sources = [ "src/ffi.rs" ]
}
fuchsia_unittest_package("fuchsia-async-tests") {
manifest = "meta/fuchsia_async_lib_test.cml"
deps = [
":fuchsia-async_test",
"//src/connectivity/network/netstack:component",
]
test_specs = {
environments = [ emu_env ]
}
}
group("tests") {
testonly = true
deps = [
":fuchsia-async-tests",
":fuchsia-async_test($host_toolchain)",
"cpp:tests",
"tests",
]
}