Add the beginnings of an Apple vendor constraint check to nudge users of objc_library in the right direction if a compatible Apple platform is not set.

PiperOrigin-RevId: 951639266
Change-Id: I71bdc47a6ac9bf92fe2ae33e64ac2af1c45b72b9
diff --git a/cc/private/rules_impl/objc_attrs.bzl b/cc/private/rules_impl/objc_attrs.bzl
index 282484f..0f44fb9 100644
--- a/cc/private/rules_impl/objc_attrs.bzl
+++ b/cc/private/rules_impl/objc_attrs.bzl
@@ -258,6 +258,7 @@
     union = _union,
     ALWAYSLINK_RULE = _ALWAYSLINK_RULE,
     alwayslink_initializer = _alwayslink_initializer,
+    APPLE_VENDOR = semantics.get_apple_vendor_attr(),
     COMPILING_RULE = _get_compiling_rule_attrs(),
     COMPILE_DEPENDENCY_RULE = _COMPILE_DEPENDENCY_RULE,
     COPTS_RULE = _COPTS_RULE,
diff --git a/cc/private/rules_impl/objc_library.bzl b/cc/private/rules_impl/objc_library.bzl
index a4ebbe3..e0519ac 100644
--- a/cc/private/rules_impl/objc_library.bzl
+++ b/cc/private/rules_impl/objc_library.bzl
@@ -165,6 +165,7 @@
 depend on it. Libraries specified with <code>implementation_deps</code> are still linked
 in binary targets that depend on this library."""),
         },
+        common_attrs.APPLE_VENDOR,
         common_attrs.ALWAYSLINK_RULE,
         common_attrs.COMPILING_RULE,
         common_attrs.COMPILE_DEPENDENCY_RULE,
diff --git a/cc/private/rules_impl/objc_semantics.bzl b/cc/private/rules_impl/objc_semantics.bzl
index 9f914f8..b7afb12 100644
--- a/cc/private/rules_impl/objc_semantics.bzl
+++ b/cc/private/rules_impl/objc_semantics.bzl
@@ -36,6 +36,10 @@
         fail("Compiling objc_library targets requires the Apple CC toolchain " +
              "which can be found here: https://github.com/bazelbuild/apple_support#toolchain-setup")
 
+def _get_apple_vendor_attr():
+    # TODO(b/528985527): Change to the apple vendor platform constraint if safe.
+    return {}
+
 def _get_licenses_attr():
     # TODO(b/182226065): Change to applicable_licenses
     return {}
@@ -45,6 +49,7 @@
 
 semantics = struct(
     check_toolchain_supports_objc_compile = _check_toolchain_supports_objc_compile,
+    get_apple_vendor_attr = _get_apple_vendor_attr,
     get_repo = _get_repo,
     get_licenses_attr = _get_licenses_attr,
     apple_crosstool_transition = None,