chromium/ios/chrome/app/resources/BUILD.gn

# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/apple/tweak_info_plist.gni")
import("//build/config/chrome_build.gni")
import("//build/config/features.gni")
import("//build/config/ios/rules.gni")
import("//build/config/locales.gni")
import("//ios/build/chrome_build.gni")
import("//ios/chrome/app/resources/ios_chrome_repack.gni")
import("//ios/chrome/features.gni")
import("//ios/chrome/tools/strings/generate_localizable_strings.gni")
import("//ios/public/provider/chrome/browser/build_config.gni")
import("//tools/grit/grit_rule.gni")

group("resources") {
  public_deps = [
    ":launchscreen_xib",
    ":quick_action_icons",
    ":system_strings",
    "//ios/chrome/app/resources:packed_resources",
  ]
}

grit("ios_resources") {
  source = "ios_resources.grd"
  output_dir = "$root_gen_dir/ios/chrome"

  outputs = [
    "grit/ios_resources.h",
    "ios_resources.pak",
  ]
}

group("packed_resources") {
  public_deps = [
    ":repack_locales",
    ":repack_scalable_resources",
    ":repack_unscaled_resources",
  ]
}

ios_chrome_repack_locales("repack_locales") {
  visibility = [ ":packed_resources" ]
  input_locales = platform_pak_locales
  output_locales = locales_as_apple_outputs
}

ios_chrome_repack_scalables("repack_scalable_resources") {
  visibility = [ ":packed_resources" ]
  scales = [
    "100",
    "200",
    "300",
  ]
}

repack("repack_unscaled_resources") {
  visibility = [ ":packed_resources" ]
  sources = [
    "$root_gen_dir/components/commerce_internals_resources.pak",
    "$root_gen_dir/components/components_resources.pak",
    "$root_gen_dir/components/dev_ui_components_resources.pak",
    "$root_gen_dir/components/download_internals_resources.pak",
    "$root_gen_dir/components/flags_ui_resources.pak",
    "$root_gen_dir/components/optimization_guide_internals_resources.pak",
    "$root_gen_dir/components/policy_resources.pak",
    "$root_gen_dir/components/sync_service_sync_internals_resources.pak",
    "$root_gen_dir/components/ukm_resources.pak",
    "$root_gen_dir/components/version_ui_resources.pak",
    "$root_gen_dir/ios/chrome/ios_resources.pak",
    "$root_gen_dir/ios/web/ios_web_resources.pak",
    "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
    "$root_gen_dir/net/net_resources.pak",
    "$root_gen_dir/ui/resources/webui_resources.pak",
  ]
  deps = [
    ":ios_resources",
    "//components/commerce/core/internals/resources",
    "//components/download/resources/download_internals:resources",
    "//components/optimization_guide/optimization_guide_internals/resources",
    "//components/policy/resources/webui:resources",
    "//components/resources",
    "//components/sync/service/resources",
    "//components/ukm/debug:resources",
    "//ios/web:resources",
    "//mojo/public/js:resources",
    "//net:net_resources",
    "//ui/resources",
  ]

  output = "$target_gen_dir/resources.pak"
  copy_data_to_bundle = true

  if (use_blink) {
    sources += [
      "$root_gen_dir/base/tracing/protos/tracing_proto_resources.pak",
      "$root_gen_dir/content/attribution_internals_resources.pak",
      "$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
      "$root_gen_dir/content/browser/webrtc/resources/webrtc_internals_resources.pak",
      "$root_gen_dir/content/content_resources.pak",
      "$root_gen_dir/content/private_aggregation_internals_resources.pak",
      "$root_gen_dir/content/quota_internals_resources.pak",
      "$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
      "$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_100_percent.pak",
      "$root_gen_dir/third_party/blink/public/resources/inspector_overlay_resources.pak",
      "$root_gen_dir/third_party/blink/public/strings/blink_strings_en-US.pak",
      "$root_gen_dir/ui/strings/auto_image_annotation_strings_en-US.pak",
    ]
    deps += [
      "//base/tracing/protos:chrome_track_event_resources",
      "//content:content_resources",
      "//content/browser/resources:resources",
      "//content/browser/resources/media:resources",
      "//content/browser/webrtc/resources",
      "//third_party/blink/public:devtools_inspector_resources",
      "//third_party/blink/public:resources",
      "//third_party/blink/public:scaled_resources_100_percent",
      "//third_party/blink/public/strings",
      "//ui/resources:ui_resources_grd_grit",
      "//ui/strings:auto_image_annotation_strings",
    ]
  }
}

