blob: 3ca8f69be8c29b1622c62b09e4d79a650d9a1bd7 [file] [log] [blame]
# 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")
group("tests") {
testonly = true
public_deps = [
":font_provider_tests",
"//src/fonts/char_set:tests",
"//src/fonts/manifest:tests",
"//src/fonts/offset_string:tests",
]
}
rustc_binary("font_server") {
name = "font_server"
with_unit_tests = true
edition = "2018"
deps = [
"//garnet/lib/rust/fidl_fuchsia_fonts_ext",
"//garnet/lib/rust/io_util",
"//garnet/public/lib/fidl/rust/fidl",
"//garnet/public/rust/fdio",
"//garnet/public/rust/fuchsia-async",
"//garnet/public/rust/fuchsia-component",
"//garnet/public/rust/fuchsia-syslog",
"//garnet/public/rust/fuchsia-zircon",
"//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/sys/lib/fuchsia_url",
"//third_party/rust_crates:failure",
"//third_party/rust_crates:futures-preview",
"//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:unicase",
"//zircon/system/fidl/fuchsia-io:fuchsia-io-rustc",
"//zircon/system/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("//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",
"//garnet/public/lib/fidl/rust/fidl",
"//garnet/public/rust/fdio",
"//garnet/public/rust/fuchsia-async",
"//garnet/public/rust/fuchsia-component",
"//garnet/public/rust/fuchsia-syslog",
"//garnet/public/rust/fuchsia-zircon",
"//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/sys/lib/fuchsia_url",
"//third_party/rust_crates:failure",
"//third_party/rust_crates:futures-preview",
"//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.json")
dest = "testdata/test_fonts/manifest.json"
},
{
path = rebase_path("tests/all_fonts_manifest.json")
dest = "testdata/test_fonts/all_fonts_manifest.json"
},
{
path = rebase_path("tests/ephemeral_manifest.json")
dest = "testdata/test_fonts/ephemeral_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 = [
"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 = [
"//garnet/public/lib/fidl/rust/fidl",
"//garnet/public/rust/fdio",
"//garnet/public/rust/fuchsia-async",
"//garnet/public/rust/fuchsia-component",
"//garnet/public/rust/fuchsia-syslog",
"//garnet/public/rust/fuchsia-vfs/pseudo-fs",
"//garnet/public/rust/fuchsia-zircon",
"//sdk/fidl/fuchsia.pkg:fuchsia.pkg-rustc",
"//src/sys/lib/fuchsia_url:fuchsia_url",
"//third_party/rust_crates:failure",
"//third_party/rust_crates:futures-preview",
"//third_party/rust_crates:lazy_static",
"//zircon/system/fidl/fuchsia-io:fuchsia-io-rustc",
]
}