We have a lot of merge conflicts for source_hash.txt, and it is annoying.
We have decided to remove it from git, and only keep it locally.
We still want it to be easy for users to just check out our repository and run cargo build without having to install all the extra tools needed by codegen (flatc, clang-format, black, …). So, we've decided that running codegen automatically is now opt-in.
One easy way to do this is that re_types/build.rs checks for source_hash.txt: if it is missing, it quits. If there is a source_hash.txt, it checks that it is up-to-date, and if not runs codegen. So for users checking out the repository, everything just works. The first time you change an .fbs file you need to also run cargo codegen. It will generate a source_hash.txt for you, and from there on codegen will be triggered automatically by build.rs.
For this we need:
- The CI needs to run codegen and check that the output is the same as what is checked in (i.e.: run codegen and check that
git is still clean)
cargo codegen updates source_hash.txt
build.rs nope-out if source_hash.txt is missing
We have a lot of merge conflicts for
source_hash.txt, and it is annoying.We have decided to remove it from git, and only keep it locally.
We still want it to be easy for users to just check out our repository and run
cargo buildwithout having to install all the extra tools needed by codegen (flatc,clang-format,black, …). So, we've decided that running codegen automatically is now opt-in.One easy way to do this is that
re_types/build.rschecks forsource_hash.txt: if it is missing, it quits. If there is asource_hash.txt, it checks that it is up-to-date, and if not runs codegen. So for users checking out the repository, everything just works. The first time you change an .fbs file you need to also runcargo codegen. It will generate asource_hash.txtfor you, and from there on codegen will be triggered automatically bybuild.rs.For this we need:
gitis still clean)cargo codegenupdatessource_hash.txtbuild.rsnope-out ifsource_hash.txtis missing