compile_entitlements.gni 1.5 KB

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