aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar jingwen <jingwen@google.com>2018-01-23 08:53:11 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-23 08:55:06 -0800
commit96a9a2baa31da9d11e3cdaf152241991ae832f35 (patch)
treee7acad49d63ef2b83e2846a077344ba75cec458d /tools
parentd452163286e9e4936ed9e5a83ef2f009a3535df4 (diff)
Pass the correct path of aapt_binary and merge its data runfiles into android_instrumentation_test's runfiles.
GITHUB: #903 RELNOTES: None. PiperOrigin-RevId: 182940009
Diffstat (limited to 'tools')
-rw-r--r--tools/android/android_sdk_repository_template.bzl7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/android/android_sdk_repository_template.bzl b/tools/android/android_sdk_repository_template.bzl
index 637bbf2978..2d847fe133 100644
--- a/tools/android/android_sdk_repository_template.bzl
+++ b/tools/android/android_sdk_repository_template.bzl
@@ -168,6 +168,13 @@ def create_android_sdk_rules(
# there's no runfiles support so Bazel just creates a junction to
# {SDK}/build-tools.
"SDK=$${0}.runfiles/%s" % name,
+ # If $${SDK} is not a directory, it means that this tool is running
+ # from a runfiles directory, in the case of
+ # android_instrumentation_test. Hence, use the androidsdk
+ # that's already present in the runfiles of the current context.
+ "if [[ ! -d $${SDK} ]] ; then",
+ " SDK=$$(pwd)/../%s" % name,
+ "fi",
"exec $${SDK}/build-tools/%s/%s $$*" % (build_tools_directory, tool),
"EOF\n"]),
)