compile_entitlements.gni (1566B)
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 import("//chromium/build/apple/compile_plist.gni") 6 7 # Template to merge multiple .entitlements files performing variable 8 # substitutions. 9 # 10 # Arguments 11 # 12 # entitlements_templates: 13 # string array, paths to entitlements files which will be used for the 14 # bundle. 15 # 16 # substitutions: 17 # string array, 'key=value' pairs used to replace ${key} by value 18 # when generating the output plist file. 19 # 20 # output_name: 21 # string, name of the generated entitlements file. 22 template("compile_entitlements") { 23 assert(defined(invoker.entitlements_templates), 24 "A list of template plist files must be specified for $target_name") 25 26 compile_plist(target_name) { 27 forward_variables_from(invoker, 28 "*", 29 [ 30 "entitlements_templates", 31 "format", 32 "plist_templates", 33 ]) 34 35 plist_templates = invoker.entitlements_templates 36 37 # Entitlements files are always encoded in xml1. 38 format = "xml1" 39 40 # Entitlements files use unsubstitued variables, so define substitutions 41 # to leave those variables untouched. 42 if (!defined(substitutions)) { 43 substitutions = [] 44 } 45 46 substitutions += [ 47 "AppIdentifierPrefix=\$(AppIdentifierPrefix)", 48 "CFBundleIdentifier=\$(CFBundleIdentifier)", 49 ] 50 } 51 }