rust-lang / rust-lang/cargo

Support the ability to re-run build scripts if and only if the crate is being compiled for other reasons

Open
#8,084 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-build-scripts C-feature-request S-needs-design
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Describe the problem you are trying to solve

We embed a bit of build-time metadata (e.g. git commit hash, wall-clock build time) inside our binaries. We specifically only would like to change this metadata on re-build, we don't want to force a rebuild because the metadata has changed. For example, checking out a commit that has only changed external documentation shouldn't retrigger a build, none of the source has changed. Also, when running tests, modifying the tests shouldn't necessarily retrigger a build of the library that the tests are running against.

Describe the solution you'd like
Perhaps a cargo:rerun-on-compile=true build.rs directive?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Cargo's build-script rerun behavior and the proposed cargo:rerun-on-compile=true directive. Compare how rebuild decisions should behave when only external documentation or tests change. Done means the directive's semantics and affected build cases are specified clearly enough to guide implementation and validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, tooling
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.