bazelbuild / bazelbuild/bazel

bazel run do not clean/regenerate runfiles

Open
#14,414 1 comment 3 reactions 0 assignees View on GitHub
help wanted P4 team-Documentation team-OSS type: documentation (cleanup)
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description of the problem / feature request:

When a binary run by `bazel run` generates files in its working directory (i.e. its `runfiles`), they stay for the next run.

I would like them to be cleaned at each `bazel run` invocation. Right now I need to `bazel clean` before. A flag, such as `bazel run --clean_runfiles` is another option.

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

If target `//:foo` looks like this pseudo code:

```shell
if fileExists "a"
then echo "Exists"
else echo "Does not exist"

createFile "a"
```

The following:

```bazel clean; bazel run //:foo; bazel run //:foo` will print "Do not exists" followed by "Exists".

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

Linux

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

```release 4.1.0- (@non-git)```

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

NixOS

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

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

Contributor guide

Open the contributing guide

Research direction

Start at the bazel run entry point and reproduce the issue with the supplied //:foo sequence on Linux. Determine how runfiles are prepared between invocations; done means generated files are cleaned or regenerated on each run, or an explicitly documented cleaning option provides that behavior.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, cli
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.