Revert "Moves shared GN templates into //build/config/apple."

This reverts commit a9830ee5a3d04ec0842607d9c5572b9e00836f71.

Reason for revert:Tree is down with This error 

[15117/21191] LINK obj/ios/chrome/test/wpt/ios_cwt_chromedriver_tests
/bin/sh -c TOOL_VERSION=1725038125 ../../build/toolchain/apple/linker_driver.py -Wcrl,driver,../../third_party/llvm-build/Release+Asserts/bin/...(too long)
ld64.lld: error: undefined symbol: heap_profiling::HeapProfilerController::GetSyntheticFieldTrial(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>&, std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>>&) const
>>> referenced by chrome_main_parts.mm:437 (../../ios/chrome/browser/web/model/chrome_main_parts.mm:437)
>>>               obj/ios/chrome/browser/web/model/web_internal/chrome_main_parts.o:(symbol IOSChromeMainParts::StartMetricsRecording()+0x11a)

ld64.lld: error: undefined symbol: heap_profiling::HeapProfilerController::GetInstance()
>>> referenced by chrome_main_parts.mm:435 (../../ios/chrome/browser/web/model/chrome_main_parts.mm:435)

Original change's description:
> Moves shared GN templates into //build/config/apple.
>
> These templates will be shared by iOS and watchOS.
>
> Bug: 331320406
> Change-Id: Ib8b374b9a8dbdc11f30617cdf761915a30c56d88
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6033220
> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
> Commit-Queue: Rohit Rao <rohitrao@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1386904}

