| # 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/rust/rustc_library.gni") |
| import("//build/rust/rustc_staticlib.gni") |
| import("//build/testing/environments.gni") |
| |
| rustc_library("fuchsia") { |
| name = "fuchsia" |
| edition = "2021" |
| deps = [ |
| "macro", |
| "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics-rustc", |
| "//src/lib/fuchsia-async", |
| "//third_party/rust_crates:argh", |
| ] |
| sources = [ "src/lib.rs" ] |
| if (is_fuchsia) { |
| deps += [ |
| "//src/lib/diagnostics/log/rust", |
| "//third_party/rust_crates:futures", |
| ] |
| } else { |
| sources += [ |
| "src/host/logger.rs", |
| "src/host/mod.rs", |
| ] |
| deps += [ |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:log", |
| ] |
| } |
| } |
| |
| rustc_test("fuchsia_test") { |
| name = "fuchsia_test" |
| edition = "2021" |
| deps = [ |
| ":fuchsia", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| ] |
| source_root = "src/test.rs" |
| sources = [ "src/test.rs" ] |
| } |
| |
| fuchsia_unittest_package("fuchsia-tests") { |
| deps = [ ":fuchsia_test" ] |
| test_specs = { |
| environments = [ emu_env ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fuchsia-tests", |
| ":fuchsia_test($host_toolchain)", |
| ] |
| } |