Skip to content

Commit

Permalink
Rust: delete codegen logic for working with .upb.h files
Browse files Browse the repository at this point in the history
This logic is not necessary anymore now that we are no longer relying on the
upb C generated code.

PiperOrigin-RevId: 702487648
  • Loading branch information
acozzette authored and copybara-github committed Dec 3, 2024
1 parent 9a8494d commit be11a95
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions rust/release_crates/protobuf_codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ impl CodeGen {
if file_name.ends_with(".upb_minitable.c") {
cc_build.file(path);
}
if file_name.ends_with(".upb.h") {
Self::strip_upb_inline(&path);
cc_build.file(path.with_extension("c"));
}
if file_name.ends_with(".pb.rs") {
Self::fix_rs_gencode(&path);
}
Expand All @@ -142,14 +138,6 @@ impl CodeGen {
Ok(())
}

// Remove UPB_INLINE from the .upb.h file.
fn strip_upb_inline(header: &Path) {
let contents = fs::read_to_string(header).unwrap().replace("UPB_INLINE ", "");
let mut file =
OpenOptions::new().write(true).truncate(true).open(header.with_extension("c")).unwrap();
file.write(contents.as_bytes()).unwrap();
}

// Adjust the generated Rust code to work with the crate structure.
fn fix_rs_gencode(path: &Path) {
let contents = fs::read_to_string(path)
Expand Down

0 comments on commit be11a95

Please sign in to comment.