apple_info_plist.gni 1.9 KB

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