Skip to content

bazel fetch does not fetch all deps #13847

@devjgm

Description

@devjgm

Description of the problem / feature request:

bazel fetch ... does not fetch all the deps needed to build ... with --nofetch. In order for bazel build --nofetch ... to work, I must explicitly list a number of rules that appear to be implementation details about bazel, like bazel fetch ... @local_config_platform//... @local_config_sh//... @local_config_cc_toolchains//... @rules_java//...

Feature requests: what underlying problem are you trying to solve with this feature?

bazel fetch ... should fetch everything necessary to run bazel build --nofetch ...

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Here's a simple repro:

$ ls -l
total 8
-rw-r----- 1 jgm primarygroup 54 Aug 13 14:37 BUILD
-rw-r----- 1 jgm primarygroup 14 Aug 13 14:36 test.cc
-rw-r----- 1 jgm primarygroup  0 Aug 13 14:36 WORKSPACE
$ cat -n BUILD
     1  cc_binary(
     2      name="test",
     3      srcs = [ "test.cc" ])
$ cat -n test.cc
     1  int main() {}
$ bazel fetch ...
Starting local Bazel server and connecting to it...
INFO: All external dependencies fetched successfully.
Loading: 8 packages loaded
$ bazel build --nofetch ...
ERROR: While resolving toolchains for target //:test: com.google.devtools.build.lib.packages.RepositoryFetchException: no such package '@local_config_platform//': to fix, run
        bazel fetch //...
External repository @local_config_platform not found and fetching repositories is disabled.
ERROR: Analysis of target '//:test' failed; build aborted: com.google.devtools.build.lib.packages.RepositoryFetchException: no such package '@local_config_platform//': to fix, run
        bazel fetch //...
External repository @local_config_platform not found and fetching repositories is disabled.
INFO: Elapsed time: 0.276s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 1 target configured)

What operating system are you running Bazel on?

Debian GNU/Linux rodete

What's the output of bazel info release?

release 4.1.0

If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.

NA

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

NA

Have you found anything relevant by searching the web?

Nope

Any other information, logs, or outputs that you want to share?

Nope

Metadata

Metadata

Assignees

Labels

P2We'll consider working on this in future. (Assignee optional)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.type: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions