Clean up how android repos end in the distfile
Currently, the android_sdk_repository and android_ndk_repository in the WORKSPACE are commented out by default, but the CI workers uncomment them before starting execution. Currently this isn't a problem. However, once https://github.com/bazelbuild/bazel/pull/11737 is submitted, bazel_boostrap_distfile_test and bazel_determinism_test will begin to fail, because the uncommented android_sdk_repository will execute, then fail because either ANDROID_HOME is not set or points to an invalid directory.
Since the bootstrap process should never execute Android rules, I decided it would be clearer to remove the possibility entirely by removing the repo declarations from the WORKSPACE.
The cleanups to the tools/android are more for clarity, to ensure they match the actual @bazel_tools used by built bazel. In an ideal world we'd remove much more code from the distfile and this wouldn't be present at all.
Three changes:
1. Use tools/android/BUILD.tools instead of tools/android/BUILD in the distfile.
2. Re-comment android_sdk_repository and android_ndk_repository (they aren't needed for bootstrapping).
3. Fix srcs_test to handle the case where part of the distfile is generated by a genrule.
Closes #11744.
PiperOrigin-RevId: 322143408
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index de9a56f..750ff07 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -295,6 +295,11 @@
mkdir -p ${BAZEL_TOOLS_REPO}/tools/python
link_file "${PWD}/tools/python/BUILD.tools" "${BAZEL_TOOLS_REPO}/tools/python/BUILD"
+ # Create @bazel_tools/tools/android/BUILD
+ mkdir -p ${BAZEL_TOOLS_REPO}/tools/android
+ link_file "${PWD}/tools/android/BUILD.tools" "${BAZEL_TOOLS_REPO}/tools/android/BUILD"
+ link_children "${PWD}" tools/android "${BAZEL_TOOLS_REPO}"
+
# Create the rest of @bazel_tools//tools/...
link_children "${PWD}" tools/cpp "${BAZEL_TOOLS_REPO}"
mv -f ${BAZEL_TOOLS_REPO}/tools/cpp/BUILD.tools ${BAZEL_TOOLS_REPO}/tools/cpp/BUILD