From a6c3f2327df424e56674a6bd758566d2757afdc7 Mon Sep 17 00:00:00 2001 From: Zhongpeng Lin Date: Tue, 25 Jan 2022 08:46:11 -0800 Subject: [PATCH] Adding Starlark dependencies to the package //external This is an alternative approach to fix #14280. It adds transitive closure of Starlark dependencies to `//external` package when loading `WORKSPACE` file, so it can be processed in the same way as `BUILD` files during query execution. Comparing to the approach taken in #14497, this approach is less intrusive, but not able to distinguish the extension files needed by `//external:foo` and `//external:bar`, meaning `buildfiles(//external:foo)` returns the same result as `buildfiles(//external:*)`. However, this behavior is consistent with other packages. For example, `buildfiles(//foo:bar)` has the same result as `buildfiles(//foo:*)`. Closes #14630. PiperOrigin-RevId: 424092916 --- .../devtools/build/lib/packages/Package.java | 2 +- .../build/lib/packages/PackageFactory.java | 2 +- .../lib/skyframe/WorkspaceFileFunction.java | 9 ++ src/test/py/bazel/query_test.py | 89 +++++++++++++++++++ 4 files changed, 100 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/packages/Package.java b/src/main/java/com/google/devtools/build/lib/packages/Package.java index b5409285759896..598a05b59121c3 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/Package.java +++ b/src/main/java/com/google/devtools/build/lib/packages/Package.java @@ -1370,7 +1370,7 @@ FailureDetail getFailureDetail() { return null; } - Builder setStarlarkFileDependencies(ImmutableList