chromium/ios/build/chrome_build.gni

# 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/config/apple/symbols.gni")
import("//build/config/chrome_build.gni")
import("//build/config/features.gni")
import("//build/config/ios/ios_sdk.gni")

# Xcode 13.1 or higher is required to build Chromium on iOS. This file should
# only be included when building Chromium, not other related projects (cronet,
# webrtc, ...).
assert(xcode_version_int >= 1310, "Xcode 13.1 or higher is required.")

declare_args() {
  # Enable notification center widget extensions.
  ios_enable_content_widget_extension = true
  ios_enable_search_widget_extension = true

  # Enable share extension.
  ios_enable_share_extension = true

  # Enable open in extension.
  ios_enable_open_extension = true

  # Enable credential provider extension.
  # TODO(crbug.com/356196908): The iOS for Blink should be built without
  # //components/keyed_service/core dependency.
  ios_enable_credential_provider_extension = !use_blink

  # Enable intents extension.
  ios_enable_intents_extension = true

  # Enable iOS 14, WidgetKit extension.
  ios_enable_widget_kit_extension = true

  # Enable iOS 16 lockscreen widget in WidgetKit extension.
  ios_enable_lockscreen_widget = true

  # Enable iOS shortcut widget in WidgetKit extension.
  ios_enable_shortcuts_widget = true

  # Enable iOS Push Notification Service extension.
  ios_enable_push_notification_service_extension = true

  # Label of the target providing implementation for AccountVerificationProvider.
  # Overridden when using the Google-internal repository to build Chrome on iOS.
  ios_account_verification_provider_target = "//ios/chrome/credential_provider_extension:account_verification_provider_implementation"

  # Label of the target providing implementation for the PushNotificationServiceExtension.
  # Overridden when using the Google-internal repository to build Chrome on iOS.
  ios_push_notification_service_extension_target = "//ios/chrome/push_notification_service_extension:push_notification_service_extension_implementation"

  # The API key to query Google services in the Credential Provider Extension.
  ios_credential_provider_extension_api_key = ""

  # Controls whether ScreenTime API is used.
  ios_enable_screen_time = false

  # Enable background fetch mode for feed refresh.
  ios_enable_background_mode = true

  # Value of the encryption export compliance code. See "Cryptography and
  # U.S. Export Compliance" in "Submitting the App to App Review" in the
  # Apple developer documentation
  # (https://developer.apple.com/documentation/security/complying_with_encryption_export_regulations).
  ios_encryption_export_compliance_code = ""

  # List of plist templates to merge when generating chrome Info.plist.
  ios_chrome_info_plist_additions = []

  # List of targets used to generate the plist listed in
  # ios_chrome_info_plist_additions variable (if any).
  ios_chrome_info_plist_addition_targets = []

  # List of plist templates to merge when generating chrome entitlements.
  ios_chrome_entitlements_additions = []

  # List of plist templates to merge when generating EarlGrey tests
  # entitlements.
  ios_egtests_entitlements_additions = []

  # Overridable list of dependencies that are forbidden for
  # //ios/chrome/app:chrome target.
  ios_chrome_extra_assert_no_deps = []

  # List of plist templates to merge when generating chrome cpe entitlements.
  ios_chrome_cpe_entitlements_additions = []

  # Use perf_tests_hook if true
  ios_is_perf_test = false

  # Enable memory debugging.
  ios_enable_memory_debugging = !is_chrome_branded

  # The iOS app bundle id.
  ios_chromium_bundle_id = "$ios_app_bundle_id_prefix.chrome.ios.dev"

  # Path to a PrivacyInfo.xcprivacy file to be included in app extensions.
  ios_app_extension_privacy_manifest = ""
}

if (target_environment == "catalyst") {
  # Some extensions uses API that are not available in "catalyst" environment.
  ios_enable_content_widget_extension = false
  ios_enable_search_widget_extension = false
  ios_enable_credential_provider_extension = false
  ios_enable_widget_kit_extension = false
  ios_enable_prebuilt_widget_kit_extension = false
  ios_enable_open_extension = false
  ios_enable_push_notification_service_extension = false

  # ScreenTime framework is not available in the iOS support libraries provided
  # by "catalyst" environment.
  ios_enable_screen_time = false
}

if (ios_chrome_generate_order_file) {
  assert(
      !enable_stripping && !is_debug,
      "An orderfile should only be generated if enable_stripping is false and is_debug is false to ensure all function calls are included.")

  # Disable all extensions as the order file is only generated based on running
  # the primary application.
  ios_enable_content_widget_extension = false
  ios_enable_search_widget_extension = false
  ios_enable_credential_provider_extension = false
  ios_enable_widget_kit_extension = false
  ios_enable_prebuilt_widget_kit_extension = false
  ios_enable_push_notification_service_extension = false
  ios_enable_share_extension = false
  ios_enable_open_extension = false
  ios_enable_intents_extension = false
}

# Configure is_official_release.
if (is_official_build && is_chrome_branded) {
  is_official_release = enable_dsyms && target_environment == "device" &&
                        current_toolchain == default_toolchain
} else {
  is_official_release = false
}

chromium_handoff_id = "$ios_app_bundle_id_prefix.chrome.handoff"
ios_move_tab_activity_type = "$ios_app_bundle_id_prefix.chrome.move-tab"

if (is_chrome_branded) {
  chromium_short_name = "Chrome"
  url_channel_scheme = "googlechrome-dev"
  url_secure_scheme = "googlechromes"
  url_ssoauth_scheme = "$ios_app_bundle_id_prefix.sso.chrome.stable"
  url_unsecure_scheme = "googlechrome"
  url_x_callback_scheme = "googlechrome-x-callback"
} else {
  chromium_short_name = "Chromium"
  url_channel_scheme = "chromium-dev"
  url_secure_scheme = "chromiums"
  url_ssoauth_scheme = "$ios_app_bundle_id_prefix.sso.chromium"
  url_unsecure_scheme = "chromium"
  url_x_callback_scheme = "chromium-x-callback"
}