xref: /aosp_15_r20/external/angle/build/apple/compile_entitlements.gni (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# Copyright 2021 The Chromium Authors
2*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be
3*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file.
4*8975f5c5SAndroid Build Coastguard Worker
5*8975f5c5SAndroid Build Coastguard Workerimport("//build/apple/compile_plist.gni")
6*8975f5c5SAndroid Build Coastguard Worker
7*8975f5c5SAndroid Build Coastguard Worker# Template to merge multiple .entitlements files performing variable
8*8975f5c5SAndroid Build Coastguard Worker# substitutions.
9*8975f5c5SAndroid Build Coastguard Worker#
10*8975f5c5SAndroid Build Coastguard Worker# Arguments
11*8975f5c5SAndroid Build Coastguard Worker#
12*8975f5c5SAndroid Build Coastguard Worker#     entitlements_templates:
13*8975f5c5SAndroid Build Coastguard Worker#         string array, paths to entitlements files which will be used for the
14*8975f5c5SAndroid Build Coastguard Worker#         bundle.
15*8975f5c5SAndroid Build Coastguard Worker#
16*8975f5c5SAndroid Build Coastguard Worker#     substitutions:
17*8975f5c5SAndroid Build Coastguard Worker#         string array, 'key=value' pairs used to replace ${key} by value
18*8975f5c5SAndroid Build Coastguard Worker#         when generating the output plist file.
19*8975f5c5SAndroid Build Coastguard Worker#
20*8975f5c5SAndroid Build Coastguard Worker#     output_name:
21*8975f5c5SAndroid Build Coastguard Worker#         string, name of the generated entitlements file.
22*8975f5c5SAndroid Build Coastguard Workertemplate("compile_entitlements") {
23*8975f5c5SAndroid Build Coastguard Worker  assert(defined(invoker.entitlements_templates),
24*8975f5c5SAndroid Build Coastguard Worker         "A list of template plist files must be specified for $target_name")
25*8975f5c5SAndroid Build Coastguard Worker
26*8975f5c5SAndroid Build Coastguard Worker  compile_plist(target_name) {
27*8975f5c5SAndroid Build Coastguard Worker    forward_variables_from(invoker,
28*8975f5c5SAndroid Build Coastguard Worker                           "*",
29*8975f5c5SAndroid Build Coastguard Worker                           [
30*8975f5c5SAndroid Build Coastguard Worker                             "entitlements_templates",
31*8975f5c5SAndroid Build Coastguard Worker                             "format",
32*8975f5c5SAndroid Build Coastguard Worker                             "plist_templates",
33*8975f5c5SAndroid Build Coastguard Worker                           ])
34*8975f5c5SAndroid Build Coastguard Worker
35*8975f5c5SAndroid Build Coastguard Worker    plist_templates = invoker.entitlements_templates
36*8975f5c5SAndroid Build Coastguard Worker
37*8975f5c5SAndroid Build Coastguard Worker    # Entitlements files are always encoded in xml1.
38*8975f5c5SAndroid Build Coastguard Worker    format = "xml1"
39*8975f5c5SAndroid Build Coastguard Worker
40*8975f5c5SAndroid Build Coastguard Worker    # Entitlements files use unsubstitued variables, so define substitutions
41*8975f5c5SAndroid Build Coastguard Worker    # to leave those variables untouched.
42*8975f5c5SAndroid Build Coastguard Worker    if (!defined(substitutions)) {
43*8975f5c5SAndroid Build Coastguard Worker      substitutions = []
44*8975f5c5SAndroid Build Coastguard Worker    }
45*8975f5c5SAndroid Build Coastguard Worker
46*8975f5c5SAndroid Build Coastguard Worker    substitutions += [
47*8975f5c5SAndroid Build Coastguard Worker      "AppIdentifierPrefix=\$(AppIdentifierPrefix)",
48*8975f5c5SAndroid Build Coastguard Worker      "CFBundleIdentifier=\$(CFBundleIdentifier)",
49*8975f5c5SAndroid Build Coastguard Worker    ]
50*8975f5c5SAndroid Build Coastguard Worker  }
51*8975f5c5SAndroid Build Coastguard Worker}
52