| # Copyright 2023 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. |
| |
| # See README.md for details. |
| |
| import("//build/components.gni") |
| import("//src/fonts/build/fonts.gni") |
| |
| # Declares a build for the font asset provider bundle. |
| # |
| # The bundle includes: |
| # |
| # - The asset provider: a component that only contains the font assets. |
| # - The font server: a component that uses the asset provider font assets, and |
| # serves them to clients. |
| # - The top-level provider component, which instantiates the above two, and |
| # sets up the appropriate routing. |
| # |
| # When a `font_asset_provider` target is declared, it prepares the set |
| # of components that serves a specific font collection. For example: |
| # |
| # ``` |
| # import("//src/fonts/build/font_asset_provider.gni") |
| # |
| # font_asset_provider("open-fonts-collection") { |
| # deps = [ "//src/fonts/collections:open-fonts-collection" ] |
| # } |
| # ``` |
| # |
| # The above creates the following: |
| # |
| # ``` |
| # //src/fonts/asset_provider:open-fonts-collection.asset-provider.package |
| # ``` |
| # |
| # The above packages can then be used as a font AIB in software assembly: |
| # |
| # ``` |
| # import("//build/assembly/assembly_input_bundle.gni") |
| # |
| # assembly_input_bundle("fonts.open-fonts-collection") { |
| # base_packages = [ |
| # //src/fonts/asset_provider:open-fonts-collection.asset-provider.package |
| # ] |
| # } |
| # ``` |
| # |
| # Args: |
| # deps: list(label): The `font_collection` targets to be bundled into this |
| # asset provider. You normally don't use more than one. |
| # |
| # public_deps |
| # testonly |
| # visibliity |
| # standard GN targets |
| # |
| |
| template("font_asset_provider") { |
| main_target_name = target_name |
| |
| fuchsia_component("${main_target_name}.asset-provider.component") { |
| cm_label = ":asset-provider.manifest" |
| deps = [] |
| if (defined(invoker.deps)) { |
| deps += invoker.deps |
| } |
| } |
| |
| fuchsia_package("${main_target_name}.asset-provider.package") { |
| package_name = "asset-provider" |
| deps = [ ":${main_target_name}.asset-provider.component" ] |
| } |
| |
| group(main_target_name) { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "public_deps", |
| "testonly", |
| "visibility", |
| ]) |
| |
| if (!defined(deps)) { |
| deps = [] |
| } |
| deps += [ |
| ":${main_target_name}.asset-provider.package", |
| "//src/fonts/asset_providers:common", |
| ] |
| } |
| } |