Skip to content

Commit 0caca29

Browse files
authored
Revert "feat(prost-build): emit rerun commands (#1140)" (#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 #1296.
1 parent 3543eb8 commit 0caca29

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

prost-build/src/config.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,6 @@ impl Config {
910910
) -> Result<FileDescriptorSet> {
911911
let tmp;
912912
let file_descriptor_set_path = if let Some(path) = &self.file_descriptor_set_path {
913-
println!("cargo:rerun-if-changed={}", path.display());
914913
path.clone()
915914
} else {
916915
if self.skip_protoc_run {
@@ -932,7 +931,6 @@ impl Config {
932931
cmd.arg("-o").arg(&file_descriptor_set_path);
933932

934933
for include in includes {
935-
println!("cargo:rerun-if-changed={}", include.as_ref().display());
936934
if include.as_ref().exists() {
937935
cmd.arg("-I").arg(include.as_ref());
938936
} else {
@@ -954,7 +952,6 @@ impl Config {
954952
}
955953

956954
for proto in protos {
957-
println!("cargo:rerun-if-changed={}", proto.as_ref().display());
958955
cmd.arg(proto.as_ref());
959956
}
960957

@@ -1025,6 +1022,12 @@ impl Config {
10251022
protos: &[impl AsRef<Path>],
10261023
includes: &[impl AsRef<Path>],
10271024
) -> Result<()> {
1025+
// TODO: This should probably emit 'rerun-if-changed=PATH' directives for cargo, however
1026+
// according to [1] if any are output then those paths replace the default crate root,
1027+
// which is undesirable. Figure out how to do it in an additive way; perhaps gcc-rs has
1028+
// this figured out.
1029+
// [1]: http://doc.crates.io/build-script.html#outputs-of-the-build-script
1030+
10281031
let file_descriptor_set = self.load_fds(protos, includes)?;
10291032

10301033
self.compile_fds(file_descriptor_set)
@@ -1245,15 +1248,13 @@ pub fn error_message_protoc_not_found() -> String {
12451248

12461249
/// Returns the path to the `protoc` binary.
12471250
pub fn protoc_from_env() -> PathBuf {
1248-
println!("cargo:rerun-if-env-changed=PROTOC");
12491251
env::var_os("PROTOC")
12501252
.map(PathBuf::from)
12511253
.unwrap_or(PathBuf::from("protoc"))
12521254
}
12531255

12541256
/// Returns the path to the Protobuf include directory.
12551257
pub fn protoc_include_from_env() -> Option<PathBuf> {
1256-
println!("cargo:rerun-if-env-changed=PROTOC_INCLUDE");
12571258
let protoc_include: PathBuf = env::var_os("PROTOC_INCLUDE")?.into();
12581259

12591260
if !protoc_include.exists() {

0 commit comments

Comments
 (0)