jmacdonald / amp

A complete text editor for your terminal.
https://amp.rs
Other
3.73k stars 105 forks source link

Generated files should go into OUT_DIR and not the working directory #94

Closed bjorn-ove closed 6 years ago

bjorn-ove commented 6 years ago

Generated files should no longer go into the src directory. Instead OUT_DIR should be used.

This is as currently documented: https://doc.rust-lang.org/cargo/reference/build-scripts.html#case-study-code-generation

In general, build scripts should not modify any files outside of OUT_DIR. It may seem fine on the first blush, but it does cause problems when you use such crate as a dependency, because there's an implicit invariant that sources in .cargo/registry should be immutable. cargo won't allow such scripts when packaging.

There is even a feature in cargo to block added in https://github.com/rust-lang/cargo/pull/5584

jmacdonald commented 6 years ago

Thanks for this, @BearOve! 🍻