chromium/build/apple/apple_info_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.

import("//build/apple/compile_plist.gni")

# The base template used to generate Info.plist files for iOS and Mac apps and
# frameworks.
#
# Arguments
#
#     plist_templates:
#         string array, paths to plist files which will be used for the bundle.
#
#     executable_name:
#         string, name of the generated target used for the product
#         and executable name as specified in the output Info.plist.
#
#     format:
#         string, the format to `plutil -convert` the plist to when
#         generating the output.
#
#     extra_substitutions:
#         (optional) string array, 'key=value' pairs for extra fields which are
#         specified in a source Info.plist template.
#
#     output_name:
#         (optional) string, name of the generated plist file, default to
#         "$target_gen_dir/$target_name.plist".
template("apple_info_plist") {
  assert(defined(invoker.executable_name),
         "The executable_name must be specified for $target_name")
  executable_name = invoker.executable_name

  compile_plist(target_name) {
    forward_variables_from(invoker,
                           [
                             "plist_templates",
                             "testonly",
                             "deps",
                             "visibility",
                             "format",
                           ])

    if (defined(invoker.output_name)) {
      output_name = invoker.output_name
    } else {
      output_name = "$target_gen_dir/$target_name.plist"
    }

    substitutions = [
      "EXECUTABLE_NAME=$executable_name",
      "GCC_VERSION=com.apple.compilers.llvm.clang.1_0",
      "PRODUCT_NAME=$executable_name",
    ]
    if (defined(invoker.extra_substitutions)) {
      substitutions += invoker.extra_substitutions
    }
  }
}