1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67

content / shell / app / ios / extensions.gni [blame]

# Copyright 2024 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("//build/ios/extension_bundle_data.gni")
import("//ios/build/chrome_build.gni")
import("//ios/build/config.gni")

template("browserkit_extension") {
  _process_target = target_name
  tweak_info_plist("tweak_${_process_target}_plist") {
    info_plist = "//content/app/ios/appex/${_process_target}.plist"
  }

  extension_bundle_data("${_process_target}_bundle") {
    forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
    extension_dir = "Extensions"
    extension_name = "${_process_target}.appex"
    extension_target = ":${_process_target}"
  }

  compile_entitlements("${_process_target}_entitlements") {
    substitutions = [ "IOS_BUNDLE_ID_PREFIX=$ios_app_bundle_id_prefix" ]
    output_name = "$target_gen_dir/${_process_target}.appex.entitlements"
    entitlements_templates =
        [ "//content/app/ios/appex/${_process_target}.appex.entitlements" ]
  }

  # We don't use ios_appex_bundle here because we don't want to mess with multiple
  # toolkits as the core framework is built with the default toolkit.
  ios_app_bundle(target_name) {
    forward_variables_from(invoker,
                           "*",
                           [
                             "defines",
                             "deps",
                             "framework_dirs",
                             "frameworks",
                             "public_deps",
                             "sources",
                             "target_name",
                           ])

    output_name = target_name
    transparent = true

    configs += [ "//build/config/ios:ios_extension_executable_flags" ]

    deps = [
      "//content/app/ios/appex:${_process_target}",
      "//content/shell:content_shell_framework+link",
    ]

    ldflags = [
      "-Wl,--ignore-auto-link-option=CoreAudioTypes",
      "-Wl,-no_application_extension",
      "-Wl,-rpath,@executable_path/../../Frameworks",
    ]

    product_type = "com.apple.product-type.app-extension"
    entitlements_target = ":${_process_target}_entitlements"
    info_plist_target = ":tweak_${_process_target}_plist"
  }
}