Skip to content

Commit

Permalink
Fixing dependencies of //external package
Browse files Browse the repository at this point in the history
We need to query `kind('source file', deps(//external:*))` for sparse checkout, but were block by two issues:

* `//external:remotejdk11_linux` depends on `tools/jdk/jdk.BUILD`, but it was not exported. Although this is not a problem for build, queries like `kind('source file', deps(//external:remotejdk11_linux))` would fail.
* `//external:android_sdk_for_testing` is an alias for `//:dummy`, which is not available in other repositories. This also caused bazelbuild#8175.

This pull request fixed both, including bazelbuild#8175.

Closes bazelbuild#15134.

PiperOrigin-RevId: 438605051
  • Loading branch information
linzhp authored and copybara-github committed Mar 31, 2022
1 parent 299022c commit dbb6e99
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ bind(

bind(
name = "android_sdk_for_testing",
actual = "//:dummy",
actual = "@bazel_tools//tools/android:empty",
)

bind(
name = "android_ndk_for_testing",
actual = "//:dummy",
actual = "@bazel_tools//tools/android:empty",
)

bind(
Expand Down
5 changes: 5 additions & 0 deletions src/test/py/bazel/query_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ def testSimpleQuery(self):
self._AssertQueryOutput('deps(//foo:top-rule, 1)', '//foo:top-rule',
'//foo:dep-rule')

def testQueryFilesUsedByRepositoryRules(self):
self.ScratchFile('WORKSPACE')
self._AssertQueryOutputContains("kind('source file', deps(//external:*))",
'@bazel_tools//tools/jdk:jdk.BUILD')

def testBuildFilesForExternalRepos_Simple(self):
self.ScratchFile('WORKSPACE', [
'load("//:deps.bzl", "repos")',
Expand Down
2 changes: 1 addition & 1 deletion tools/android/BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ alias(
)

# This is the default value of databinding_annotation_processor if the user does
# not provide one.
# not provide one. Also used by the bind rules in android.WORKSPACE.
filegroup(name = "empty")

alias(
Expand Down
5 changes: 4 additions & 1 deletion tools/jdk/BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ alias(
}),
)

exports_files(["BUILD.java_tools"])
exports_files([
"BUILD.java_tools",
"jdk.BUILD",
])

alias(
name = "genclass",
Expand Down

0 comments on commit dbb6e99

Please sign in to comment.