xcode_configure repository rule for determining locally installed versions of xcode to select between, relaxing the requirement that users specify --xcode_version and --ios_sdk_version even if they have only one version installed.

RELNOTES: On mac devices, detect locally installed versions of xcode to:
 1. Use a sensible default if xcode is required but --xcode_version is unspecified.
 2. Use sensible default iOS SDK version for the targeted version of xcode if ios_sdk_version is unspecified.

--
MOS_MIGRATED_REVID=131841587
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index bf1da4d..1948943 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -254,7 +254,14 @@
 cp src/main/tools/build_interface_so ${ARCHIVE_DIR}/_embedded_binaries/build_interface_so
 cp src/main/tools/jdk.BUILD ${ARCHIVE_DIR}/_embedded_binaries/jdk.BUILD
 cp $OUTPUT_DIR/libblaze.jar ${ARCHIVE_DIR}
-cp tools/osx/xcode_locator_stub.sh ${ARCHIVE_DIR}/_embedded_binaries/xcode-locator
+
+# TODO(b/28965185): Remove when xcode-locator is no longer required in embedded_binaries.
+log "Compiling xcode-locator..."
+if [[ $PLATFORM == "darwin" ]]; then
+  run /usr/bin/xcrun clang -fobjc-arc -framework CoreServices -framework Foundation -o ${ARCHIVE_DIR}/_embedded_binaries/xcode-locator tools/osx/xcode_locator.m
+else
+  cp tools/osx/xcode_locator_stub.sh ${ARCHIVE_DIR}/_embedded_binaries/xcode-locator
+fi
 
 # bazel build using bootstrap version
 function bootstrap_build() {