bazelbuild / bazelbuild/bazel

Flag to forcifully re-fetch bzlmod registry files

Open
#20,477 14 comments 1 reaction 0 assignees View on GitHub
area-Bzlmod P3 team-ExternalDeps type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

I want to request a flag to forcifully fetch bzlmod registry files instead of relying on a local cache.

### Which category does this issue belong to?

Configurability, External Dependency

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

For example, suppose you have the following set up (see
[test.tar.gz](https://github.com/bazelbuild/bazel/files/13619870/test.tar.gz) )

```
# MODULE.bazel
bazel_dep(name = "mymod", version = "0.0.1")
```

and a local registry that vendors `@@mymod`:

```
# reg/modules/mymod/0.0.1/source.json
{
"type": "local_path",
"path": "mymod"
}
```

One may load files from `@@mymod` to let Bazel fetch the above `source.json`. However, after that, Bazel keeps this file in cache somewhere. So if I modify `source.json` locally, I cannot tell Bazel to forcifully fetch this `source.json` file again.

This is particularly important if I am relocating the source for a module.

I tried `bazel clean --expunge`, `rm -rf ~/.cache/bazel`, etc.; but none of them prevents Bazel from consulting this cache.

I request a flag to disable the underlying download cache.

Currently, the only workaround is to move the registry to somewhere else, then specify a different `--registry` flag to point to the new registry.

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

Linux

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

release 7.0.0-pre.20231011.2

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

N/A

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

```text
N/A
```

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

No

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

N/A

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior with the attached test.tar.gz, MODULE.bazel, and the local registry's source.json, then trace the bzlmod registry fetch and cache handling used by the --registry workflow. Done means a flag can force registry files such as source.json to be fetched again after local edits, including when relocating a module source.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.