bazelbuild / bazelbuild/bazel

bazel fetch should still support resolved_repositories or similar output

Open
#29,399 3 comments 0 reactions 0 assignees View on GitHub
P4 team-ExternalDeps type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the feature request:

`bazel fetch --repository_cache=somewhere some_target` can be used for offline builds scoped to target(s), but it isn't giving information about URLs or other fetch rules used to get the dependencies. Having a machine-readable file would help exposing external dependencies, and allow granular fetching&sharing of external dependencies between different repos (context: when building a Bazel package via Nix it might be nice to do following flow for external dependencies: generate repository_cache spec -> generate per-file fetch Nix derivation -> reconstruct repo_cache from Nix-fetched repo_cache files -> use reconstructed repository_cache for offline build)

`bazel fetch --experimental_repository_resolved_file` is no longer supported since Bazel 9
`bazel mod show_repo --all` isn't possible to scope to a single or several targets

### Which category does this issue belong to?

External Dependency

### What underlying problem are you trying to solve with this feature?

Getting spec of externally fetched dependencies, use it to generate repository_cache for offline builds

Note: spec probably won't easily cover all possible downloads, but even having spec for `http_*` and `git_*` dependencies would cover huge portion

### Which operating system are you running Bazel on?

_No response_

### What is the output of `bazel info release`?

_No response_

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

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

```text

```

### Have you found anything relevant by searching the web?

There's several issues or feature requests around offline builds, but haven't found a solution in those

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

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the requested bazel fetch flow and the removal of --experimental_repository_resolved_file in Bazel 9, then compare it with bazel mod show_repo --all and its target-scoping limitation. Define the machine-readable output and supported repository rules, and consider how the result would support per-file repository-cache fetching and offline builds.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.