Skip to content

Commit

Permalink
chore: change default for run_binary#stamp
Browse files Browse the repository at this point in the history
Greg convinced me that users will get really slow stamped builds because most run_binary tools don't actually read the status files, but will be cache-invalidated.
  • Loading branch information
alexeagle committed Jul 15, 2022
1 parent 56bc408 commit 8a11a10
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/run_binary.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions lib/private/run_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def run_binary(
mnemonic = "RunBinary",
progress_message = None,
execution_requirements = None,
stamp = -1,
stamp = 0,
# TODO: remove output_dir in 2.x release
output_dir = False,
**kwargs):
Expand Down Expand Up @@ -187,13 +187,16 @@ def run_binary(
stamp: Whether to include build status files as inputs to the tool. Possible values:
- `stamp = 0` (default): Never include build status files as inputs to the tool.
This gives good build result caching.
Most tools don't use the status files, so including them in `--stamp` builds makes those
builds have many needless cache misses.
(Note: this default is different from most rules with an integer-typed `stamp` attribute.)
- `stamp = 1`: Always include build status files as inputs to the tool, even in
[--nostamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) builds.
This setting should be avoided, since it is non-deterministic.
It potentially causes remote cache misses for the target and
any downstream actions that depend on the result.
- `stamp = 0`: Never include build status files as inputs to the tool.
This gives good build result caching.
- `stamp = -1`: Inclusion of build status files as inputs is controlled by the
[--[no]stamp](https://docs.bazel.build/versions/main/user-manual.html#flag--stamp) flag.
Stamped targets are not rebuilt unless their dependencies change.
Expand Down
2 changes: 2 additions & 0 deletions lib/tests/stamping/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ run_binary(
name = "run_stamper",
outs = ["stamped"],
args = ["$(location stamped)"],
# Include status files as inputs when --stamp is set.
stamp = -1,
tool = "stamper",
)

0 comments on commit 8a11a10

Please sign in to comment.