bazel query deps in bazel 1.2.1 on targets that use android trigger the following error: 
ERROR: /usr/local/google/home/bmzhao/.cache/bazel/_bazel_bmzhao/5dcb290106c1a06f5bc5c8d08ceb177f/external/bazel_tools/tools/android/BUILD:39:1: no such target '//external:android/d8_jar_import': target 'android/d8_jar_import' not declared in package 'external' (did you mean 'android/dx_jar_import'?) defined by /usr/local/google/home/bmzhao/Code/tensorflow/WORKSPACE and referenced by '@bazel_tools//tools/android:d8_dexbuilder'
This error is caused by this line: https://github.com/bazelbuild/bazel/blame/master/tools/android/BUILD.tools#L44
This also breaks Tensorflow's CI, since we run 'bazel query "deps((//tensorflow/...))"`, and its picking up this internal bazel dep that errors out.
We are migrating Tensorflow to bazel 1.2.1. This is part of the work for tensorflow's build refactoring (https://github.com/tensorflow/community/pull/179), which uses bazel's new cc_shared_library.
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git checkout 1d41edaee62e27c8c1552b83fcb46dd45e5a64d4 # known-clean-commit
echo '1.2.1\n' > .bazelversion
bazelisk query "deps((//tensorflow/... - kind('android_*', //tensorflow/...)))"
Linux
bazel info release?release 1.2.1
Looks like this is introduced by https://github.com/bazelbuild/bazel/commit/8d866f3259957b5cdda5d29c57fd8bdc3df85d8f
/cc @gyias @jin 
I can reproduce this. The current workaround is to use --keep_going with query, or use cquery. 
@gyias has a fix for this. We'll probably want to cherry pick this into 1.2.2 and 2.1.
I guess we need to cherry pick it into 1.2.2 and 2.0.1? 2.1 is not cut yet, but should include the fix.
/cc @laurentlb @aehlig 
I can cherry-pick it in 2.1 (was cut yesterday).
1.2.1 was released in November. We usually don't do cherry-picks for older versions.
The fix commit has been merged - 733ac0ff7ad1e13ab68ceb2fde694d7ab71b2366
@laurentlb Please cherry-pick 733ac0f for 2.1
@aehlig We probably also want to do a patch release for 2.0.
@bmzhao What do you think of migrating TF to 2.0.1 once we have the patch release?
@meteorcloudy I'm currently working on getting TF building with bazel 2.0, as part of the the cc_shared_library work! I'm still looking into on a few build failures, but once that's landed, it should make it easy to integrate with the bazel 2.0.1 patch release.
Awesome, thanks!
Most helpful comment
@gyias has a fix for this. We'll probably want to cherry pick this into 1.2.2 and 2.1.