Bug: 331320406
Change-Id: Ib301be58eb5534551df43b55f21092bbaf61707c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6043399
Commit-Queue: Jeffrey Cohen <jeffreycohen@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Jeffrey Cohen <jeffreycohen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1386915}
diff --git a/build/config/apple/create_signed_bundle.gni b/build/config/apple/create_signed_bundle.gni
deleted file mode 100644
index 26dd57d..0000000
--- a/build/config/apple/create_signed_bundle.gni
+++ /dev/null
@@ -1,375 +0,0 @@
-# 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/config/apple/mobile_config.gni")
-import("//build_overrides/build.gni")
-
-# Constants corresponding to the bundle type identifiers use application,
-# application extension, XCTest and XCUITest targets respectively.
-apple_mobile_xcode_app_bundle_id = "com.apple.product-type.application"
-apple_mobile_xcode_appex_bundle_id = "com.apple.product-type.app-extension"
-apple_mobile_xcode_xctest_bundle_id = "com.apple.product-type.bundle.unit-test"
-apple_mobile_xcode_xcuitest_bundle_id =
-    "com.apple.product-type.bundle.ui-testing"
-
-# Wrapper around create_bundle taking care of code signature settings.
-#
-# Arguments
-#
-#   product_type
-#       string, product type for the generated Xcode project.
-#
-#   platform_sdk_name
-#       string, the name of the platform SDK
-#
-#   bundle_gen_dir
-#       (optional) directory where the bundle is generated; must be below
-#       root_out_dir and defaults to root_out_dir if omitted.
-#
-#   bundle_deps
-#       (optional) list of additional dependencies.
-#
-#   bundle_deps_filter
-#       (optional) list of dependencies to filter (for more information
-#       see "gn help bundle_deps_filter").
-#
-#   bundle_extension
-#       string, extension of the bundle, used to generate bundle name.
-#
-#   bundle_binary_target
-#       (optional) string, label of the target generating the bundle main
-#       binary. This target and bundle_binary_path are mutually exclusive.
-#
-#   bundle_binary_output
-#       (optional) string, base name of the binary generated by the
-#       bundle_binary_target target, defaults to the target name.
-#
-#   bundle_binary_path
-#       (optional) string, path to the bundle main binary. This target and
-#       bundle_binary_target are mutually exclusive.
-#
-#   output_name:
-#       (optional) string, name of the generated application, if omitted,
-#       defaults to the target_name.
-#
-#   extra_system_frameworks
-#       (optional) list of system framework to copy to the bundle.
-#
-#   enable_code_signing
-#       (optional) boolean, control whether code signing is enabled or not,
-#       default to ios_enable_code_signing if not defined.
-#
-#   entitlements_path:
-#       (optional) path to the template to use to generate the application
-#       entitlements by performing variable substitutions, defaults to
-#       //build/config/ios/entitlements.plist.
-#
-#   entitlements_target:
-#       (optional) label of the target generating the application
-#       entitlements (must generate a single file as output); cannot be
-#       defined if entitlements_path is set.
-#
-#   has_public_headers:
-#       (optional) boolean, defaults to false; only meaningful if the bundle
-#       is a framework bundle; if true, then the frameworks includes public
-#       headers
-#
-#   disable_entitlements
-#       (optional, defaults to false) boolean, control whether entitlements willi
-#       be embedded in the application during signature. If false and no
-#       entitlements are provided, default empty entitlements will be used.
-#
-#   disable_embedded_mobileprovision
-#       (optional, default to false) boolean, control whether mobile provisions
-#       will be embedded in the bundle. If true, the existing
-#       embedded.mobileprovision will be deleted.
-#
-#   xcode_extra_attributes
-#       (optional) scope, extra attributes for Xcode projects.
-#
-#   xcode_test_application_name:
-#       (optional) string, name of the test application for Xcode unit or ui
-#       test target.
-#
-#   xcode_product_bundle_id:
-#       (optional) string, the bundle ID that will be added in the XCode
-#       attributes to enable some features when debugging (e.g. MetricKit).
-#
-#   primary_info_plist:
-#       (optional) path to Info.plist to merge with the $partial_info_plist
-#       generated by the compilation of the asset catalog.
-#
-#   partial_info_plist:
-#       (optional) path to the partial Info.plist generated by the asset
-#       catalog compiler; if defined $primary_info_plist must also be defined.
-#
-#   transparent
-#       (optional) boolean, whether the bundle is "transparent"; defaults to
-#       "false" if omitted; a bundle is considered "transparent" if it does
-#       not package the "bundle_data" deps but forward them to all targets
-#       the depend on it (unless the "bundle_data" target sets "product_type"
-#       to the same value as the "create_signed_bundle" target).
-#
-template("apple_mobile_create_signed_bundle") {
-  assert(defined(invoker.product_type),
-         "product_type must be defined for $target_name")
-  assert(defined(invoker.platform_sdk_name),
-         "platform_sdk_name must be defined for $target_name")
-  assert(defined(invoker.bundle_extension),
-         "bundle_extension must be defined for $target_name")
-  assert(defined(invoker.bundle_binary_target) !=
-             defined(invoker.bundle_binary_path),
-         "Only one of bundle_binary_target or bundle_binary_path may be " +
-             "specified for $target_name")
-  assert(!defined(invoker.partial_info_plist) ||
-             defined(invoker.primary_info_plist),
-         "primary_info_plist must be defined when partial_info_plist is " +
-             "defined for $target_name")
-
-  if (defined(invoker.xcode_test_application_name)) {
-    assert(
-        invoker.product_type == apple_mobile_xcode_xctest_bundle_id ||
-            invoker.product_type == apple_mobile_xcode_xcuitest_bundle_id,
-        "xcode_test_application_name can be only defined for Xcode unit or ui test target.")
-  }
-
-  _target_name = target_name
-  _output_name = target_name
-  if (defined(invoker.output_name)) {
-    _output_name = invoker.output_name
-  }
-
-  if (defined(invoker.bundle_binary_path)) {
-    _bundle_binary_path = invoker.bundle_binary_path
-  } else {
-    _bundle_binary_target = invoker.bundle_binary_target
-    _bundle_binary_output = get_label_info(_bundle_binary_target, "name")
-    if (defined(invoker.bundle_binary_output)) {
-      _bundle_binary_output = invoker.bundle_binary_output
-    }
-    _bundle_binary_path =
-        get_label_info(_bundle_binary_target, "target_out_dir") +
-        "/$_bundle_binary_output"
-  }
-
-  _bundle_gen_dir = root_out_dir
-  if (defined(invoker.bundle_gen_dir)) {
-    _bundle_gen_dir = invoker.bundle_gen_dir
-  }
-
-  _bundle_extension = invoker.bundle_extension
-
-  _enable_embedded_mobileprovision = true
-  if (defined(invoker.disable_embedded_mobileprovision)) {
-    _enable_embedded_mobileprovision = !invoker.disable_embedded_mobileprovision
-  }
-
-  if (target_environment == "catalyst") {
-    _enable_embedded_mobileprovision = false
-  }
-
-  _enable_entitlements = true
-  if (defined(invoker.disable_entitlements)) {
-    _enable_entitlements = !invoker.disable_entitlements
-  }
-
-  if (_enable_entitlements) {
-    if (!defined(invoker.entitlements_target)) {
-      _entitlements_path = "//build/config/ios/entitlements.plist"
-      if (defined(invoker.entitlements_path)) {
-        _entitlements_path = invoker.entitlements_path
-      }
-    } else {
-      assert(!defined(invoker.entitlements_path),
-             "Cannot define both entitlements_path and entitlements_target " +
-                 "for $target_name")
-
-      _entitlements_target_outputs =
-          get_target_outputs(invoker.entitlements_target)
-      _entitlements_path = _entitlements_target_outputs[0]
-    }
-  }
-
-  _enable_code_signing = ios_enable_code_signing
-  if (defined(invoker.enable_code_signing)) {
-    _enable_code_signing = invoker.enable_code_signing
-  }
-
-  create_bundle(_target_name) {
-    forward_variables_from(invoker,
-                           [
-                             "bundle_deps_filter",
-                             "data_deps",
-                             "deps",
-                             "partial_info_plist",
-                             "product_type",
-                             "public_configs",
-                             "public_deps",
-                             "testonly",
-                             "transparent",
-                             "visibility",
-                             "xcode_test_application_name",
-                           ])
-
-    bundle_root_dir = "$_bundle_gen_dir/$_output_name$_bundle_extension"
-    if (target_environment == "simulator" || target_environment == "device") {
-      bundle_contents_dir = bundle_root_dir
-      bundle_resources_dir = bundle_contents_dir
-      bundle_executable_dir = bundle_contents_dir
-    } else if (target_environment == "catalyst") {
-      if (_bundle_extension != ".framework") {
-        bundle_contents_dir = "$bundle_root_dir/Contents"
-        bundle_resources_dir = "$bundle_contents_dir/Resources"
-        bundle_executable_dir = "$bundle_contents_dir/MacOS"
-      } else {
-        bundle_contents_dir = "$bundle_root_dir/Versions/A"
-        bundle_resources_dir = "$bundle_contents_dir/Resources"
-        bundle_executable_dir = bundle_contents_dir
-      }
-    }
-
-    if (!defined(public_deps)) {
-      public_deps = []
-    }
-
-    _bundle_identifier = ""
-    if (defined(invoker.xcode_product_bundle_id)) {
-      _bundle_identifier = invoker.xcode_product_bundle_id
-      assert(_bundle_identifier == string_replace(_bundle_identifier, "_", "-"),
-             "$target_name: bundle_identifier does not respect rfc1034: " +
-                 _bundle_identifier)
-    }
-
-    xcode_extra_attributes = {
-      PRODUCT_BUNDLE_IDENTIFIER = _bundle_identifier
-      CODE_SIGNING_REQUIRED = "NO"
-      CODE_SIGNING_ALLOWED = "NO"
-      CODE_SIGN_IDENTITY = ""
-      DONT_GENERATE_INFOPLIST_FILE = "YES"
-
-      # If invoker has defined extra attributes, they override the defaults.
-      if (defined(invoker.xcode_extra_attributes)) {
-        forward_variables_from(invoker.xcode_extra_attributes, "*")
-      }
-    }
-
-    if (defined(invoker.bundle_binary_target)) {
-      public_deps += [ invoker.bundle_binary_target ]
-    }
-
-    if (defined(invoker.bundle_deps)) {
-      if (!defined(deps)) {
-        deps = []
-      }
-      deps += invoker.bundle_deps
-    }
-    if (!defined(deps)) {
-      deps = []
-    }
-
-    post_processing_script = "//build/config/apple/codesign.py"
-    post_processing_sources = [ _bundle_binary_path ]
-    if (_enable_entitlements) {
-      if (defined(invoker.entitlements_target)) {
-        deps += [ invoker.entitlements_target ]
-      }
-      post_processing_sources += [ _entitlements_path ]
-    }
-    post_processing_outputs = [ "$bundle_executable_dir/$_output_name" ]
-    if (_enable_code_signing) {
-      post_processing_outputs +=
-          [ "$bundle_contents_dir/_CodeSignature/CodeResources" ]
-    }
-    if (ios_code_signing_identity != "" && target_environment == "device" &&
-        _enable_embedded_mobileprovision) {
-      post_processing_outputs +=
-          [ "$bundle_contents_dir/embedded.mobileprovision" ]
-    }
-    if (_bundle_extension == ".framework") {
-      if (target_environment == "catalyst") {
-        post_processing_outputs += [
-          "$bundle_root_dir/Versions/Current",
-          "$bundle_root_dir/$_output_name",
-        ]
-
-        if (defined(invoker.has_public_headers) && invoker.has_public_headers) {
-          post_processing_outputs += [
-            "$bundle_root_dir/Headers",
-            "$bundle_root_dir/Modules",
-          ]
-        }
-      } else {
-        not_needed(invoker, [ "has_public_headers" ])
-      }
-    }
-
-    if (defined(invoker.extra_system_frameworks)) {
-      foreach(_framework, invoker.extra_system_frameworks) {
-        post_processing_outputs += [ "$bundle_contents_dir/Frameworks/" +
-                                     get_path_info(_framework, "file") ]
-      }
-    }
-
-    post_processing_args = [
-      "code-sign-bundle",
-      "-t=" + invoker.platform_sdk_name,
-      "-i=" + ios_code_signing_identity,
-      "-b=" + rebase_path(_bundle_binary_path, root_build_dir),
-    ]
-    foreach(mobileprovision, ios_mobileprovision_files) {
-      post_processing_args +=
-          [ "-m=" + rebase_path(mobileprovision, root_build_dir) ]
-    }
-    post_processing_sources += ios_mobileprovision_files
-    if (_enable_entitlements) {
-      post_processing_args +=
-          [ "-e=" + rebase_path(_entitlements_path, root_build_dir) ]
-    }
-    if (!_enable_embedded_mobileprovision) {
-      post_processing_args += [ "--disable-embedded-mobileprovision" ]
-    }
-    post_processing_args += [ rebase_path(bundle_root_dir, root_build_dir) ]
-    if (!_enable_code_signing) {
-      post_processing_args += [ "--disable-code-signature" ]
-    }
-    if (defined(invoker.extra_system_frameworks)) {
-      # All framework in extra_system_frameworks are expected to be system
-      # framework and the path to be already system absolute so do not use
-      # rebase_path here unless using RBE and system Xcode (as in that
-      # case the system framework are found via a symlink in root_build_dir).
-      foreach(_framework, invoker.extra_system_frameworks) {
-        if (use_system_xcode && use_remoteexec) {
-          _framework_path = rebase_path(_framework, root_build_dir)
-        } else {
-          _framework_path = _framework
-        }
-        post_processing_args += [ "-F=$_framework_path" ]
-      }
-    }
-    if (defined(invoker.partial_info_plist)) {
-      _partial_info_plists = [
-        invoker.primary_info_plist,
-        invoker.partial_info_plist,
-      ]
-
-      _plist_compiler_path = "//build/apple/plist_util.py"
-
-      post_processing_sources += _partial_info_plists
-      post_processing_sources += [ _plist_compiler_path ]
-      if (target_environment != "catalyst" ||
-          _bundle_extension != ".framework") {
-        post_processing_outputs += [ "$bundle_contents_dir/Info.plist" ]
-      } else {
-        post_processing_outputs += [ "$bundle_resources_dir/Info.plist" ]
-      }
-
-      post_processing_args +=
-          [ "-P=" + rebase_path(_plist_compiler_path, root_build_dir) ]
-      foreach(_partial_info_plist, _partial_info_plists) {
-        post_processing_args +=
-            [ "-p=" + rebase_path(_partial_info_plist, root_build_dir) ]
-      }
-    }
-  }
-}
diff --git a/build/config/apple/mobile_bundle_data.gni b/build/config/apple/mobile_bundle_data.gni
deleted file mode 100644
index 26be4a5..0000000
--- a/build/config/apple/mobile_bundle_data.gni
+++ /dev/null
@@ -1,281 +0,0 @@
-# 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/config/zip.gni")
-
-if (is_ios) {
-  import("//build/config/ios/ios_sdk_overrides.gni")
-}
-
-# Compile a xib or storyboard file and add it to a bundle_data so that it is
-# available at runtime in the bundle.
-#
-# Arguments
-#
-#   source:
-#       string, path of the xib or storyboard to compile.
-#
-#   extension:
-#       string, extension of the generated file or bundle.
-#
-#   bundle_files:
-#       list of string, name of the files in the generated  bundle;
-#       if empty, the output is expected to be a single file.
-#
-# Forwards all variables to the bundle_data target.
-template("bundle_data_ib_file") {
-  assert(defined(invoker.source), "source needs to be defined for $target_name")
-  assert(defined(invoker.extension),
-         "extension needs to be defined for $target_name")
-  assert(defined(invoker.bundle_files),
-         "bundle_files needs to be defined for $target_name")
-
-  _target_name = target_name
-  _compile_target =
-      target_name + "_compile_" + get_path_info(invoker.source, "extension")
-
-  _output_path = "$target_gen_dir/$_target_name/"
-  _output_name = get_path_info(invoker.source, "name") + ".${invoker.extension}"
-
-  if (is_ios) {
-    _deployment_target = ios_deployment_target
-    _target_devices = [
-      "iphone",
-      "ipad",
-    ]
-  } else {
-    assert(false, "Unsupported platform: " + current_os)
-  }
-
-  action(_compile_target) {
-    forward_variables_from(invoker,
-                           "*",
-                           [
-                             "source",
-                             "bundle_files",
-                           ])
-
-    script = "//build/config/apple/compile_ib_files.py"
-    args = [
-      "--input",
-      rebase_path(invoker.source, root_build_dir),
-      "--output",
-      rebase_path("$_output_path/$_output_name", root_build_dir),
-      "--minimum-deployment-target",
-      _deployment_target,
-      "--auto-activate-custom-fonts",
-    ]
-
-    foreach(target_device, _target_devices) {
-      args += [
-        "--target-device",
-        target_device,
-      ]
-    }
-
-    sources = [ invoker.source ]
-    if (invoker.bundle_files == []) {
-      outputs = [ "$_output_path/$_output_name" ]
-    } else {
-      outputs = []
-      foreach(_bundle_file, invoker.bundle_files) {
-        outputs += [ "$_output_path/$_output_name/$_bundle_file" ]
-      }
-    }
-  }
-
-  bundle_data(_target_name) {
-    forward_variables_from(invoker, "*", [ "source" ])
-
-    if (!defined(public_deps)) {
-      public_deps = []
-    }
-    public_deps += [ ":$_compile_target" ]
-
-    sources = get_target_outputs(":$_compile_target")
-    if (invoker.bundle_files == []) {
-      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
-    } else {
-      outputs =
-          [ "{{bundle_resources_dir}}/$_output_name/{{source_file_part}}" ]
-    }
-  }
-}
-
-# Compile a xib file and add it to a bundle_data so that it is available at
-# runtime in the bundle.
-#
-# Arguments
-#
-#   source:
-#       string, path of the xib or storyboard to compile.
-#
-# Forwards all variables to the bundle_data target.
-template("bundle_data_xib_file") {
-  assert(defined(invoker.source), "source needs to be defined for $target_name")
-
-  _extension = get_path_info(invoker.source, "extension")
-  assert(_extension == "xib",
-         "source must have the .xib extension for $target_name")
-
-  bundle_data_ib_file(target_name) {
-    forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
-    forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
-
-    extension = "nib"
-    bundle_files = []
-  }
-}
-
-# Compile a storyboard file and add it to a bundle_data so that it is available
-# at runtime in the bundle.
-#
-# Arguments
-#
-#   source:
-#       string, path of the xib or storyboard to compile.
-#
-#   bundle_files
-#       list of strings, name of the individual files in the generated bundle
-#
-# Forwards all variables to the bundle_data target.
-template("bundle_data_storyboard_file") {
-  assert(defined(invoker.source), "source needs to be defined for $target_name")
-
-  assert(defined(invoker.bundle_files) && invoker.bundle_files != [],
-         "bundle_files needs to be defined for $target_name")
-
-  _extension = get_path_info(invoker.source, "extension")
-  assert(_extension == "storyboard",
-         "source must have the .storyboard extension for $target_name")
-
-  bundle_data_ib_file(target_name) {
-    forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
-    forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
-
-    extension = "storyboardc"
-  }
-}
-
-# Compile a strings file and add it to a bundle_data so that it is available
-# at runtime in the bundle.
-#
-# Arguments
-#
-#   source:
-#       string, path of the strings file to compile.
-#
-#   output:
-#       string, path of the compiled file in the final bundle.
-#
-# Forwards all variables to the bundle_data target.
-template("bundle_data_strings") {
-  assert(defined(invoker.source), "source needs to be defined for $target_name")
-  assert(defined(invoker.output), "output needs to be defined for $target_name")
-
-  _source_extension = get_path_info(invoker.source, "extension")
-  assert(_source_extension == "strings",
-         "source must be a .strings for $target_name")
-
-  _target_name = target_name
-  _convert_target = target_name + "_compile_strings"
-
-  convert_plist(_convert_target) {
-    visibility = [ ":$_target_name" ]
-    source = invoker.source
-    output =
-        "$target_gen_dir/$_target_name/" + get_path_info(invoker.source, "file")
-    format = "binary1"
-  }
-
-  bundle_data(_target_name) {
-    forward_variables_from(invoker,
-                           "*",
-                           [
-                             "source",
-                             "output",
-                           ])
-
-    if (!defined(public_deps)) {
-      public_deps = []
-    }
-    public_deps += [ ":$_convert_target" ]
-
-    sources = get_target_outputs(":$_convert_target")
-
-    outputs = [ invoker.output ]
-  }
-}
-
-# This template declares a bundle_data target that reference an assets
-# catalog so that is is compiled to the asset catalog of the generated
-# bundle.
-#
-# The target will ensure that only the files explicitly listed will be
-# compiled into the final application (i.e. it allow listing some of
-# the assets catalog content conditionally).
-#
-# The target requires that the files are located in a .xcassets bundle
-# in the repository (or generated via a script). This ensures that the
-# assets catalog is correctly visible in Xcode (though as usual, using
-# Xcode to make change to the .xcassets bundle will not be reflected in
-# the final build unless the target is updated in the gn configuration).
-#
-# Arguments
-#
-#     sources:
-#       required, list of strings, path to the files contained in the
-#       .xcassets bundle; this may contains a sub-set of the files on
-#       disk if some assets are only compiled conditionally
-#
-#     catalog:
-#       required, string, path to the .xcassets bundle; all path in
-#       sources must be relative to this path or the compilation will
-#       fail
-#
-# Example
-#
-#     bundle_data_xcassets("assets") {
-#       catalog = "Assets.xcassets"
-#       sources = [
-#         "Assets.xcassets/Color.colorset/Contents.json",
-#         "Assets.xcassets/Contents.json",
-#       ]
-#       if (includes_images) {
-#         sources += [
-#           "Assets.xcassets/Image.imageset/Contents.json",
-#           "Assets.xcassets/Image.imageset/Image.svg",
-#         ]
-#       }
-#     }
-template("bundle_data_xcassets") {
-  assert(defined(invoker.sources), "sources must be defined for $target_name")
-  assert(defined(invoker.catalog), "catalog must be defined for $target_name")
-
-  _target_name = target_name
-  _target_zip = target_name + "_zip"
-
-  zip(_target_zip) {
-    _catalog_name = get_path_info(invoker.catalog, "file")
-    _catalog_path = get_path_info(invoker.catalog, "dir")
-
-    inputs = invoker.sources
-    output = "$target_out_dir/$target_name/$_catalog_name"
-    base_dir = _catalog_path
-  }
-
-  bundle_data(_target_name) {
-    forward_variables_from(invoker,
-                           "*",
-                           [
-                             "sources",
-                             "deps",
-                             "public_deps",
-                           ])
-
-    public_deps = [ ":$_target_zip" ]
-    sources = get_target_outputs(":$_target_zip")
-    outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
-  }
-}
diff --git a/build/config/apple/compile_ib_files.py b/build/config/ios/compile_ib_files.py
similarity index 83%
rename from build/config/apple/compile_ib_files.py
rename to build/config/ios/compile_ib_files.py
index ca535ca..e420016 100644
--- a/build/config/apple/compile_ib_files.py
+++ b/build/config/ios/compile_ib_files.py
@@ -2,6 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+
 import argparse
 import logging
 import os
