prost-wkt icon indicating copy to clipboard operation
prost-wkt copied to clipboard

`google.protobuf.rs` becomes bigger after each build

Open Chaoses-Ib opened this issue 1 year ago • 2 comments

I ran into a problem where add_serde() will append trait impls to google.protobuf.rs after each build, but neither prost nor prost-wkt would clear it, so it only becomes bigger and bigger.

https://github.com/fdeantoni/prost-wkt/blob/bedabbb2077da8d342269d6d641b783a8440946b/wkt-build/src/lib.rs#L12-L41

And I found the generated google.protobuf.rs isn't actually used, so the duplicated code won't break the build. But if anyone includes the generated files in VCS, there will be a problem. A simple workaround I currently use is to remove google.protobuf.rs after add_serde():

_ = fs::remove_file(out.join("google.protobuf.rs"));

Chaoses-Ib avatar Apr 05 '24 08:04 Chaoses-Ib

Thanks for raising this! Indeed not good if the file keeps growing. I will dig a little deeper to see what the best solution is.

fdeantoni avatar Apr 06 '24 12:04 fdeantoni

I played around with creating a derive proc-macro which could help in this case.

wtzhang23 avatar Aug 30 '24 22:08 wtzhang23