`apple_crosstool_transition`: don't trigger if `--platforms` already matches the desired Apple platform.

Copies similar logic on `--cpu` + `--crosstool_top`.

Part of an effort to remove reliance on pre-platform flags like `--cpu` and `--crosstool_top`.

### Context:

Fixes a bug when `--incompatible_disable_objc_library_transition` is unset:

The Apple C++ toolchain reads `--platforms`. If a `cc_binary` depends on an `objc_library`, the `objc_library` triggers `apple_crosstool_transition`. if `--platforms` is already set to an Apple C++ toolchain, this should be a no-op.

If we don't make it a no-op, it forks into a new configuration. This can make common `cc_libraries` ODR (like if the `cc_binary` depends directly on a `cc_library` and the `objc_library` also depends on that `cc_library`).

If `--incompatible_disable_objc_library_transition` is set, the no-op [already happens](https://github.com/bazelbuild/bazel/blob/32def7092155a0fcdb138cfd80c51608a7326bcb/src/main/starlark/builtins_bzl/common/objc/objc_library.bzl#L143) without this change. But that's only for `objc_library`. Other rules might also use this transition.

PiperOrigin-RevId: 626057015
Change-Id: I9b65e0a3d91a99f63a0d33a9c37304edcff8bc14
diff --git a/src/main/starlark/builtins_bzl/common/objc/transitions.bzl b/src/main/starlark/builtins_bzl/common/objc/transitions.bzl
index eda0c9c..a1a797b 100644
--- a/src/main/starlark/builtins_bzl/common/objc/transitions.bzl
+++ b/src/main/starlark/builtins_bzl/common/objc/transitions.bzl
@@ -116,7 +116,12 @@
         settings["//command_line_option:apple_crosstool_top"]
     )
     if cpu == settings["//command_line_option:cpu"] and crosstools_are_equal:
-        # No changes necessary.
+        # No changes necessary if --cpu and --crosstool_top already match
+        # --apple_platform_type.
+        return {}
+    if semantics.cpu_to_platform(cpu) == "@" + str(settings["//command_line_option:platforms"][0]):
+        # No changes necessary if --platforms already matches
+        # --apple_platform_type.
         return {}
 
     # Ensure platforms aren't set so that platform mapping can take place.