-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Bug Report
Version
- tonic-prost-build 0.14.x / 969408e
- Rust 1.89.0, Rust 1.90.0
Platform
Linux wolfgnu 6.16.8-arch3-1 #1 SMP PREEMPT_DYNAMIC Mon, 22 Sep 2025 22:08:35 +0000 x86_64 GNU/Linux
Description
When using tonic-prost-build (any version, since it didn't exist before 0.14) in a build.rs, the project is
rebuilt whenever a file in the project directory changes, even if it isn't part of the build.
Adding the file to .gitignore fixes that. target/ isn't affected even when not in .gitignore.
I narrowed this issue down to commit 969408e. Unfortunately, that's a pretty large one introducing the tonic-prost-build crate for the first time.
I managed to create a minimal example. Create a project with these files (patch):
# Cargo.toml
[package]
name = "test-prost"
version = "0.1.0"
edition = "2024"
[dependencies]
[build-dependencies]
#tonic-prost-build = { path = "../tonic/tonic-prost-build" }
#tonic-build = { git = "https://github.com/hyperium/tonic.git", rev = "761ebf5f" }
tonic-prost-build = "0.14.2"// build.rs
fn main() {
tonic_prost_build::compile_protos("src/test.proto").unwrap();
//tonic_build::compile_protos("src/test.proto").unwrap();
}// src/main.rs
fn main() {
println!("Hello, world!");
}// src/test.proto
syntax = "proto3";
message Null {}
service Test {
rpc Test(Null) returns (Null) {}
}- Run
cargo buildonce - Do nothing an run
cargo buildagain: no build happens touch foo.txtand runcargo build: project is rebuilding- Repeat 2 and 3 until sufficiently convinced
- Add
foo.txtto.gitignore - Run
cargo build: project is rebuilding because.gitignorechanged touch foo.txtand runcargo build: no build happens
The issue does not appear with tonic-build from 761ebf5, which is already using prost 0.14.
Metadata
Metadata
Assignees
Labels
No labels