blob: 853fdd002b655d03299c2185fd4fd1b4833e88f9 [file] [log] [blame]
# Copyright 2022 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/config.gni")
# eager_package_config produces config-data for omaha-client and pkg-resolver to
# to support eager package updates.
#
# Parameters
#
# sources
# [list of string] list of path to JSON config for each eager package.
#
# Each JSON config should include the following
# url
# [string] url of the package.
#
# flavor (optional)
# [string] flavor of the package.
#
# executable (optional)
# [bool] executability of the package.
#
# default_channel (optional)
# [string] if set, this channel will be the default channel. The
# channel must appear in channels in at least one realm.
#
# realms
# [list of objects] list of realms. Each realm contains the
# the following. Nothing is optional.
# app_id: The Omaha App ID for the realm
# channels: [list of strings] The list of channels for the realm.
#
# data_deps (optional)
# deps (optional)
# Same as for any GN target.
template("eager_package_config") {
input_paths = []
foreach(source, invoker.sources) {
input_paths += [ rebase_path(source, root_build_dir) ]
}
omaha_client_config_path =
"$target_gen_dir/$target_name/omaha_client/eager_package_config.json"
pkg_resolver_config_path =
"$target_gen_dir/$target_name/pkg_resolver/eager_package_config.json"
eager_package_config_script_label =
"${target_name}_eager_package_config_script"
action(eager_package_config_script_label) {
script = "//src/sys/pkg/scripts/eager_package_config.py"
inputs = invoker.sources
outputs = [
omaha_client_config_path,
pkg_resolver_config_path,
]
args = [
"--out-omaha-client-config",
rebase_path(omaha_client_config_path, root_build_dir),
"--out-pkg-resolver-config",
rebase_path(pkg_resolver_config_path, root_build_dir),
] + input_paths
}
omaha_client_config_label = "${target_name}_omaha_client_config"
config_data(omaha_client_config_label) {
for_pkg = "omaha-client"
outputs = [ "eager_package_config.json" ]
sources = [ omaha_client_config_path ]
deps = [ ":$eager_package_config_script_label" ]
}
pkg_resolver_config_label = "${target_name}_pkg_resolver_config"
config_data(pkg_resolver_config_label) {
for_pkg = "pkg-resolver"
outputs = [ "eager_package_config.json" ]
sources = [ pkg_resolver_config_path ]
deps = [ ":$eager_package_config_script_label" ]
}
group(target_name) {
forward_variables_from(invoker,
[
"deps",
"data_deps",
])
if (!defined(data_deps)) {
data_deps = []
}
data_deps += [
":$omaha_client_config_label",
":$pkg_resolver_config_label",
]
}
}