Optionally create an instance of xcode_config using the autogenerated host_available_xcodes for local versions and an instance of available_xcodes for remote versions.

RELNOTES: None.
PiperOrigin-RevId: 288762561
diff --git a/tools/osx/xcode_configure.bzl b/tools/osx/xcode_configure.bzl
index 31a68b6..566b513 100644
--- a/tools/osx/xcode_configure.bzl
+++ b/tools/osx/xcode_configure.bzl
@@ -235,6 +235,11 @@
     if default_xcode_target:
         buildcontents += "\n  default = ':%s'," % default_xcode_target
     buildcontents += "\n)\n"
+    if repository_ctx.attr.remote_xcode:
+        buildcontents += "xcode_config(name = 'all_xcodes',"
+        buildcontents += "\n  remote_versions = '%s', " % repository_ctx.attr.remote_xcode
+        buildcontents += "\n  local_versions = ':host_available_xcodes', "
+        buildcontents += "\n)\n"
     return buildcontents
 
 def _impl(repository_ctx):
@@ -262,12 +267,14 @@
     local = True,
     attrs = {
         "xcode_locator": attr.string(),
+        "remote_xcode": attr.string(),
     },
 )
 
-def xcode_configure(xcode_locator_label):
+def xcode_configure(xcode_locator_label, remote_xcode_label = None):
     """Generates a repository containing host xcode version information."""
     xcode_autoconf(
         name = "local_config_xcode",
         xcode_locator = xcode_locator_label,
+        remote_xcode = remote_xcode_label,
     )