chromium/build/apple/convert_plist.gni

# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Convert plist file to given format.
#
# Arguments
#
#   source:
#     string, path to the plist file to convert
#
#   output:
#     string, path to the converted plist, must be under $root_build_dir
#
#   format:
#     string, the format to convert the plist to. Either "binary1" or "xml1".
template("convert_plist") {
  assert(defined(invoker.source), "source must be defined for $target_name")
  assert(defined(invoker.output), "output must be defined for $target_name")
  assert(defined(invoker.format), "format must be defined for $target_name")

  action(target_name) {
    forward_variables_from(invoker,
                           [
                             "visibility",
                             "testonly",
                             "deps",
                           ])

    script = "//build/apple/plist_util.py"
    sources = [ invoker.source ]
    outputs = [ invoker.output ]
    args = [
      "merge",
      "--format=${invoker.format}",
      "-o",
      rebase_path(invoker.output, root_build_dir),
      rebase_path(invoker.source, root_build_dir),
    ]
  }
}