| # 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/components.gni") | |
| import("//build/rust/rustc_binary.gni") | |
| import("//build/rust/rustc_library.gni") | |
| import("//build/rust/rustc_test.gni") | |
| import("//build/type/config.gni") | |
| import("//src/fonts/build/fonts.gni") | |
| group("fonts") { | |
| public_deps = [ | |
| ":pkg", | |
| # XXX: external dependencies on //src/fonts are intending just to get the | |
| # package, but that layout does not follow the convention of directory | |
| # targets including all their tests and buildable artifacts. For now these | |
| # need to be disabled, and all external consumers only intending to import | |
| # fonts support should be moved to using //src/fonts:pkg instead. | |
| # ":open-fonts", | |
| # ":tests", | |
| ] | |
| } | |
| group("tests") { | |
| testonly = true | |
| public_deps = [ | |
| ":font_provider_unit_tests", | |
| "char_set:tests", | |
| "fake:tests", | |
| "font_info:tests", | |
| "manifest:tests", | |
| "offset_string:tests", | |
| "tests", | |
| "tools:tests", | |
| ] | |
| } | |
| # Group of all the dependencies needed for downstream tests that rely on fonts, | |
| # such as Chromium tests. | |
| # Tests that use this dependency should also put | |
| # { "fuchsia.fonts.Provider": "fuchsia-pkg://fuchsia.com/fonts#meta/fonts_for_downstream_tests.cmx" } | |
| # in their component manifests' "facets" > "fuchsia.test" > "injected-services". | |
| group("downstream_test_deps") { | |
| testonly = true | |
| public_deps = [ | |
| ":downstream-test-fonts-collection", | |
| ":fonts", | |
| ] | |
| } | |
| rustc_binary("font_provider") { | |
| name = "font_provider" | |
| with_unit_tests = true | |
| edition = "2021" | |
| deps = [ | |
| "char_set", | |
| "font_info", | |
| "manifest", | |
| "//sdk/fidl/fuchsia.fonts:fuchsia.fonts_rust", | |
| "//sdk/fidl/fuchsia.fonts.experimental:fuchsia.fonts.experimental_rust", | |
| "//sdk/fidl/fuchsia.intl:fuchsia.intl_rust", | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", | |
| "//sdk/fidl/fuchsia.mem:fuchsia.mem_rust", | |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg_rust", | |
| "//src/fonts/fidl_fuchsia_fonts_ext", | |
| "//src/lib/diagnostics/inspect/runtime/rust", | |
| "//src/lib/diagnostics/inspect/rust", | |
| "//src/lib/fdio/rust:fdio", | |
| "//src/lib/fidl/rust/fidl", | |
| "//src/lib/fuchsia-async", | |
| "//src/lib/fuchsia-component", | |
| "//src/lib/fuchsia-fs", | |
| "//src/lib/fuchsia-url", | |
| "//src/lib/syslog/rust:syslog", | |
| "//src/lib/trace/rust:trace", | |
| "//src/lib/trace/rust:trace-provider", | |
| "//src/lib/zircon/rust:fuchsia-zircon", | |
| "//third_party/rust_crates:anyhow", | |
| "//third_party/rust_crates:argh", | |
| "//third_party/rust_crates:async-trait", | |
| "//third_party/rust_crates:futures", | |
| "//third_party/rust_crates:heck", | |
| "//third_party/rust_crates:itertools", | |
| "//third_party/rust_crates:lazy_static", | |
| "//third_party/rust_crates:thiserror", | |
| "//third_party/rust_crates:unicase", | |
| ] | |
| # TODO(fxbug.dev/99760): Fix the leaks and remove this. | |
| deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] | |
| test_deps = [ | |
| "//src/lib/intl/unicode_utils/char_collection", | |
| "//third_party/rust_crates:maplit", | |
| "//third_party/rust_crates:pretty_assertions", | |
| ] | |
| non_rust_deps = [ "//third_party/freetype2" ] | |
| sources = [ | |
| "src/font_service/asset/asset.rs", | |
| "src/font_service/asset/cache.rs", | |
| "src/font_service/asset/collection.rs", | |
| "src/font_service/asset/loader.rs", | |
| "src/font_service/asset/mod.rs", | |
| "src/font_service/builder.rs", | |
| "src/font_service/debug.rs", | |
| "src/font_service/family.rs", | |
| "src/font_service/inspect.rs", | |
| "src/font_service/mod.rs", | |
| "src/font_service/typeface/collection.rs", | |
| "src/font_service/typeface/matcher.rs", | |
| "src/font_service/typeface/mod.rs", | |
| "src/font_service/typeface/test_util.rs", | |
| "src/font_service/typeface/typeface.rs", | |
| "src/main.rs", | |
| ] | |
| } | |
| fuchsia_component("font_provider_cm") { | |
| manifest = "meta/fonts.cml" | |
| component_name = "fonts" | |
| deps = [ ":font_provider" ] | |
| } | |
| fuchsia_package("pkg") { | |
| package_name = "fonts" | |
| deps = [ ":font_provider_cm" ] | |
| } | |
| build_type_config_data("build_type") { | |
| for_pkg = "fonts" | |
| } | |
| fuchsia_component("font_provider_unit_tests_cmp") { | |
| testonly = true | |
| manifest = "meta/font_provider_bin_test.cml" | |
| component_name = "font_provider_bin_test" | |
| deps = [ ":font_provider_test" ] | |
| } | |
| fuchsia_test_package("font_provider_unit_tests") { | |
| test_components = [ ":font_provider_unit_tests_cmp" ] | |
| } | |
| # Deprecated. | |
| # TODO(fxbug.dev/98663): Clean up after all out-of-tree dependents are fixed. | |
| group("open-fonts") { | |
| deps = [] | |
| } | |
| # Re-export: | |
| # Font collection for semi-hermetic downstream tests (e.g. Chromium) that need | |
| # to use a fixed set of fonts. | |
| group("downstream-test-fonts-collection") { | |
| testonly = true | |
| deps = [ "collections:downstream-test-fonts-collection" ] | |
| } | |
| # Re-export: | |
| # Font collection for open-source products. This should be added to | |
| # `base_package_labels` or `cache_package_labels`. | |
| group("open-fonts-collection") { | |
| deps = [ "collections:open-fonts-collection" ] | |
| } | |
| # Re-export: | |
| # 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`. | |
| group("empty-font-collection") { | |
| deps = [ "collections:empty-font-collection" ] | |
| } |