BUILD.gn 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Copyright 2017 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_entitlements.gni")
  5. import("//build/apple/tweak_info_plist.gni")
  6. import("//build/config/ios/rules.gni")
  7. import("//build/config/locales.gni")
  8. import("//ios/build/chrome_build.gni")
  9. import("//ios/build/config.gni")
  10. import("//ios/chrome/tools/strings/generate_localizable_strings.gni")
  11. import("//tools/grit/repack.gni")
  12. assert(ios_deployment_target == "13.0",
  13. "content_widget_extension must target iOS 13.0")
  14. assert(
  15. ios_enable_content_widget_extension,
  16. "ios_enable_content_widget_extension must be true to depend on //ios/chrome/content_widget_extension")
  17. tweak_info_plist("tweak_info_plist") {
  18. info_plist = "Info.plist"
  19. }
  20. compile_entitlements("entitlements") {
  21. substitutions = [ "IOS_BUNDLE_ID_PREFIX=$ios_app_bundle_id_prefix" ]
  22. output_name = "$target_gen_dir/content_widget_extension.appex.entitlements"
  23. entitlements_templates =
  24. [ "entitlements/external/content_widget_extension.appex.entitlements" ]
  25. }
  26. ios_appex_bundle("content_widget_extension") {
  27. deps = [
  28. ":content_widget",
  29. ":system_strings",
  30. ]
  31. extra_substitutions = [
  32. "CHROME_CHANNEL_SCHEME=$url_channel_scheme",
  33. "CHROMIUM_SHORT_NAME=$chromium_short_name",
  34. ]
  35. assert_no_deps = ios_extension_assert_no_deps
  36. entitlements_target = ":entitlements"
  37. info_plist_target = ":tweak_info_plist"
  38. bundle_identifier = "$chromium_bundle_id.ContentTodayExtension"
  39. }
  40. source_set("content_widget") {
  41. sources = [
  42. "content_widget_view.h",
  43. "content_widget_view.mm",
  44. "content_widget_view_controller.h",
  45. "content_widget_view_controller.mm",
  46. "most_visited_tile_view.h",
  47. "most_visited_tile_view.mm",
  48. ]
  49. deps = [
  50. "//base",
  51. "//ios/chrome/common/app_group",
  52. "//ios/chrome/common/app_group:command",
  53. "//ios/chrome/common/crash_report",
  54. "//ios/chrome/common/ntp_tile",
  55. "//ios/chrome/common/ui/elements",
  56. "//ios/chrome/common/ui/favicon",
  57. "//ios/chrome/common/ui/util",
  58. ]
  59. frameworks = [
  60. "Foundation.framework",
  61. "NotificationCenter.framework",
  62. "UIKit.framework",
  63. ]
  64. assert_no_deps = [ "//ios/chrome/browser" ]
  65. configs += [ "//build/config/compiler:enable_arc" ]
  66. }
  67. repack_locales("packed_resources") {
  68. input_locales = platform_pak_locales
  69. output_locales = locales_as_apple_outputs
  70. source_patterns = [ "$root_gen_dir/ios/content_widget_extension/ios_content_widget_extension_${branding_path_component}_strings_" ]
  71. deps = [ "//ios/chrome/content_widget_extension/strings:ios_content_widget_extension_${branding_path_component}_strings" ]
  72. }
  73. generate_localizable_strings("system_strings") {
  74. visibility = [ ":*" ]
  75. _packed_resources_target = ":packed_resources"
  76. config_file = "content_widget_extension_localize_strings_config.plist"
  77. datapack_dir = get_label_info(_packed_resources_target, "target_gen_dir")
  78. packed_locales = locales_as_apple_outputs
  79. output_filenames = [ "InfoPlist.strings" ]
  80. deps = [
  81. "//ios/chrome/content_widget_extension/strings:ios_content_widget_extension_chromium_strings",
  82. # Depends on both branding strings target to ensure the proper .h exists
  83. # (the .plist configuration can only reference one of them, and their
  84. # content is identical).
  85. "//ios/chrome/content_widget_extension/strings:ios_content_widget_extension_google_chrome_strings",
  86. _packed_resources_target,
  87. ]
  88. }