Skip to content

Commit b30b3ed

Browse files
authored
Fixing dependencies of //external package (#15341)
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 #8175. This pull request fixed both, including #8175. Closes #15134. PiperOrigin-RevId: 438605051
1 parent 307162d commit b30b3ed

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/main/java/com/google/devtools/build/lib/bazel/rules/android/android.WORKSPACE

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ bind(
2020

2121
bind(
2222
name = "android_sdk_for_testing",
23-
actual = "//:dummy",
23+
actual = "@bazel_tools//tools/android:empty",
2424
)
2525

2626
bind(
2727
name = "android_ndk_for_testing",
28-
actual = "//:dummy",
28+
actual = "@bazel_tools//tools/android:empty",
2929
)
3030

3131
bind(

src/test/py/bazel/query_test.py

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ def testSimpleQuery(self):
3838
self._AssertQueryOutput('deps(//foo:top-rule, 1)', '//foo:top-rule',
3939
'//foo:dep-rule')
4040

41+
def testQueryFilesUsedByRepositoryRules(self):
42+
self.ScratchFile('WORKSPACE')
43+
self._AssertQueryOutputContains("kind('source file', deps(//external:*))",
44+
'@bazel_tools//tools/jdk:jdk.BUILD')
45+
4146
def testBuildFilesForExternalRepos_Simple(self):
4247
self.ScratchFile('WORKSPACE', [
4348
'load("//:deps.bzl", "repos")',

tools/android/BUILD.tools

+1-1
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ alias(
412412
)
413413

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

418418
alias(

tools/jdk/BUILD.tools

+4-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ alias(
214214
}),
215215
)
216216

217-
exports_files(["BUILD.java_tools"])
217+
exports_files([
218+
"BUILD.java_tools",
219+
"jdk.BUILD",
220+
])
218221

219222
alias(
220223
name = "genclass",

0 commit comments

Comments
 (0)