| # Copyright 2016 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/package.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| |
| rustc_binary("font_server") { |
| name = "font_server" |
| with_unit_tests = true |
| edition = "2018" |
| |
| deps = [ |
| "//garnet/public/lib/fidl/rust/fidl", |
| "//garnet/public/rust/fdio", |
| "//garnet/public/rust/fuchsia-async", |
| "//garnet/public/rust/fuchsia-component", |
| "//garnet/public/rust/fuchsia-zircon", |
| "//sdk/fidl/fuchsia.fonts:fuchsia.fonts-rustc", |
| "//third_party/rust_crates:failure", |
| "//third_party/rust_crates:futures-preview", |
| "//third_party/rust_crates:getopts", |
| "//third_party/rust_crates:libc", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_derive", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:unicase", |
| "//zircon/public/fidl/fuchsia-mem:fuchsia-mem-rustc", |
| ] |
| |
| non_rust_deps = [ "//third_party/freetype2" ] |
| } |
| |
| package("fonts") { |
| deps = [ |
| ":font_server", |
| ] |
| |
| binary = "font_server" |
| |
| meta = [ |
| { |
| path = rebase_path("meta/fonts.cmx") |
| dest = "fonts.cmx" |
| }, |
| ] |
| |
| resources = [ |
| { |
| path = rebase_path("manifest.json") |
| dest = "manifest.json" |
| }, |
| ] |
| |
| fonts = [ |
| "material/MaterialIcons-Regular.ttf", |
| "roboto/Roboto-Light.ttf", |
| "roboto/Roboto-Medium.ttf", |
| "roboto/Roboto-Regular.ttf", |
| ] |
| foreach(font, fonts) { |
| resources += [ |
| { |
| path = rebase_path("third_party/${font}") |
| file_name = get_path_info(font, "file") |
| dest = "fonts/${file_name}" |
| }, |
| ] |
| } |
| } |
| |
| # Integration tests without a `main()` function. |
| rustc_library("font_provider_test") { |
| testonly = true |
| with_unit_tests = true |
| edition = "2018" |
| |
| deps = [ |
| "//garnet/public/lib/fidl/rust/fidl", |
| "//garnet/public/rust/fdio", |
| "//garnet/public/rust/fuchsia-async", |
| "//garnet/public/rust/fuchsia-component", |
| "//garnet/public/rust/fuchsia-zircon", |
| "//sdk/fidl/fuchsia.fonts:fuchsia.fonts-rustc", |
| "//third_party/rust_crates:failure", |
| "//third_party/rust_crates:futures-preview", |
| ] |
| source_root = "tests/font_provider_test.rs" |
| } |
| |
| test_package("font_provider_tests") { |
| deps = [ |
| ":font_provider_test", |
| ":font_server", |
| ] |
| |
| tests = [ |
| { |
| name = "font_provider_test_lib_test" |
| environments = basic_envs |
| }, |
| { |
| name = "font_server_bin_test" |
| environments = basic_envs |
| }, |
| ] |
| |
| resources = [ |
| { |
| path = rebase_path("tests/test_manifest.json") |
| dest = "testdata/test_fonts/manifest.json" |
| }, |
| ] |
| |
| # TODO(sergeyu): Noto CJK fonts are not included in the default fonts package |
| # due to their size. Currently they are used only for tests. Once PKG-47 is |
| # implemented it will be possible to customize set of fonts on higher levels, |
| # which will allow to include these fonts in the default font package. |
| fonts = [ |
| "noto-cjk/NotoSansCJK-Regular.ttc", |
| "noto-cjk/NotoSerifCJK-Regular.ttc", |
| ] |
| foreach(font, fonts) { |
| resources += [ |
| { |
| path = rebase_path("third_party/${font}") |
| file_name = get_path_info(font, "file") |
| dest = "testdata/test_fonts/${file_name}" |
| }, |
| ] |
| } |
| } |