| # 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/components/fuchsia_structured_config.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//src/fonts/build/fonts.gni") |
| |
| declare_args() { |
| # Used in the structured configuration below. |
| src_fonts_verbose_logging = false |
| } |
| |
| group("fonts") { |
| public_deps = [ |
| # XXX: looks like all external deps no longer use //fonts, and the inclusion |
| # of the fonts package is now due to assembly. |
| # ":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_hermetic_for_test", |
| ":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. |
| 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 = [ |
| ":config", |
| "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", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/fuchsia-url", |
| "//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:once_cell", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| "//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/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions", |
| "//src/lib/intl/unicode_utils/char_collection", |
| "//third_party/rust_crates:maplit", |
| "//third_party/rust_crates:pretty_assertions", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| 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/config.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_manifest("manifest") { |
| manifest = "meta/fonts.cml" |
| component_name = "fonts" |
| } |
| |
| fuchsia_component("font_provider_cm") { |
| cm_label = ":manifest" |
| deps = [ ":font_provider" ] |
| } |
| |
| fuchsia_structured_config_values("config_values") { |
| cm_label = ":manifest" |
| values = { |
| # Use `--args=src_fonts_verbose_logging=true` to change this value from |
| # the `fx` command line. |
| verbose_logging = src_fonts_verbose_logging |
| font_manifest = "" |
| } |
| } |
| |
| fuchsia_structured_config_rust_lib("config") { |
| cm_label = ":manifest" |
| } |
| |
| fuchsia_package("pkg") { |
| package_name = "fonts" |
| validate_structured_config = false |
| deps = [ ":font_provider_cm" ] |
| } |
| |
| fuchsia_component_manifest("font_provider_unit_tests_cmp_manifest") { |
| manifest = "meta/font_provider_bin_test.cml" |
| component_name = "font_provider_bin_test" |
| } |
| |
| fuchsia_component("font_provider_unit_tests_cmp") { |
| testonly = true |
| cm_label = ":font_provider_unit_tests_cmp_manifest" |
| component_name = "font_provider_bin_test" |
| deps = [ ":font_provider_test" ] |
| } |
| |
| fuchsia_component_manifest("font_provider_hermetic_for_test_manifest") { |
| testonly = true |
| manifest = "meta/fonts_for_test.cml" |
| component_name = "font_provider_hermetic_for_test" |
| } |
| |
| fuchsia_structured_config_values( |
| "font_provider_hermetic_for_test_config_values") { |
| testonly = true |
| cm_label = ":font_provider_hermetic_for_test_manifest" |
| values = { |
| verbose_logging = true |
| font_manifest = "" |
| } |
| } |
| |
| fuchsia_component("font_provider_hermetic_for_test") { |
| testonly = true |
| cm_label = ":font_provider_hermetic_for_test_manifest" |
| deps = [ |
| ":font_provider", |
| ":font_provider_hermetic_for_test_config_values", |
| "//src/fonts/collections:downstream-test-fonts-collection", |
| ] |
| |
| # This component depends on font collections that define config_data entries, |
| # but they are not used by this package. The font collections should be able |
| # to disable the definition of config_data() entries as well as the resource() |
| # entries. |
| metadata = { |
| config_package_barrier = [] |
| } |
| } |
| |
| # A hermetic fonts provider which includes the fonts resources useful for |
| # testing. |
| fuchsia_package("fonts_hermetic_for_test") { |
| testonly = true |
| deps = [ |
| ":font_provider_hermetic_for_test", |
| ":font_provider_hermetic_for_test_config_values", |
| ] |
| } |
| |
| fuchsia_test_package("font_provider_unit_tests") { |
| test_components = [ ":font_provider_unit_tests_cmp" ] |
| validate_structured_config = false |
| } |
| |
| ## Fonts server for tests: the test fixture will supply their own tests. |
| |
| fuchsia_component_manifest("fonts_configurable_for_test_component_manifest") { |
| testonly = true |
| manifest = "meta/fonts.cml" |
| component_name = "fonts_configurable_for_test" |
| } |
| |
| fuchsia_structured_config_values("fonts_configurable_for_test_config_values") { |
| testonly = true |
| cm_label = ":fonts_configurable_for_test_component_manifest" |
| values = { |
| # Tests don't need font serving diagnostics. |
| verbose_logging = false |
| font_manifest = "" |
| } |
| } |
| |
| fuchsia_component("fonts_configurable_for_test_component") { |
| testonly = true |
| cm_label = ":fonts_configurable_for_test_component_manifest" |
| deps = [ ":font_provider" ] |
| } |
| |
| # A font server without any bundled fonts, intended for testing only. |
| # The user must route the fonts in via `config-data`. |
| fuchsia_package("fonts_configurable_for_test") { |
| testonly = true |
| deps = [ |
| ":fonts_configurable_for_test_component", |
| ":fonts_configurable_for_test_config_values", |
| ] |
| } |
| |
| # 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" ] |
| } |