Skip to content

Commit e79f695

Browse files
committed
fix(build): skip rerun-if-changed for .files() in Buf mode
In Buf mode, `.files()` holds proto-relative names (e.g. "my/service.proto"), not filesystem paths. Emitting `cargo:rerun-if-changed` for these points cargo at non-existent files, forcing a rebuild on every invocation. This is the same issue that was fixed for Precompiled mode in #56, but Buf mode was missed in that fix.
1 parent a2f86ba commit e79f695

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎connectrpc-build/src/lib.rs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,12 @@ impl Config {
311311
DescriptorSource::Precompiled(p) => {
312312
println!("cargo:rerun-if-changed={}", p.display());
313313
}
314-
DescriptorSource::Protoc | DescriptorSource::Buf => {
314+
// Both Buf and Precompiled modes use proto-relative names (not
315+
// filesystem paths) in `.files()`. Emitting `rerun-if-changed`
316+
// for those would point cargo at non-existent files and force a
317+
// rebuild every invocation.
318+
DescriptorSource::Buf => {}
319+
DescriptorSource::Protoc => {
315320
for f in &self.files {
316321
println!("cargo:rerun-if-changed={}", f.display());
317322
}

0 commit comments

Comments
 (0)