forked from google-ai-edge/LiteRT-LM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathandroid_ndk_env.bzl
More file actions
21 lines (17 loc) · 774 Bytes
/
Copy pathandroid_ndk_env.bzl
File metadata and controls
21 lines (17 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""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"],
)