fdeantoni / prost-wkt

Prost Well-Known-Types serialization and deserialization.
Apache License 2.0
75 stars 37 forks source link

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

Open Chaoses-Ib opened 8 months ago

Chaoses-Ib commented 8 months ago

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"));
fdeantoni commented 7 months ago

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.

wtzhang23 commented 3 months ago

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