-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Declare an empty repository with empty toolchains and an error message when the path to the NDK was missing.
- Loading branch information
Showing
2 changed files
with
62 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
This module adds no-op repository rules when the Android NDK is not installed. | ||
""" | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load("//:target_systems.bzl", "CPU_CONSTRAINT", "TARGET_SYSTEM_NAMES") | ||
|
||
# android_ndk_repository was used without a valid Android NDK being set. | ||
# Either the path attribute of android_ndk_repository or the ANDROID_NDK_HOME | ||
# environment variable must be set. | ||
# This is a minimal BUILD file to allow non-Android builds to continue. | ||
|
||
filegroup( | ||
name = "files", | ||
srcs = [":error_message"], | ||
) | ||
|
||
filegroup( | ||
name = "sdk", | ||
srcs = [":error_message"], | ||
) | ||
|
||
# Loop over TARGET_SYSTEM_NAMES and define all empty toolchain targets. | ||
[toolchain( | ||
name = "toolchain_%s" % target_system_name, | ||
toolchain = ":error_message", | ||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", | ||
target_compatible_with = [ | ||
"@platforms//os:android", | ||
CPU_CONSTRAINT[target_system_name], | ||
], | ||
) for target_system_name in TARGET_SYSTEM_NAMES] | ||
|
||
genrule( | ||
name = "invalid_android_ndk_repository_error", | ||
outs = [ | ||
"error_message", | ||
], | ||
cmd = """echo \ | ||
android_ndk_repository was used without a valid Android NDK being set. \ | ||
Either the path attribute of android_ndk_repository or the ANDROID_NDK_HOME \ | ||
environment variable must be set. ; \ | ||
exit 1 """, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters