Sort generated functions for deterministic builds - #500
Conversation
When rebuilding frame.ex without any source code changes, the resulting .beam file changed. This was due to functions being reordered in the compiled .beam file depending on the ordering of several maps. The fix is to sort the maps to make the order deterministic.
|
Just to provide some more context here, it's pretty easy to see that something changed in the build products with Nerves since firmware images get referred to by their checksums. This was found by building the same project twice and noticing an unexpected change to the final firmware. On inspection, this was a harmless change, but it's nice when you don't have to look through a .beam file to figure that out. Plus getting rid of the change reduces the size of delta firmware updates by a little bit. I'm hoping that deterministic builds are helpful to others too. |
|
Last note, when I ran the unit tests on macOS, I had 16 failures, but those tests failed before and after the change so I think I'm not running the tests correctly. |
|
This is great, thank you Frank 馃 |
When rebuilding frame.ex without any source code changes, the resulting
.beam file changed. This was due to functions being reordered in the
compiled .beam file depending on the ordering of several maps. The fix
is to sort the maps to make the order deterministic.