-
Notifications
You must be signed in to change notification settings - Fork 4.4k
bazel query doesn't return the .bzl files that load external repositories #14280
Copy link
Copy link
Closed
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.team-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websiteIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: feature request
Description
Description of the problem / feature request:
bazel query doesn't return the .bzl files that load an external repository
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
- Create such Bazel workspace:
-- BUILD.bazel --
-- WORKSPACE --
load("//:http_archives.bzl", "http_archives")
http_archives()
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains(version = "1.17.1")
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()
-- http_archives.bzl --
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def http_archives():
http_archive(
name = "io_bazel_rules_go",
sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
],
)
http_archive(
name = "com_google_protobuf",
sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113",
strip_prefix = "protobuf-3.14.0",
urls = [
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
],
)
- Run
bazel query 'buildfiles(//external:io_bazel_rules_go)'in it.
The query only returns //external:WORKSPACE, while @io_bazel_rules_go is actually defined in http_archives.bzl.
What operating system are you running Bazel on?
macOS 12.0.1 and Linux 5.4.129
What's the output of bazel info release?
release 4.2.1
Any other information, logs, or outputs that you want to share?
bazel query 'loadfiles(//external:io_bazel_rules_go)'returns "Empty results".bazel query --output=xml '//external:io_bazel_rules_go'returns
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<query version="2">
<rule class="http_archive" location="/private/tmp/loadfiles/WORKSPACE:3:14" name="//external:io_bazel_rules_go">
<string name="name" value="io_bazel_rules_go"/>
<string name="generator_name" value="io_bazel_rules_go"/>
<string name="generator_function" value="http_archives"/>
<string name="generator_location"/>
<list name="urls">
<string value="https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip"/>
<string value="https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip"/>
</list>
<string name="sha256" value="2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f"/>
</rule>
</query>The generator_location is empty.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2We'll consider working on this in future. (Assignee optional)We'll consider working on this in future. (Assignee optional)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.team-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websiteIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: feature request