koinos / koinos-types

The Rosetta Stone of the Koinos ecosystem. Allows for the interpretation of Koinos data structures in a multitude of languages. Useful in the development of microservices, clients, and smart contracts.
MIT License
12 stars 3 forks source link

Don't overwrite target files with identical contents #113

Closed theoreticalbts closed 3 years ago

theoreticalbts commented 3 years ago

Currently Koinos forces a rebuild of everything that depends on koinos-types regardless of whether it's needed or not. This is because the files are re-written and the timestamps are updated.

It might be difficult to fix this in CMake in a non-fragile, architecturally sound way, because it requires the CMake script to have precise knowledge of which files will be created and what their dependencies on sources are.

So as a workaround, I'm going to add a step that checks if koinos-types would overwrite a file with byte-for-byte identical content to what's already in the file, and simply not write the file in this case.

Overall, this change should avoid the above-mentioned fragile CMake scripting, and more robustly allow CMake to identify what actually needs to be passed to the C++ compiler during an incremental build. Which will greatly reduce build times for incremental builds.