| # 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/rust/rustc_test.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| import("//src/fonts/build/fonts.gni") |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ |
| ":font_provider_tests", |
| "char_set:tests", |
| "font_info:tests", |
| "manifest:tests", |
| "offset_string:tests", |
| "tools:tests", |
| ] |
| } |
| |
| rustc_binary("font_server") { |
| name = "font_server" |
| with_unit_tests = true |
| edition = "2018" |
| |
| deps = [ |
| "char_set", |
| "font_info", |
| "freetype_ffi", |
| "manifest", |
| "//garnet/lib/rust/fidl_fuchsia_fonts_ext", |
| "//garnet/lib/rust/io_util", |
| "//sdk/fidl/fuchsia.fonts:fuchsia.fonts-rustc", |
| "//sdk/fidl/fuchsia.fonts.experimental:fuchsia.fonts.experimental-rustc", |
| "//sdk/fidl/fuchsia.intl:fuchsia.intl-rustc", |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg-rustc", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-url", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:getopts", |
| "//third_party/rust_crates:itertools", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:libc", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:parking_lot", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:unicase", |
| "//zircon/system/fidl/fuchsia-io:fuchsia-io-rustc", |
| "//zircon/system/fidl/fuchsia-mem:fuchsia-mem-rustc", |
| ] |
| |
| test_deps = [ |
| "//third_party/rust_crates:maplit", |
| "//third_party/rust_crates:pretty_assertions", |
| ] |
| |
| 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 = [ |
| # TODO(kpozin): Remove old manifest |
| { |
| 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("//prebuilt/third_party/fonts/${font}") |
| file_name = get_path_info(font, "file") |
| dest = "fonts/${file_name}" |
| }, |
| ] |
| } |
| } |
| |
| # Integration tests without a `main()` function. |
| rustc_test("font_provider_test") { |
| edition = "2018" |
| |
| deps = [ |
| "//garnet/lib/rust/fidl_fuchsia_fonts_ext", |
| "//sdk/fidl/fuchsia.fonts:fuchsia.fonts-rustc", |
| "//sdk/fidl/fuchsia.fonts.experimental:fuchsia.fonts.experimental-rustc", |
| "//sdk/fidl/fuchsia.intl:fuchsia.intl-rustc", |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg-rustc", |
| "//src/fonts/char_set", |
| "//src/fonts/manifest", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-url", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:itertools", |
| "//third_party/rust_crates:thiserror", |
| "//zircon/system/fidl/fuchsia-io:fuchsia-io-rustc", |
| ] |
| source_root = "tests/lib.rs" |
| } |
| |
| test_package("font_provider_tests") { |
| deps = [ |
| ":font_provider_test_test", |
| ":font_server_test", |
| ":mock_font_resolver_bin", |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/mock_font_resolver.cmx") |
| dest = "mock_font_resolver.cmx" |
| }, |
| ] |
| |
| binaries = [ |
| { |
| name = "mock_font_resolver" |
| }, |
| ] |
| |
| tests = [ |
| { |
| name = "font_provider_test" |
| environments = basic_envs |
| }, |
| { |
| name = "font_server_bin_test" |
| environments = basic_envs |
| }, |
| ] |
| |
| resources = [ |
| { |
| path = rebase_path("tests/test_manifest_v1.json") |
| dest = "testdata/test_fonts/test_manifest_v1.json" |
| }, |
| { |
| path = rebase_path("tests/all_fonts_manifest_v1.json") |
| dest = "testdata/test_fonts/all_fonts_manifest_v1.json" |
| }, |
| { |
| path = rebase_path("tests/ephemeral.font_manifest.json") |
| dest = "testdata/test_fonts/ephemeral.font_manifest.json" |
| }, |
| { |
| path = rebase_path("tests/aliases.font_manifest.json") |
| dest = "testdata/test_fonts/aliases.font_manifest.json" |
| }, |
| ] |
| |
| fonts = [ |
| "material/MaterialIcons-Regular.ttf", |
| "noto-cjk/NotoSansCJK-Regular.ttc", |
| "noto-cjk/NotoSerifCJK-Regular.ttc", |
| "roboto/Roboto-Black.ttf", |
| "roboto/Roboto-BlackItalic.ttf", |
| "roboto/Roboto-Bold.ttf", |
| "roboto/Roboto-BoldItalic.ttf", |
| "roboto/Roboto-Italic.ttf", |
| "roboto/Roboto-Light.ttf", |
| "roboto/Roboto-LightItalic.ttf", |
| "roboto/Roboto-Medium.ttf", |
| "roboto/Roboto-MediumItalic.ttf", |
| "roboto/Roboto-Regular.ttf", |
| "roboto/Roboto-Thin.ttf", |
| "roboto/Roboto-ThinItalic.ttf", |
| "robotocondensed/RobotoCondensed-Bold.ttf", |
| "robotocondensed/RobotoCondensed-BoldItalic.ttf", |
| "robotocondensed/RobotoCondensed-Italic.ttf", |
| "robotocondensed/RobotoCondensed-Light.ttf", |
| "robotocondensed/RobotoCondensed-LightItalic.ttf", |
| "robotocondensed/RobotoCondensed-Regular.ttf", |
| "robotomono/RobotoMono-Bold.ttf", |
| "robotomono/RobotoMono-BoldItalic.ttf", |
| "robotomono/RobotoMono-Italic.ttf", |
| "robotomono/RobotoMono-Light.ttf", |
| "robotomono/RobotoMono-LightItalic.ttf", |
| "robotomono/RobotoMono-Medium.ttf", |
| "robotomono/RobotoMono-MediumItalic.ttf", |
| "robotomono/RobotoMono-Regular.ttf", |
| "robotomono/RobotoMono-Thin.ttf", |
| "robotomono/RobotoMono-ThinItalic.ttf", |
| "robotoslab/RobotoSlab-Bold.ttf", |
| "robotoslab/RobotoSlab-Light.ttf", |
| "robotoslab/RobotoSlab-Regular.ttf", |
| "robotoslab/RobotoSlab-Thin.ttf", |
| ] |
| foreach(font, fonts) { |
| resources += [ |
| { |
| path = rebase_path("//prebuilt/third_party/fonts/${font}") |
| file_name = get_path_info(font, "file") |
| dest = "testdata/test_fonts/${file_name}" |
| }, |
| ] |
| } |
| } |
| |
| rustc_binary("mock_font_resolver_bin") { |
| name = "mock_font_resolver" |
| edition = "2018" |
| source_root = "testing/mock_font_resolver.rs" |
| deps = [ |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg-rustc", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-url", |
| "//src/lib/storage/pseudo-fs", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:thiserror", |
| "//zircon/system/fidl/fuchsia-io:fuchsia-io-rustc", |
| ] |
| } |
| |
| # Group of all open-source font packages. This should be added to |
| # `universe_package_labels`. |
| group("open-fonts") { |
| deps = [ |
| "//src/fonts/groups:material-icons", |
| "//src/fonts/groups:noto-sans", |
| "//src/fonts/groups:noto-serif", |
| "//src/fonts/groups:roboto", |
| "//src/fonts/groups:roboto-mono", |
| ] |
| } |
| |
| local_font_bundle("open-fonts-local") { |
| asset_names = [ "RobotoMono-Regular.ttf" ] |
| } |
| |
| # Font collection for open-source products. This should be added to |
| # `base_package_labels` or `cache_package_labels`. |
| font_collection("open-fonts-collection") { |
| font_packages = [ ":open-fonts" ] |
| local_font_bundles = [ ":open-fonts-local" ] |
| } |
| |
| # Empty font collection for products that spawn a font server but don't want any |
| # actual fonts. This should be added to `base_package_labels` or |
| # `cache_package_labels`. |
| font_collection("empty-font-collection") { |
| empty = true |
| } |