xref: /aosp_15_r20/external/cronet/build/apple/convert_plist.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2021 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# Convert plist file to given format.
6#
7# Arguments
8#
9#   source:
10#     string, path to the plist file to convert
11#
12#   output:
13#     string, path to the converted plist, must be under $root_build_dir
14#
15#   format:
16#     string, the format to convert the plist to. Either "binary1" or "xml1".
17template("convert_plist") {
18  assert(defined(invoker.source), "source must be defined for $target_name")
19  assert(defined(invoker.output), "output must be defined for $target_name")
20  assert(defined(invoker.format), "format must be defined for $target_name")
21
22  action(target_name) {
23    forward_variables_from(invoker,
24                           [
25                             "visibility",
26                             "testonly",
27                             "deps",
28                           ])
29
30    script = "//build/apple/plist_util.py"
31    sources = [ invoker.source ]
32    outputs = [ invoker.output ]
33    args = [
34      "merge",
35      "--format=${invoker.format}",
36      "-o",
37      rebase_path(invoker.output, root_build_dir),
38      rebase_path(invoker.source, root_build_dir),
39    ]
40  }
41}
42