android_sh_test now fails to build with a clear error if there is no Android SDK
Closes
@@ -21,9 +21,20 @@ like the ResourceProcessorBusyBox and Desugar.
For more information, see //tools/android/runtime_deps.
"""
+# Check that an SDK exists, with a clearer build error when it doesn't.
+CHECK_FOR_ANDROID_SDK = select(
+ {
+ "//external:has_androidsdk": [],
+ },
+ no_match_error = "This test requires an android SDK, and one isn't present.",
+)
+
def android_sh_test(**kwargs):
name = kwargs.pop("name")
data = kwargs.pop("data")
+ if not data:
+ data = []
+ data = data + CHECK_FOR_ANDROID_SDK
# Test with released android_tools version.
native.sh_test(
