Skip to content

Commit aa8f070

Browse files
pswaminathancopybara-github
authored andcommitted
Merge #408 by pswaminathan: Use ctx.getenv to establish dependency on SDK home envvar
Per https://bazel.build/rules/lib/builtins/repository_os.html#environ: > NOTE: Retrieving an environment variable from this dictionary does not establish a dependency from a repository rule or module extension to the environment variable. To establish a dependency when looking up an environment variable, use either repository_ctx.getenv or module_ctx.getenv instead. Analogous to bazelbuild/rules_android_ndk#102 Closes #408 COPYBARA_INTEGRATE_REVIEW=#408 from pswaminathan:p/stacked/ctx-getenv-sdk-home 13955c8 PiperOrigin-RevId: 796445190 Change-Id: If87352526742ef1edbcf8dc5c53b3532ff04d239
1 parent b344711 commit aa8f070

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

rules/android_sdk_repository/rule.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def _android_sdk_repository_impl(repo_ctx):
9494
# Determine the SDK path to use, either from the attribute or the environment.
9595
android_sdk_path = repo_ctx.attr.path
9696
if not android_sdk_path:
97-
android_sdk_path = repo_ctx.os.environ.get("ANDROID_HOME")
97+
android_sdk_path = repo_ctx.getenv("ANDROID_HOME")
9898
if not android_sdk_path:
9999
# Create an empty repository that allows non-Android code to build.
100100
repo_ctx.template("BUILD.bazel", _EMPTY_SDK_REPO_TEMPLATE)

0 commit comments

Comments
 (0)