| # Copyright 2019 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/config.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| |
| config_data("overnetstack_config") { |
| for_pkg = "sysmgr" |
| outputs = [ "overnetstack.config" ] |
| sources = [ rebase_path("config/service.config") ] |
| } |
| |
| rustc_binary("bin") { |
| name = "overnetstack" |
| with_unit_tests = true |
| edition = "2018" |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.serial:fuchsia.hardware.serial-rustc", |
| "//sdk/fidl/fuchsia.net:fuchsia.net-rustc", |
| "//sdk/fidl/fuchsia.net.mdns:fuchsia.net.mdns-rustc", |
| "//sdk/fidl/fuchsia.overnet:fuchsia.overnet-rustc", |
| "//sdk/fidl/fuchsia.overnet.protocol:fuchsia.overnet.protocol-rustc", |
| "//src/connectivity/overnet/lib/core", |
| "//src/connectivity/overnet/lib/serial_link", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| sources = [ |
| "src/main.rs", |
| "src/mdns.rs", |
| "src/serial.rs", |
| ] |
| } |
| |
| package("overnetstack") { |
| deps = [ ":bin" ] |
| |
| binaries = [ |
| { |
| name = "overnetstack" |
| }, |
| ] |
| meta = [ |
| { |
| path = rebase_path("meta/overnetstack.cmx") |
| dest = "overnetstack.cmx" |
| }, |
| ] |
| |
| # TODO(ctiller): This is clearly not great and we should not be hardcoding certificates |
| # and private keys into the overnetstack package. Design and implement security. |
| resources = [ |
| { |
| path = rebase_path("//third_party/rust-mirrors/quiche/examples/cert.crt") |
| dest = "cert.crt" |
| }, |
| { |
| path = rebase_path("//third_party/rust-mirrors/quiche/examples/cert.key") |
| dest = "cert.key" |
| }, |
| { |
| path = |
| rebase_path("//third_party/rust-mirrors/quiche/examples/rootca.crt") |
| dest = "root.crt" |
| }, |
| ] |
| } |
| |
| package("overnetstack-with-udp") { |
| deps = [ ":bin" ] |
| |
| binaries = [ |
| { |
| name = "overnetstack" |
| }, |
| ] |
| meta = [ |
| { |
| path = rebase_path("meta/overnetstack-with-udp.cmx") |
| dest = "overnetstack-with-udp.cmx" |
| }, |
| ] |
| |
| # TODO(ctiller): This is clearly not great and we should not be hardcoding certificates |
| # and private keys into the overnetstack package. Design and implement security. |
| resources = [ |
| { |
| path = rebase_path("//third_party/rust-mirrors/quiche/examples/cert.crt") |
| dest = "cert.crt" |
| }, |
| { |
| path = rebase_path("//third_party/rust-mirrors/quiche/examples/cert.key") |
| dest = "cert.key" |
| }, |
| { |
| path = |
| rebase_path("//third_party/rust-mirrors/quiche/examples/rootca.crt") |
| dest = "root.crt" |
| }, |
| ] |
| } |
| |
| test_package("overnetstack-tests") { |
| deps = [ ":bin_test" ] |
| |
| tests = [ |
| { |
| name = "overnetstack_bin_test" |
| environments = [ emu_env ] |
| }, |
| ] |
| |
| #Use quiche example certs for unit tests |
| resources = [ |
| { |
| path = rebase_path("//third_party/rust-mirrors/quiche/examples/cert.crt") |
| dest = "cert.crt" |
| }, |
| { |
| path = rebase_path("//third_party/rust-mirrors/quiche/examples/cert.key") |
| dest = "cert.key" |
| }, |
| { |
| path = |
| rebase_path("//third_party/rust-mirrors/quiche/examples/rootca.crt") |
| dest = "root.crt" |
| }, |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ ":overnetstack-tests" ] |
| } |