| # 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/rust/rustc_binary.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| |
| # This is the main target in this BUILD file. It implicitly contains everything |
| # in the src/ directory, and implicitly looks for src/main.rs as entry point. |
| # It intentionally has a long name to avoid naming conflicts, because the |
| # binaries that are generated are named after the target name, and all binaries |
| # for Fuchsia live in the same namespace and should be distinct. |
| rustc_binary("intl_wisdom_server_rust") { |
| edition = "2018" |
| with_unit_tests = true |
| deps = [ |
| "//garnet/examples/intl/wisdom/fidl:wisdom-rustc", |
| "//sdk/fidl/fuchsia.intl:fuchsia.intl-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/icu_data/rust/icu_data", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:rust_icu_common", |
| "//third_party/rust_crates:rust_icu_sys", |
| "//third_party/rust_crates:rust_icu_ucal", |
| "//third_party/rust_crates:rust_icu_udat", |
| "//third_party/rust_crates:rust_icu_udata", |
| "//third_party/rust_crates:rust_icu_uenum", |
| "//third_party/rust_crates:rust_icu_uloc", |
| "//third_party/rust_crates:rust_icu_ustring", |
| "//third_party/rust_crates:thiserror", |
| ] |
| non_rust_deps = [ "//third_party/icu" ] |
| |
| sources = [ |
| "src/main.rs", |
| "src/wisdom_server_impl.rs", |
| ] |
| } |
| |
| # This is the Fuchsia test package which ensures that the generated tests from |
| # the target above is packaged as a binary and delivered to the Fuchsia device. |
| # It is intentionally named after the above target, with "_tests" appended, for |
| # uniformity of naming. |
| # |
| # This package's name is also the argument to `fx run-tests`: |
| # |
| # fx set --with=//garnet/examples/intl/wisdom:tests |
| # fx build |
| # fx serve & # This should perhaps be ran sychronously in another terminal |
| # fx run-test intl_wisdom_server_rust_tests |
| # [START icudata] |
| test_package("intl_wisdom_server_rust_tests") { |
| deps = [ |
| # This target is implicitly generated by the target |
| # ":intl_wisdom_server_rust" above, when it has the setting |
| # "with_unit_tests=true". |
| ":intl_wisdom_server_rust_test", |
| ] |
| tests = [ |
| { |
| # The binary corresponding to this test has been generated implicilty by |
| # the target ":intl_wisdom_server_rust" when it has the setting |
| # "with_unit_tests=true". |
| # This implicilty requires a file meta/intl_wisdom_server_rust_bin_test.cmx |
| # to be present under this directory. |
| name = "intl_wisdom_server_rust_bin_test" |
| dest = "intl_wisdom_server_rust_bin_test" |
| environments = basic_envs |
| }, |
| ] |
| |
| # [START icudata_resource] |
| resources = [ |
| { |
| # Fuchsia's ICU does not have libicudata.so, and the locale data MUST |
| # be loaded from a file instead. |
| path = rebase_path("//third_party/icu/common/icudtl.dat") |
| dest = "icudtl.dat" |
| }, |
| ] |
| |
| # [END icudata_resource] |
| } |
| |
| # [END icudata] |
| |
| # This group is intentionally named the same as the directory it is in, so that |
| # the non-test parts of this target can be referred to without looking up the |
| # contents of this file. Its dependencies are all non-test things in this |
| # package, which for rust is in practice just a single library or binary. |
| # |
| # The rustc_binary can not be just named "server" due to naming conflicts with |
| # other Fuchsia binaries, see the remark all the way up top at the |
| # rustc_binary("...") declaration. So we must make do with this indirection. |
| group("server") { |
| deps = [ ":intl_wisdom_server_rust" ] |
| } |
| |
| # This group contains all tests in this package. It is intentonally given a |
| # standardized name "tests" so that it could be referred to as ".../wisdom:tests" |
| # without needing to look into this file to see what the precise target name is. |
| group("tests") { |
| testonly = true |
| deps = [ ":intl_wisdom_server_rust_tests" ] |
| } |