bazelbuild / bazelbuild/bazel

Changing starlark build setting always discards the analysis cache.

Open
#13,591 9 comments 4 reactions 0 assignees View on GitHub
P2 team-Configurability type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the problem / feature request:

Changing starlark build settings always discards the analysis cache. It would be nice to have a way of disabling that for certain build settings.

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

When using starlark build settings that are limited to certain targets, it would be nice if the analysis cache could be maintained. Similar to `--test_filter`, for certain build settings, the values of the settings might be changed often, but would only cause a small number of additional configured targets to have to be cached. That's why `--trim_test_configuration` was introduced.

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

Create a starlark build setting, change its value, observe `INFO: Build option --//tools/settings:your_setting has changed, discarding analysis cache.`

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

```
> sw_vers
ProductName: macOS
ProductVersion: 11.3.1
BuildVersion: 20E241
```

### What's the output of `bazel info release`?

```
> bazel info release
INFO: Invocation ID: 781ccd26-b559-444f-976d-678b37d89b18
release 4.1.0- (@non-git)
```

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

From https://github.com/NixOS/nixpkgs/blob/0e3229d628b3a1c56cc9279c39e6a40720794773/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix.

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

https://github.com/bazelbuild/bazel/issues/7466
https://github.com/bazelbuild/bazel/issues/6011
https://github.com/bazelbuild/bazel/issues/6842#issuecomment-451202198

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with a Starlark build setting and a changed value, observing the reported analysis-cache discard. Review the related cache behavior discussed in issues #7466, #6011, and #6842. Done means a selected build setting can change without discarding the analysis cache while affected configured targets are still handled correctly.

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
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.