Dushistov / flapigen-rs

Tool for connecting programs or libraries written in Rust with other languages
BSD 3-Clause "New" or "Revised" License
775 stars 59 forks source link

Make build script runs reproducible #438

Closed mpoel closed 2 years ago

mpoel commented 2 years ago

Build script runs are currently not reproducible due to non-determinism of generated Rust code.

Only issue I ran into was during creation of JNI constants and JNI load/unload hooks. This PR adopts a sorted map, thus iteration order becomes deterministic across builds.

Dushistov commented 2 years ago

May be better to use FxHashMap ? It is also deterministic in compare to default hasher, there is no randomization, and it would be faster then BTreeMap.

mpoel commented 2 years ago

Whatever you prefer, local testing does confirm the determinism of the FxHashMap. I'll update the branch

Dushistov commented 2 years ago

Thanks for PR.