blob: 56d63eea71a8a621c416e15010900241202727f0 [file] [log] [blame]
# Copyright 2018 The Chromium 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")
# This is a rule used to generate an index of module packages that should be
# indexed by the on-device module resolver when it starts up. This template is
# meant to be used only once for each layer, but multiple may exist for
# different device package sets. This target generates a system package, so
# this target *must* be included in your layer's build image.
#
# The following must be true for each of the listed packages:
#
# 0) Make sure this module package is built and included on the device image.
# E.g: For an index of all topaz modules, make sure all module packages are
# transitively included from //topaz/packages/topaz.
# 1) Create a Module manifest file as per //peridot/docs/modular/manifests/module.md
# and include it in your module package. The flutter_app() template from
# topaz includes the specified module manifest in the package for you.
# 2) Point the 'binary' attribute in your manifest to the module's package name.
#
# Example:
#
# import("//peridot/build/module_manifest.gni")
#
# initial_module_packages("manifests") {
# packages = [ "my_module_package1", "my_module_package2" ]
# }
template("initial_module_packages") {
assert(defined(invoker.packages),
"'packages' must be defined for $target_name")
# NOTE: The fully resolved path will be
# /system/data/module_manifest_repository
# This must match that given in bin/module_resolver/module_resolver_main.cc
module_index_filename = "$root_build_dir/module_package_index/$target_name"
write_file(module_index_filename, invoker.packages)
package(target_name) {
deprecated_system_image = true
resources = [
{
path = rebase_path(module_index_filename)
dest = "initial_module_packages/$target_name"
},
]
}
}