xref: /aosp_15_r20/external/cronet/build/apple/apple_info_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
5import("//build/apple/compile_plist.gni")
6
7# The base template used to generate Info.plist files for iOS and Mac apps and
8# frameworks.
9#
10# Arguments
11#
12#     plist_templates:
13#         string array, paths to plist files which will be used for the bundle.
14#
15#     executable_name:
16#         string, name of the generated target used for the product
17#         and executable name as specified in the output Info.plist.
18#
19#     format:
20#         string, the format to `plutil -convert` the plist to when
21#         generating the output.
22#
23#     extra_substitutions:
24#         (optional) string array, 'key=value' pairs for extra fields which are
25#         specified in a source Info.plist template.
26#
27#     output_name:
28#         (optional) string, name of the generated plist file, default to
29#         "$target_gen_dir/$target_name.plist".
30template("apple_info_plist") {
31  assert(defined(invoker.executable_name),
32         "The executable_name must be specified for $target_name")
33  executable_name = invoker.executable_name
34
35  compile_plist(target_name) {
36    forward_variables_from(invoker,
37                           [
38                             "plist_templates",
39                             "testonly",
40                             "deps",
41                             "visibility",
42                             "format",
43                           ])
44
45    if (defined(invoker.output_name)) {
46      output_name = invoker.output_name
47    } else {
48      output_name = "$target_gen_dir/$target_name.plist"
49    }
50
51    substitutions = [
52      "EXECUTABLE_NAME=$executable_name",
53      "GCC_VERSION=com.apple.compilers.llvm.clang.1_0",
54      "PRODUCT_NAME=$executable_name",
55    ]
56    if (defined(invoker.extra_substitutions)) {
57      substitutions += invoker.extra_substitutions
58    }
59  }
60}
61