@@ -14,18 +15,15 @@
   parser = argparse.ArgumentParser(
       description='A script to compile xib and storyboard.',
       fromfile_prefix_chars='@')
-  parser.add_argument('-o',
-                      '--output',
-                      required=True,
+  parser.add_argument('-o', '--output', required=True,
                       help='Path to output bundle.')
-  parser.add_argument('-i',
-                      '--input',
-                      required=True,
+  parser.add_argument('-i', '--input', required=True,
                       help='Path to input xib or storyboard.')
   args, unknown_args = parser.parse_known_args()
 
   ibtool_args = [
-      'xcrun', 'ibtool', '--errors', '--warnings', '--notices',
+      'xcrun', 'ibtool',
+      '--errors', '--warnings', '--notices',
       '--output-format', 'human-readable-text'
   ]
   ibtool_args += unknown_args
diff --git a/build/config/ios/rules.gni b/build/config/ios/rules.gni
index f49b435..5e2ca6e 100644
--- a/build/config/ios/rules.gni
+++ b/build/config/ios/rules.gni
@@ -3,44 +3,376 @@
 # found in the LICENSE file.
 
 import("//build/apple/apple_info_plist.gni")
-import("//build/config/apple/create_signed_bundle.gni")
-import("//build/config/apple/mobile_bundle_data.gni")
 import("//build/config/apple/symbols.gni")
 import("//build/config/compiler/compiler.gni")
 import("//build/config/ios/ios_sdk.gni")
+import("//build/config/zip.gni")
 import("//build/toolchain/rbe.gni")
 import("//build/toolchain/siso.gni")
 import("//build/toolchain/toolchain.gni")
 import("//build_overrides/build.gni")
 
-# iOS-specific wrapper around apple_mobile_create_signed_bundle.
+# Constants corresponding to the bundle type identifiers use application,
+# application extension, XCTest and XCUITest targets respectively.
+_ios_xcode_app_bundle_id = "com.apple.product-type.application"
+_ios_xcode_appex_bundle_id = "com.apple.product-type.app-extension"
+_ios_xcode_xctest_bundle_id = "com.apple.product-type.bundle.unit-test"
+_ios_xcode_xcuitest_bundle_id = "com.apple.product-type.bundle.ui-testing"
+
+# Wrapper around create_bundle taking care of code signature settings.
 #
-# See //build/config/apple/mobile_rules.gni for a description of arguments.
-template("ios_create_signed_bundle") {
-  apple_mobile_create_signed_bundle(target_name) {
+# Arguments
+#
+#   product_type
+#       string, product type for the generated Xcode project.
+#
+#   bundle_gen_dir
+#       (optional) directory where the bundle is generated; must be below
+#       root_out_dir and defaults to root_out_dir if omitted.
+#
+#   bundle_deps
+#       (optional) list of additional dependencies.
+#
+#   bundle_deps_filter
+#       (optional) list of dependencies to filter (for more information
+#       see "gn help bundle_deps_filter").
+#
+#   bundle_extension
+#       string, extension of the bundle, used to generate bundle name.
+#
+#   bundle_binary_target
+#       (optional) string, label of the target generating the bundle main
+#       binary. This target and bundle_binary_path are mutually exclusive.
+#
+#   bundle_binary_output
+#       (optional) string, base name of the binary generated by the
+#       bundle_binary_target target, defaults to the target name.
+#
+#   bundle_binary_path
+#       (optional) string, path to the bundle main binary. This target and
+#       bundle_binary_target are mutually exclusive.
+#
+#   output_name:
+#       (optional) string, name of the generated application, if omitted,
+#       defaults to the target_name.
+#
+#   extra_system_frameworks
+#       (optional) list of system framework to copy to the bundle.
+#
+#   enable_code_signing
+#       (optional) boolean, control whether code signing is enabled or not,
+#       default to ios_enable_code_signing if not defined.
+#
+#   entitlements_path:
+#       (optional) path to the template to use to generate the application
+#       entitlements by performing variable substitutions, defaults to
+#       //build/config/ios/entitlements.plist.
+#
+#   entitlements_target:
+#       (optional) label of the target generating the application
+#       entitlements (must generate a single file as output); cannot be
+#       defined if entitlements_path is set.
+#
+#   has_public_headers:
+#       (optional) boolean, defaults to false; only meaningful if the bundle
+#       is a framework bundle; if true, then the frameworks includes public
+#       headers
+#
+#   disable_entitlements
+#       (optional, defaults to false) boolean, control whether entitlements willi
+#       be embedded in the application during signature. If false and no
+#       entitlements are provided, default empty entitlements will be used.
+#
+#   disable_embedded_mobileprovision
+#       (optional, default to false) boolean, control whether mobile provisions
+#       will be embedded in the bundle. If true, the existing
+#       embedded.mobileprovision will be deleted.
+#
+#   xcode_extra_attributes
+#       (optional) scope, extra attributes for Xcode projects.
+#
+#   xcode_test_application_name:
+#       (optional) string, name of the test application for Xcode unit or ui
+#       test target.
+#
+#   xcode_product_bundle_id:
+#       (optional) string, the bundle ID that will be added in the XCode
+#       attributes to enable some features when debugging (e.g. MetricKit).
+#
+#   primary_info_plist:
+#       (optional) path to Info.plist to merge with the $partial_info_plist
+#       generated by the compilation of the asset catalog.
+#
+#   partial_info_plist:
+#       (optional) path to the partial Info.plist generated by the asset
+#       catalog compiler; if defined $primary_info_plist must also be defined.
+#
+#   transparent
+#       (optional) boolean, whether the bundle is "transparent"; defaults to
+#       "false" if omitted; a bundle is considered "transparent" if it does
+#       not package the "bundle_data" deps but forward them to all targets
+#       the depend on it (unless the "bundle_data" target sets "product_type"
+#       to the same value as the "create_signed_bundle" target).
+#
+template("create_signed_bundle") {
+  assert(defined(invoker.product_type),
+         "product_type must be defined for $target_name")
+  assert(defined(invoker.bundle_extension),
+         "bundle_extension must be defined for $target_name")
+  assert(defined(invoker.bundle_binary_target) !=
+             defined(invoker.bundle_binary_path),
+         "Only one of bundle_binary_target or bundle_binary_path may be " +
+             "specified for $target_name")
+  assert(!defined(invoker.partial_info_plist) ||
+             defined(invoker.primary_info_plist),
+         "primary_info_plist must be defined when partial_info_plist is " +
+             "defined for $target_name")
+
+  if (defined(invoker.xcode_test_application_name)) {
+    assert(
+        invoker.product_type == _ios_xcode_xctest_bundle_id ||
+            invoker.product_type == _ios_xcode_xcuitest_bundle_id,
+        "xcode_test_application_name can be only defined for Xcode unit or ui test target.")
+  }
+
+  _target_name = target_name
+  _output_name = target_name
+  if (defined(invoker.output_name)) {
+    _output_name = invoker.output_name
+  }
+
+  if (defined(invoker.bundle_binary_path)) {
+    _bundle_binary_path = invoker.bundle_binary_path
+  } else {
+    _bundle_binary_target = invoker.bundle_binary_target
+    _bundle_binary_output = get_label_info(_bundle_binary_target, "name")
+    if (defined(invoker.bundle_binary_output)) {
+      _bundle_binary_output = invoker.bundle_binary_output
+    }
+    _bundle_binary_path =
+        get_label_info(_bundle_binary_target, "target_out_dir") +
+        "/$_bundle_binary_output"
+  }
+
+  _bundle_gen_dir = root_out_dir
+  if (defined(invoker.bundle_gen_dir)) {
+    _bundle_gen_dir = invoker.bundle_gen_dir
+  }
+
+  _bundle_extension = invoker.bundle_extension
+
+  _enable_embedded_mobileprovision = true
+  if (defined(invoker.disable_embedded_mobileprovision)) {
+    _enable_embedded_mobileprovision = !invoker.disable_embedded_mobileprovision
+  }
+
+  if (target_environment == "catalyst") {
+    _enable_embedded_mobileprovision = false
+  }
+
+  _enable_entitlements = true
+  if (defined(invoker.disable_entitlements)) {
+    _enable_entitlements = !invoker.disable_entitlements
+  }
+
+  if (_enable_entitlements) {
+    if (!defined(invoker.entitlements_target)) {
+      _entitlements_path = "//build/config/ios/entitlements.plist"
+      if (defined(invoker.entitlements_path)) {
+        _entitlements_path = invoker.entitlements_path
+      }
+    } else {
+      assert(!defined(invoker.entitlements_path),
+             "Cannot define both entitlements_path and entitlements_target " +
+                 "for $target_name")
+
+      _entitlements_target_outputs =
+          get_target_outputs(invoker.entitlements_target)
+      _entitlements_path = _entitlements_target_outputs[0]
+    }
+  }
+
+  _enable_code_signing = ios_enable_code_signing
+  if (defined(invoker.enable_code_signing)) {
+    _enable_code_signing = invoker.enable_code_signing
+  }
+
+  create_bundle(_target_name) {
     forward_variables_from(invoker,
-                           "*",
                            [
-                             "platform_sdk_name",
-                             "xcode_extra_attributes",
+                             "bundle_deps_filter",
+                             "data_deps",
+                             "deps",
+                             "partial_info_plist",
+                             "product_type",
+                             "public_configs",
+                             "public_deps",
+                             "testonly",
+                             "transparent",
+                             "visibility",
+                             "xcode_test_application_name",
                            ])
-    platform_sdk_name = ios_sdk_name
+
+    bundle_root_dir = "$_bundle_gen_dir/$_output_name$_bundle_extension"
+    if (target_environment == "simulator" || target_environment == "device") {
+      bundle_contents_dir = bundle_root_dir
+      bundle_resources_dir = bundle_contents_dir
+      bundle_executable_dir = bundle_contents_dir
+    } else if (target_environment == "catalyst") {
+      if (_bundle_extension != ".framework") {
+        bundle_contents_dir = "$bundle_root_dir/Contents"
+        bundle_resources_dir = "$bundle_contents_dir/Resources"
+        bundle_executable_dir = "$bundle_contents_dir/MacOS"
+      } else {
+        bundle_contents_dir = "$bundle_root_dir/Versions/A"
+        bundle_resources_dir = "$bundle_contents_dir/Resources"
+        bundle_executable_dir = bundle_contents_dir
+      }
+    }
+
+    if (!defined(public_deps)) {
+      public_deps = []
+    }
+
+    _bundle_identifier = ""
+    if (defined(invoker.xcode_product_bundle_id)) {
+      _bundle_identifier = invoker.xcode_product_bundle_id
+      assert(_bundle_identifier == string_replace(_bundle_identifier, "_", "-"),
+             "$target_name: bundle_identifier does not respect rfc1034: " +
+                 _bundle_identifier)
+    }
+
     xcode_extra_attributes = {
       IPHONEOS_DEPLOYMENT_TARGET = ios_deployment_target
+      PRODUCT_BUNDLE_IDENTIFIER = _bundle_identifier
+      CODE_SIGNING_REQUIRED = "NO"
+      CODE_SIGNING_ALLOWED = "NO"
+      CODE_SIGN_IDENTITY = ""
+      DONT_GENERATE_INFOPLIST_FILE = "YES"
 
       # If invoker has defined extra attributes, they override the defaults.
       if (defined(invoker.xcode_extra_attributes)) {
         forward_variables_from(invoker.xcode_extra_attributes, "*")
       }
     }
-  }
-}
 
-# Expose the template under its original name, to avoid breaking dependencies.
-template("create_signed_bundle") {
-  ios_create_signed_bundle(target_name) {
-    forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
-    forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+    if (defined(invoker.bundle_binary_target)) {
+      public_deps += [ invoker.bundle_binary_target ]
+    }
+
+    if (defined(invoker.bundle_deps)) {
+      if (!defined(deps)) {
+        deps = []
+      }
+      deps += invoker.bundle_deps
+    }
+    if (!defined(deps)) {
+      deps = []
+    }
+
+    post_processing_script = "//build/config/apple/codesign.py"
+    post_processing_sources = [ _bundle_binary_path ]
+    if (_enable_entitlements) {
+      if (defined(invoker.entitlements_target)) {
+        deps += [ invoker.entitlements_target ]
+      }
+      post_processing_sources += [ _entitlements_path ]
+    }
+    post_processing_outputs = [ "$bundle_executable_dir/$_output_name" ]
+    if (_enable_code_signing) {
+      post_processing_outputs +=
+          [ "$bundle_contents_dir/_CodeSignature/CodeResources" ]
+    }
+    if (ios_code_signing_identity != "" && target_environment == "device" &&
+        _enable_embedded_mobileprovision) {
+      post_processing_outputs +=
+          [ "$bundle_contents_dir/embedded.mobileprovision" ]
+    }
+    if (_bundle_extension == ".framework") {
+      if (target_environment == "catalyst") {
+        post_processing_outputs += [
+          "$bundle_root_dir/Versions/Current",
+          "$bundle_root_dir/$_output_name",
+        ]
+
+        if (defined(invoker.has_public_headers) && invoker.has_public_headers) {
+          post_processing_outputs += [
+            "$bundle_root_dir/Headers",
+            "$bundle_root_dir/Modules",
+          ]
+        }
+      } else {
+        not_needed(invoker, [ "has_public_headers" ])
+      }
+    }
+
+    if (defined(invoker.extra_system_frameworks)) {
+      foreach(_framework, invoker.extra_system_frameworks) {
+        post_processing_outputs += [ "$bundle_contents_dir/Frameworks/" +
+                                     get_path_info(_framework, "file") ]
+      }
+    }
+
+    post_processing_args = [
+      "code-sign-bundle",
+      "-t=" + ios_sdk_name,
+      "-i=" + ios_code_signing_identity,
+      "-b=" + rebase_path(_bundle_binary_path, root_build_dir),
+    ]
+    foreach(mobileprovision, ios_mobileprovision_files) {
+      post_processing_args +=
+          [ "-m=" + rebase_path(mobileprovision, root_build_dir) ]
+    }
+    post_processing_sources += ios_mobileprovision_files
+    if (_enable_entitlements) {
+      post_processing_args +=
+          [ "-e=" + rebase_path(_entitlements_path, root_build_dir) ]
+    }
+    if (!_enable_embedded_mobileprovision) {
+      post_processing_args += [ "--disable-embedded-mobileprovision" ]
+    }
+    post_processing_args += [ rebase_path(bundle_root_dir, root_build_dir) ]
+    if (!_enable_code_signing) {
+      post_processing_args += [ "--disable-code-signature" ]
+    }
+    if (defined(invoker.extra_system_frameworks)) {
+      # All framework in extra_system_frameworks are expected to be system
+      # framework and the path to be already system absolute so do not use
+      # rebase_path here unless using RBE and system Xcode (as in that
+      # case the system framework are found via a symlink in root_build_dir).
+      foreach(_framework, invoker.extra_system_frameworks) {
+        if (use_system_xcode && use_remoteexec) {
+          _framework_path = rebase_path(_framework, root_build_dir)
+        } else {
+          _framework_path = _framework
+        }
+        post_processing_args += [ "-F=$_framework_path" ]
+      }
+    }
+    if (defined(invoker.partial_info_plist)) {
+      _partial_info_plists = [
+        invoker.primary_info_plist,
+        invoker.partial_info_plist,
+      ]
+
+      _plist_compiler_path = "//build/apple/plist_util.py"
+
+      post_processing_sources += _partial_info_plists
+      post_processing_sources += [ _plist_compiler_path ]
+      if (target_environment != "catalyst" ||
+          _bundle_extension != ".framework") {
+        post_processing_outputs += [ "$bundle_contents_dir/Info.plist" ]
+      } else {
+        post_processing_outputs += [ "$bundle_resources_dir/Info.plist" ]
+      }
+
+      post_processing_args +=
+          [ "-P=" + rebase_path(_plist_compiler_path, root_build_dir) ]
+      foreach(_partial_info_plist, _partial_info_plists) {
+        post_processing_args +=
+            [ "-p=" + rebase_path(_partial_info_plist, root_build_dir) ]
+      }
+    }
   }
 }
 
@@ -184,7 +516,7 @@
 #       "false" if omitted; a bundle is considered "transparent" if it does
 #       not package the "bundle_data" deps but forward them to all targets
 #       the depend on it (unless the "bundle_data" target sets "product_type"
-#       to the same value as the "ios_create_signed_bundle" target).
+#       to the same value as the "create_signed_bundle" target).
 #
 # For more information, see "gn help executable".
 template("ios_app_bundle") {
@@ -259,20 +591,20 @@
       get_label_info(":$_generate_entitlements_target", "target_out_dir") +
       "/$_output_name.xcent"
 
-  _product_type = apple_mobile_xcode_app_bundle_id
+  _product_type = _ios_xcode_app_bundle_id
   if (defined(invoker.product_type)) {
     _product_type = invoker.product_type
   }
 
-  if (_product_type == apple_mobile_xcode_app_bundle_id) {
+  if (_product_type == _ios_xcode_app_bundle_id) {
     _bundle_extension = ".app"
-  } else if (_product_type == apple_mobile_xcode_appex_bundle_id) {
+  } else if (_product_type == _ios_xcode_appex_bundle_id) {
     _bundle_extension = ".appex"
   } else {
     assert(false, "unknown product_type \"$product_type\" for $_target_name")
   }
 
-  _is_app_bundle = _product_type == apple_mobile_xcode_app_bundle_id
+  _is_app_bundle = _product_type == _ios_xcode_app_bundle_id
 
   if (_extract_intents_metadata) {
     _metadata_extraction = _target_name + "_metadata_extraction"
@@ -502,7 +834,7 @@
   }
 
   foreach(_variant, _variants) {
-    ios_create_signed_bundle(_variant.target_name) {
+    create_signed_bundle(_variant.target_name) {
       forward_variables_from(invoker,
                              [
                                "bundle_deps",
@@ -628,7 +960,7 @@
                              "bundle_extension",
                              "product_type",
                            ])
-    product_type = apple_mobile_xcode_appex_bundle_id
+    product_type = _ios_xcode_appex_bundle_id
   }
 }
 
@@ -636,6 +968,265 @@
   configs = [ "//build/config/ios:ios_extension_executable_flags" ]
 }
 
+# Compile a xib or storyboard file and add it to a bundle_data so that it is
+# available at runtime in the bundle.
+#
+# Arguments
+#
+#   source:
+#       string, path of the xib or storyboard to compile.
+#
+#   extension:
+#       string, extension of the generated file or bundle.
+#
+#   bundle_files:
+#       list of string, name of the files in the generated  bundle;
+#       if empty, the output is expected to be a single file.
+#
+# Forwards all variables to the bundle_data target.
+template("bundle_data_ib_file") {
+  assert(defined(invoker.source), "source needs to be defined for $target_name")
+  assert(defined(invoker.extension),
+         "extension needs to be defined for $target_name")
+  assert(defined(invoker.bundle_files),
+         "bundle_files needs to be defined for $target_name")
+
+  _target_name = target_name
+  _compile_target =
+      target_name + "_compile_" + get_path_info(invoker.source, "extension")
+
+  _output_path = "$target_gen_dir/$_target_name/"
+  _output_name = get_path_info(invoker.source, "name") + ".${invoker.extension}"
+
+  action(_compile_target) {
+    forward_variables_from(invoker,
+                           "*",
+                           [
+                             "source",
+                             "bundle_files",
+                           ])
+
+    script = "//build/config/ios/compile_ib_files.py"
+    args = [
+      "--input",
+      rebase_path(invoker.source, root_build_dir),
+      "--output",
+      rebase_path("$_output_path/$_output_name", root_build_dir),
+      "--minimum-deployment-target",
+      ios_deployment_target,
+      "--auto-activate-custom-fonts",
+      "--target-device",
+      "iphone",
+      "--target-device",
+      "ipad",
+    ]
+
+    sources = [ invoker.source ]
+    if (invoker.bundle_files == []) {
+      outputs = [ "$_output_path/$_output_name" ]
+    } else {
+      outputs = []
+      foreach(_bundle_file, invoker.bundle_files) {
+        outputs += [ "$_output_path/$_output_name/$_bundle_file" ]
+      }
+    }
+  }
+
+  bundle_data(_target_name) {
+    forward_variables_from(invoker, "*", [ "source" ])
+
+    if (!defined(public_deps)) {
+      public_deps = []
+    }
+    public_deps += [ ":$_compile_target" ]
+
+    sources = get_target_outputs(":$_compile_target")
+    if (invoker.bundle_files == []) {
+      outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
+    } else {
+      outputs =
+          [ "{{bundle_resources_dir}}/$_output_name/{{source_file_part}}" ]
+    }
+  }
+}
+
+# Compile a xib file and add it to a bundle_data so that it is available at
+# runtime in the bundle.
+#
+# Arguments
+#
+#   source:
+#       string, path of the xib or storyboard to compile.
+#
+# Forwards all variables to the bundle_data target.
+template("bundle_data_xib_file") {
+  assert(defined(invoker.source), "source needs to be defined for $target_name")
+
+  _extension = get_path_info(invoker.source, "extension")
+  assert(_extension == "xib",
+         "source must have the .xib extension for $target_name")
+
+  bundle_data_ib_file(target_name) {
+    forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
+    forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+
+    extension = "nib"
+    bundle_files = []
+  }
+}
+
+# Compile a storyboard file and add it to a bundle_data so that it is available
+# at runtime in the bundle.
+#
+# Arguments
+#
+#   source:
+#       string, path of the xib or storyboard to compile.
+#
+#   bundle_files
+#       list of strings, name of the individual files in the generated bundle
+#
+# Forwards all variables to the bundle_data target.
+template("bundle_data_storyboard_file") {
+  assert(defined(invoker.source), "source needs to be defined for $target_name")
+
+  assert(defined(invoker.bundle_files) && invoker.bundle_files != [],
+         "bundle_files needs to be defined for $target_name")
+
+  _extension = get_path_info(invoker.source, "extension")
+  assert(_extension == "storyboard",
+         "source must have the .storyboard extension for $target_name")
+
+  bundle_data_ib_file(target_name) {
+    forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
+    forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+
+    extension = "storyboardc"
+  }
+}
+
+# Compile a strings file and add it to a bundle_data so that it is available
+# at runtime in the bundle.
+#
+# Arguments
+#
+#   source:
+#       string, path of the strings file to compile.
+#
+#   output:
+#       string, path of the compiled file in the final bundle.
+#
+# Forwards all variables to the bundle_data target.
+template("bundle_data_strings") {
+  assert(defined(invoker.source), "source needs to be defined for $target_name")
+  assert(defined(invoker.output), "output needs to be defined for $target_name")
+
+  _source_extension = get_path_info(invoker.source, "extension")
+  assert(_source_extension == "strings",
+         "source must be a .strings for $target_name")
+
+  _target_name = target_name
+  _convert_target = target_name + "_compile_strings"
+
+  convert_plist(_convert_target) {
+    visibility = [ ":$_target_name" ]
+    source = invoker.source
+    output =
+        "$target_gen_dir/$_target_name/" + get_path_info(invoker.source, "file")
+    format = "binary1"
+  }
+
+  bundle_data(_target_name) {
+    forward_variables_from(invoker,
+                           "*",
+                           [
+                             "source",
+                             "output",
+                           ])
+
+    if (!defined(public_deps)) {
+      public_deps = []
+    }
+    public_deps += [ ":$_convert_target" ]
+
+    sources = get_target_outputs(":$_convert_target")
+
+    outputs = [ invoker.output ]
+  }
+}
+
+# This template declares a bundle_data target that reference an assets
+# catalog so that is is compiled to the asset catalog of the generated
+# bundle.
+#
+# The target will ensure that only the files explicitly listed will be
+# compiled into the final application (i.e. it allow listing some of
+# the assets catalog content conditionally).
+#
+# The target requires that the files are located in a .xcassets bundle
+# in the repository (or generated via a script). This ensures that the
+# assets catalog is correctly visible in Xcode (though as usual, using
+# Xcode to make change to the .xcassets bundle will not be reflected in
+# the final build unless the target is updated in the gn configuration).
+#
+# Arguments
+#
+#     sources:
+#       required, list of strings, path to the files contained in the
+#       .xcassets bundle; this may contains a sub-set of the files on
+#       disk if some assets are only compiled conditionally
+#
+#     catalog:
+#       required, string, path to the .xcassets bundle; all path in
+#       sources must be relative to this path or the compilation will
+#       fail
+#
+# Example
+#
+#     bundle_data_xcassets("assets") {
+#       catalog = "Assets.xcassets"
+#       sources = [
+#         "Assets.xcassets/Color.colorset/Contents.json",
+#         "Assets.xcassets/Contents.json",
+#       ]
+#       if (includes_images) {
+#         sources += [
+#           "Assets.xcassets/Image.imageset/Contents.json",
+#           "Assets.xcassets/Image.imageset/Image.svg",
+#         ]
+#       }
+#     }
+template("bundle_data_xcassets") {
+  assert(defined(invoker.sources), "sources must be defined for $target_name")
+  assert(defined(invoker.catalog), "catalog must be defined for $target_name")
+
+  _target_name = target_name
+  _target_zip = target_name + "_zip"
+
+  zip(_target_zip) {
+    _catalog_name = get_path_info(invoker.catalog, "file")
+    _catalog_path = get_path_info(invoker.catalog, "dir")
+
+    inputs = invoker.sources
+    output = "$target_out_dir/$target_name/$_catalog_name"
+    base_dir = _catalog_path
+  }
+
+  bundle_data(_target_name) {
+    forward_variables_from(invoker,
+                           "*",
+                           [
+                             "sources",
+                             "deps",
+                             "public_deps",
+                           ])
+
+    public_deps = [ ":$_target_zip" ]
+    sources = get_target_outputs(":$_target_zip")
+    outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
+  }
+}
+
 # Template to package a shared library into an iOS framework bundle.
 #
 # By default, the bundle target this template generates does not link the
@@ -937,7 +1528,7 @@
     }
   }
 
-  ios_create_signed_bundle(_target_name + "_signed_bundle") {
+  create_signed_bundle(_target_name + "_signed_bundle") {
     forward_variables_from(invoker,
                            [
                              "bundle_deps",
@@ -1061,8 +1652,8 @@
   assert(defined(invoker.deps), "deps must be defined for $target_name")
   assert(defined(invoker.product_type),
          "product_type must be defined for $target_name")
-  assert(invoker.product_type == apple_mobile_xcode_xctest_bundle_id ||
-             invoker.product_type == apple_mobile_xcode_xcuitest_bundle_id,
+  assert(invoker.product_type == _ios_xcode_xctest_bundle_id ||
+             invoker.product_type == _ios_xcode_xcuitest_bundle_id,
          "product_type defined for $target_name is invalid.")
   assert(defined(invoker.host_target),
          "host_target must be defined for $target_name")
@@ -1145,7 +1736,7 @@
   }
 
   _xctest_bundle = _target_name + "_bundle"
-  ios_create_signed_bundle(_target_name) {
+  create_signed_bundle(_target_name) {
     forward_variables_from(invoker,
                            [
                              "bundle_deps",
@@ -1177,13 +1768,13 @@
 
       # For XCUITest, Xcode requires specifying the host application name
       # via the TEST_TARGET_NAME attribute.
-      if (invoker.product_type == apple_mobile_xcode_xcuitest_bundle_id) {
+      if (invoker.product_type == _ios_xcode_xcuitest_bundle_id) {
         TEST_TARGET_NAME = invoker.xcode_test_application_name
       }
 
       # For XCTest, Xcode requires specifying the host application path via
       # both BUNDLE_LOADER and TEST_HOST attributes.
-      if (invoker.product_type == apple_mobile_xcode_xctest_bundle_id) {
+      if (invoker.product_type == _ios_xcode_xctest_bundle_id) {
         _xcode_app_name = invoker.xcode_test_application_name
         if (defined(invoker.xcode_test_application_output_name)) {
           _xcode_app_name = invoker.xcode_test_application_output_name
@@ -1248,7 +1839,7 @@
   ios_xctest_bundle(_xctest_target) {
     forward_variables_from(invoker, [ "data_deps" ])
     output_name = _xctest_output
-    product_type = apple_mobile_xcode_xctest_bundle_id
+    product_type = _ios_xcode_xctest_bundle_id
     host_target = _host_target
 
     # TODO(crbug.com/40120290) The change in output name results in a mismatch
@@ -1408,13 +1999,13 @@
   }
 
   _xctest_bundle = invoker.xctest_bundle
-  ios_create_signed_bundle(_target_name) {
+  create_signed_bundle(_target_name) {
     testonly = true
 
     bundle_binary_target = "//build/config/ios:xctest_runner_without_arm64e"
     bundle_binary_output = "XCTRunner"
     bundle_extension = ".app"
-    product_type = apple_mobile_xcode_app_bundle_id
+    product_type = _ios_xcode_app_bundle_id
 
     output_name = _output_name
 
@@ -1506,7 +2097,7 @@
                              "xctest_bundle_principal_class",
                            ])
 
-    product_type = apple_mobile_xcode_xcuitest_bundle_id
+    product_type = _ios_xcode_xcuitest_bundle_id
     host_target = _xcuitest_runner_target
     output_name = _xcuitest_module_output