Spaces:
Running
Running
File size: 774 Bytes
5f923cd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | """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"],
)
|