chromium/ios/chrome/credential_provider_extension/appex/BUILD.gn

# Copyright 2023 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/compile_entitlements.gni")
import("//build/apple/tweak_info_plist.gni")
import("//build/config/ios/rules.gni")
import("//ios/build/chrome_build.gni")
import("//ios/build/config.gni")

assert(
    ios_enable_credential_provider_extension,
    "ios_enable_credential_provider_extension must be true to depend on //ios/chrome/credential_provider_extension")

tweak_info_plist("tweak_info_plist") {
  if (is_debug) {
    info_plist = "InfoWithPasskeySupport.plist"
  } else {
    info_plist = "Info.plist"
  }
}

compile_entitlements("entitlements") {
  substitutions = [
    "IOS_BUNDLE_ID_PREFIX=$ios_app_bundle_id_prefix",
    "CHROMIUM_BUNDLE_ID=$ios_chromium_bundle_id",
  ]
  output_name =
      "$target_gen_dir/credential_provider_extension.appex.entitlements"
  entitlements_templates = [
    "entitlements/external/credential_provider_extension.appex.entitlements",
  ]
  if (ios_chrome_cpe_entitlements_additions != []) {
    entitlements_templates += ios_chrome_cpe_entitlements_additions
  }
}

ios_appex_bundle("appex") {
  output_name = "credential_provider_extension"
  deps = [
    "//ios/chrome/credential_provider_extension:credential_provider",
    "//ios/chrome/credential_provider_extension:system_strings",
  ]
  if (ios_app_extension_privacy_manifest != "") {
    deps += [ ":privacy_manifest" ]
  }

  bundle_deps_filter = [ "//third_party/icu:icudata" ]

  assert_no_deps = ios_extension_assert_no_deps

  extra_substitutions = [
    "CHROME_CHANNEL_SCHEME=$url_channel_scheme",
    "CHROMIUM_SHORT_NAME=$chromium_short_name",
    "CHROMIUM_BUNDLE_ID=$ios_chromium_bundle_id",
  ]

  entitlements_target = ":entitlements"
  info_plist_target = ":tweak_info_plist"
  bundle_identifier = "$ios_chromium_bundle_id.CredentialProviderExtension"
}

if (ios_app_extension_privacy_manifest != "") {
  bundle_data("privacy_manifest") {
    sources = [ ios_app_extension_privacy_manifest ]
    outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  }
}