Spaces:
Running
Running
| """A workaround to check if ANDROID_NDK_HOME is set.""" | |
| def _check_android_ndk_env_impl(ctx): | |
| ndk_home = ctx.getenv("ANDROID_NDK_HOME") | |
| ndk_home_is_set = bool(ndk_home) and len(ndk_home.strip()) > 0 | |
| # .bzl file contains ANDROID_NDK_HOME_IS_SET = True if ANDROID_NDK_HOME is set. | |
| content = "# Generated by check_android_ndk_env.bzl\n" | |
| content += "ANDROID_NDK_HOME_IS_SET = " | |
| content += "True" if ndk_home_is_set else "False" | |
| content += "\n" | |
| ctx.file("current_android_ndk_env.bzl", content = content) | |
| # Dummy BUILD file to make the repository is valid. | |
| ctx.file("BUILD", content = "") | |
| check_android_ndk_env = repository_rule( | |
| implementation = _check_android_ndk_env_impl, | |
| local = True, | |
| environ = ["ANDROID_NDK_HOME"], | |
| ) | |