bundle_data_xcassets("chromium_icons") {
  catalog = "ChromiumIcons.xcassets"
  sources = [
    "ChromiumIcons.xcassets/AppIcon.appiconset/Contents.json",
    "ChromiumIcons.xcassets/AppIcon.appiconset/Icon-1024.png",
    "ChromiumIcons.xcassets/AppIcon.appiconset/Icon-1024Dark.png",
    "ChromiumIcons.xcassets/AppIcon.appiconset/Icon-1024Tinted.png",
  ]
}

bundle_data_xcassets("launchscreen_assets") {
  catalog = "Launchscreen.xcassets"
  sources = [
    "Launchscreen.xcassets/launchscreen_app_logo.imageset/Contents.json",
    "Launchscreen.xcassets/launchscreen_app_logo.imageset/[email protected]",
    "Launchscreen.xcassets/launchscreen_app_logo.imageset/[email protected]",
    "Launchscreen.xcassets/launchscreen_brand_name.imageset/Contents.json",
    "Launchscreen.xcassets/launchscreen_brand_name.imageset/[email protected]",
    "Launchscreen.xcassets/launchscreen_brand_name.imageset/[email protected]",
    "Launchscreen.xcassets/launchscreen_brand_name.imageset/[email protected]",
    "Launchscreen.xcassets/launchscreen_brand_name.imageset/[email protected]",
  ]

  public_deps = [ "//ios/chrome/common/ui/colors/resources:background_color" ]
}

# The scene startup flow (which is needed for multi-window) requires both
# additional plist entries (handled in ../BUILD.gn) and an additional storyboard
# file.
bundle_data_ib_file("base_scene_storyboard") {
  source = "BaseScene.storyboard"
}

bundle_data_ib_file("launchscreen_xib") {
  source = "LaunchScreen.xib"
  deps = [ ios_launchscreen_assets_target ]
}

generate_localizable_strings("system_strings") {
  config_file = "chrome_localize_strings_config.plist"
  datapack_dir = get_label_info("//ios/chrome/app/resources:packed_resources",
                                "target_gen_dir")
  packed_locales = locales_as_apple_outputs
  output_filenames = [
    "InfoPlist.strings",
    "Localizable.strings",
    "Intents.strings",
  ]
  deps = [ "//ios/chrome/app/resources:packed_resources" ]
}

bundle_data_xcassets("quick_action_icons") {
  catalog = "QuickActions.xcassets"
  sources = [
    "QuickActions.xcassets/quick_action_incognito.symbolset/Contents.json",
    "QuickActions.xcassets/quick_action_incognito.symbolset/incognito.cr.svg",
  ]
}

tweak_info_plist("experimental_info_plist") {
  info_plists = [ "Settings.bundle/Experimental.plist" ]
  if (ios_enable_sandbox_dump) {
    info_plists += [ "Settings.bundle/ExperimentalSandboxDump.plist" ]
  }
  info_plists += [ "Settings.bundle/ExperimentalFlags.plist" ]
}

bundle_data("settings_experimental_feed_refresh_plist") {
  sources = [ "Settings.bundle/ExperimentalFeedRefresh.plist" ]
  outputs = [ "{{bundle_resources_dir}}/Settings.bundle/{{source_file_part}}" ]
}

bundle_data("settings_experimental_synctypeslist_plist") {
  sources = [ "Settings.bundle/ExperimentalSyncTypesListDisabled.plist" ]
  outputs = [ "{{bundle_resources_dir}}/Settings.bundle/{{source_file_part}}" ]
}

bundle_data("settings_resources_experimental_plist") {
  public_deps = [
    ":experimental_info_plist",
    ":settings_experimental_feed_refresh_plist",
    ":settings_experimental_synctypeslist_plist",
  ]
  sources = get_target_outputs(":experimental_info_plist")
  outputs = [ "{{bundle_resources_dir}}/Settings.bundle/Experimental.plist" ]
}

bundle_data("settings_resources") {
  public_deps = [ ":settings_resources_experimental_plist" ]
  sources = [ "Settings.bundle/Root.plist" ]
  outputs = [ "{{bundle_resources_dir}}/Settings.bundle/{{source_file_part}}" ]
}