calio / lua-capnproto

Lua-capnp is a pure lua implementation of capnproto based on luajit.
BSD 2-Clause "Simplified" License
70 stars 24 forks source link

Remove Timestamp in Code Generation #11

Closed abraithwaite closed 2 years ago

abraithwaite commented 8 years ago

This causes issues for automating things and deterministic builds.

My most recent example is trying to rebase with auto generated files which should be the same conflict because of the timestamp.

--- Generated by lua-capnproto 0.1.3-1 on Tue Sep 20 20:54:37 2016
+-- Generated by lua-capnproto 0.1.3-1 on Tue Sep 20 20:55:53 2016
calio commented 8 years ago

Rebase automated generated files isn't a very good idea. I used to just update capnproto files and then regenerate files for all languages. Keeping the time stamp is important because we want to know what is the version of the file. We used to use this to tell if a file is generated by an old version of lua-capnproto which has bugs.

abraithwaite commented 8 years ago

Isn't that why we include the version number though? We could even include a hash to indicate the exact version. Timestamps in generated code (binary or source) is bad. It prevents you from being to easily verify that two compilers on separate machines are producing the same code.

calio commented 8 years ago

I agree, hash would be a better way of versioning. lua-capnproto gets it input from capnp command, and capnp doesn't pass any version information. So that's why I use timestamp here as a simple version. I don't agree that putting timestamps in generated code (binary or source) is bad. Sometimes information like when a binary is built can be useful. If this is causing git conflicts, then I think this is a workflow problem, not a timestamp in generated file problem. If it's the same conflict, you can always use "git rerere" to record the solution and it will automatically resolve it next time.