Rust OSS: Emit cargo::rerun-if-changed on both inputs and outputs of the protoc run.

This will make it so touching either file and running cargo run again will automatically rerun protoc (right now if you build once and then touch either the inputs or outputs it'll keep using whatever is there).

PiperOrigin-RevId: 695699195
pull/19221/head
Protobuf Team Bot 2 weeks ago committed by Copybara-Service
parent bde72abba0
commit b35d8bd640
  1. 17
      csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs
  2. 6
      rust/protobuf_codegen/src/lib.rs

@ -1,17 +0,0 @@
#region Copyright notice and license
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#endregion
namespace Google.Protobuf.Reflection;
internal sealed partial class FeatureSetDescriptor
{
// Canonical serialized form of the edition defaults, generated by embed_edition_defaults.
private const string DefaultsBase64 =
"ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH";
}

@ -93,6 +93,11 @@ impl CodeGen {
} else {
protoc_gen_upb_minitable_path().expect("To be a supported platform")
};
for include in &self.includes {
println!("cargo:rerun-if-changed={}", include.display());
}
cmd.arg(format!("--rust_out={}", self.output_dir.display()))
.arg("--rust_opt=experimental-codegen=enabled,kernel=upb")
.arg(format!(
@ -119,6 +124,7 @@ impl CodeGen {
for entry in WalkDir::new(&self.output_dir) {
if let Ok(entry) = entry {
let path = entry.path();
println!("cargo:rerun-if-changed={}", path.display());
let file_name = path.file_name().unwrap().to_str().unwrap();
if file_name.ends_with(".upb_minitable.c") {
cc_build.file(path);

Loading…
Cancel
Save