"""Bazel macros for building MDC component libraries."""

load("@bazel_ios_warnings//:strict_warnings_objc_library.bzl", "strict_warnings_objc_library")
load("@build_bazel_rules_apple//apple/testing/default_runner:ios_test_runner.bzl", "ios_test_runner")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test_suite")

DEFAULT_IOS_RUNNER_TARGETS = [
    "//components/testing/runners:IPHONE_5_IN_8_1",
    "//components/testing/runners:IPAD_PRO_12_9_IN_9_3",
    "//components/testing/runners:IPHONE_7_PLUS_IN_10_3",
    "//components/testing/runners:IPHONE_X_IN_11_0",
]

def mdc_objc_library(
    name,
    copts = [],
    **kwargs):
  """Declare an Objective-C library with strict_warnings_objc_library."""
  strict_warnings_objc_library(
      name = name,
      copts = copts,
      **kwargs)

def mdc_public_objc_library(
    name,
    deps = [],
    extra_srcs = [],
    sdk_frameworks = [],
    visibility = ["//visibility:public"],
    **kwargs):
  """Declare a public MDC component as a Objective-C library according to MDC's conventions.

  The conventions for an MDC component are:
  - The public implementation lives inside of src.
  - The private implementation lives inside of src/private.

  The default visibility of "//visibility:public" can be overridden, for
  example, "//some/package:__subpackages__".

  Args:
    name: The name of the library.
    deps: The dependencies of the library.
    extra_srcs: Extra sources to add to the standard ones.
    sdk_frameworks: The SDK frameworks needed, e.g. "CoreGraphics".
    visibility: The visibility of the package.
    **kwargs: Any arguments accepted by _mdc_objc_library().
  """
  mdc_objc_library(
      name = name,
      deps = deps,
      sdk_frameworks = sdk_frameworks,
      visibility = visibility,
      srcs = native.glob(["src/*.m", "src/private/*.h", "src/private/*.m"]) + extra_srcs,
      hdrs = native.glob(["src/*.h"]),
      includes = ["src"],
      enable_modules = 1,
      **kwargs)

def mdc_theming_objc_library(
    name = "Theming",
    deps = [],
    sdk_frameworks = [],
    **kwargs):
  """Declare a public MDC component Theming extension

  Args:
    name: The name of the library.
    deps: The dependencies of the library.
    sdk_frameworks: The SDK Frameworks needed (e.g., "CoreGraphics").
    **kwargs: Any arguments accepted by _mdc_objc_library().
  """
  mdc_objc_library(
    name = name,
    deps = deps,
    sdk_frameworks = sdk_frameworks,
    visibility = ["//visibility:public"],
    srcs = native.glob(["src/Theming/*.m"]),
    hdrs = native.glob(["src/Theming/*.h"]),
    includes = ["src/Theming"],
    enable_modules = 1,
    **kwargs)

def mdc_unit_test_suite(
    name = "unit_tests",
    deps = [],
    minimum_os_version = "8.0",
    visibility = ["//visibility:private"],
    size = "medium",
    **kwargs):
  """Declare a MDC unit_test_suite using the ios_runners matrix."""
  ios_unit_test_suite(
    name = name,
    deps = deps,
    minimum_os_version = minimum_os_version,
    runners = DEFAULT_IOS_RUNNER_TARGETS,
    visibility = visibility,
    size = size,
    **kwargs
  )

@@ -1983,687 +1983,8 @@
 s)%0A%0A
-def mdc_theming_objc_library(%0A    name = %22Theming%22,%0A    deps = %5B%5D,%0A    sdk_frameworks = %5B%5D,%0A    **kwargs):%0A  %22%22%22Declare a public MDC component Theming extension%0A%0A  Args:%0A    name: The name of the library.%0A    deps: The dependencies of the library.%0A    sdk_frameworks: The SDK Frameworks needed (e.g., %22CoreGraphics%22).%0A    **kwargs: Any arguments accepted by _mdc_objc_library().%0A  %22%22%22%0A  mdc_objc_library(%0A    name = name,%0A    deps = deps,%0A    sdk_frameworks = sdk_frameworks,%0A    visibility = %5B%22//visibility:public%22%5D,%0A    srcs = native.glob(%5B%22src/Theming/*.m%22%5D),%0A    hdrs = native.glob(%5B%22src/Theming/*.h%22%5D),%0A    includes = %5B%22src/Theming%22%5D,%0A    enable_modules = 1,%0A    **kwargs)%0A%0A
 def 

Revert "[bazel] Create `mdc_theming_objc_library` rule (#6074)" (#6076)