Skip to content

Conversation

@caspermeijn
Copy link
Contributor

@caspermeijn caspermeijn commented Aug 30, 2024

Inform cargo about the files and env vars used by prost-build. Then cargo can better determine when to rebuild a project.

  • Emit rerun-if-changed for each proto file specified
  • Emit rerun-if-changed for each include directory specified
  • Emit rerun-if-changed if file_descriptor_set_path is set
  • Emit rerun-if-env-changed for PROTOC and PROTOC_INCLUDE

https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed

BREAKING CHANGE: Previously cargo assumed it had to rerun build.rs if any files in the project changed. prost-build will now emit rerun commands, which means only the explicitly marked files cause a rerun. If your build.rs is dependent on any other file paths than those given to prost-build, then your build.rs needs to emit rerun commands as well.

Inform `cargo` about the files and env vars used by `prost-build`. Then `cargo` can better determine when to rebuild a project.

- Emit `rerun-if-changed` for each proto file specified
- Emit `rerun-if-changed` for each include directory specified
- Emit `rerun-if-changed` if `file_descriptor_set_path` is set
- Emit `rerun-if-env-changed` for `PROTOC` and `PROTOC_INCLUDE`

https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed

BREAKING CHANGE: Previously `cargo` assumed it had to rerun `build.rs` if any files in the project changed. `prost-build` will now emit `rerun` commands, which means only the explicitly marked files cause a rerun. If your `build.rs` is dependent on any other file paths than those given to `prost-build`, then your `build.rs` needs to emit `rerun` commands as well.
@armandas
Copy link

Would really appreciate this feature!

@caspermeijn caspermeijn added this pull request to the merge queue Feb 12, 2025
Merged via the queue into tokio-rs:master with commit 7c16959 Feb 12, 2025
16 checks passed
@caspermeijn caspermeijn deleted the rerun_if_changed branch February 12, 2025 07:11
caspermeijn added a commit to caspermeijn/prost that referenced this pull request Jun 17, 2025
This reverts commit 7c16959.

In version 0.14.0, `prost-build` began emitting `rerun` commands. This change introduced regressions for some users—for example, those generating `protos` from an `includes` directory. These edge cases are non-trivial to address comprehensively, so version 0.14.1 reverts the emission of `rerun` commands.
For more details, see issue tokio-rs#1296.
github-merge-queue bot pushed a commit that referenced this pull request Jun 17, 2025
This reverts commit 7c16959.

In version 0.14.0, `prost-build` began emitting `rerun` commands. This change introduced regressions for some users—for example, those generating `protos` from an `includes` directory. These edge cases are non-trivial to address comprehensively, so version 0.14.1 reverts the emission of `rerun` commands.
For more details, see issue #1296.
ianoc pushed a commit to ianoc/prost that referenced this pull request Oct 22, 2025
…kio-rs#1297)

This reverts commit 7c16959.

In version 0.14.0, `prost-build` began emitting `rerun` commands. This change introduced regressions for some users—for example, those generating `protos` from an `includes` directory. These edge cases are non-trivial to address comprehensively, so version 0.14.1 reverts the emission of `rerun` commands.
For more details, see issue tokio-rs#1296.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants