| # Copyright 2019 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/dist/resource.gni") |
| import("//src/fonts/build/fonts.gni") |
| import("//src/sys/build/components.gni") |
| |
| # Generate all the Fuchsia font `package`s from the values in the files listed |
| # in `font_pkgs_paths`. |
| |
| all_packages = [] |
| |
| ################################################################################ |
| # Generate a `package` for every font |
| ################################################################################ |
| assert(font_pkg_entries != []) |
| foreach(entry, font_pkg_entries) { |
| assert(font_pkg_entries != []) |
| path_prefix = entry.path_prefix |
| if (path_prefix != "") { |
| path_prefix = "${path_prefix}/" |
| } |
| path_to_asset = "${fonts_dir}/${path_prefix}${entry.file_name}" |
| |
| resource_target = "${entry.safe_name}_resource" |
| resource(resource_target) { |
| sources = [ path_to_asset ] |
| outputs = [ "data/${entry.file_name}" ] |
| } |
| |
| package_name = "font-package-${entry.safe_name}" |
| all_packages += [ ":${package_name}" ] |
| fuchsia_package(package_name) { |
| all_outputs_fresh = false |
| |
| metadata = { |
| font_barrier = [] |
| font_paths = [ path_to_asset ] |
| font_file_names = [ entry.file_name ] |
| fuchsia_package_urls = [ "fuchsia-pkg://fuchsia.com/${package_name}" ] |
| } |
| deps = [ ":$resource_target" ] |
| } |
| } |
| |
| # Group of all the single-font packages. |
| group("all") { |
| deps = all_packages |
| } |