Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rules_android_ndk patch so that missing Android NDK can be handled gracefully #1182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/bazel/rules_android_ndk.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
--- rules.bzl
+++ rules.bzl
@@ -25,8 +25,10 @@
@@ -23,13 +23,14 @@ def _android_ndk_repository_impl(ctx):
Returns:
A final dict of configuration attributes and values.
"""
ndk_path = ctx.attr.path or ctx.os.environ.get("ANDROID_NDK_HOME", None)
if not ndk_path:
- ndk_path = ctx.attr.path or ctx.os.environ.get("ANDROID_NDK_HOME", None)
- if not ndk_path:
- fail("Either the ANDROID_NDK_HOME environment variable or the " +
- "path attribute of android_ndk_repository must be set.")
+ print("Either the ANDROID_NDK_HOME environment variable or the " +
+ "path attribute of android_ndk_repository must be set.")
+ ctx.file("BUILD.bazel", "")
+ return
+ ndk_path = ctx.attr.path or ctx.os.environ.get("ANDROID_NDK_HOME", "")
if ndk_path.startswith("$WORKSPACE_ROOT"):
ndk_path = str(ctx.workspace_root) + ndk_path.removeprefix("$WORKSPACE_ROOT")


+ if not ctx.path(ndk_path).exists:
+ ctx.file("BUILD.bazel", "")
+ return
+
is_windows = False
executable_extension = ""
if ctx.os.name == "linux":