3 ms·
It's interesting how many organizations had problems with build.rs. Other build systems like Make, scons, or autotools have the ability to run arbitrary things
by est31 7y ago
It's interesting how many organizations had problems with build.rs. Other build systems like Make, scons, or autotools have the ability to run arbitrary things in any step in the process compared to Rust which has a clear separation.
There is a proposed RFC to reduce the need for build.rs scripts in many cases [1], will likely be merged within the next 2 weeks.
[1]: https://github.com/rust-lang/rfcs/pull/2523 https://github.com/rust-lang/rfcs/pull/2523
- epage 7y agoFor code-gen, I'm experimenting with checking in the results and having a "is the code-gen correct" check in the CI See https://github.com/crate-ci/imperative/pull/4 https://github.com/crate-ci/imperative/pull/4 for an example I hadn't even considered the benefit of reducing build.rs usage. I was focused on speeding up people's builds by reducing the number of dependencies involved and making my crate do less work when being built. Tempted to turn this pattern into a crate to reduce the hump to overcome to adopt it.
- saghm 7y ago> It's interesting how many organizations had problems with build.rs. Other build systems like Make, scons, or autotools have the ability to run arbitrary things in any step in the process compared to Rust which has a clear separation. I think the history behind this is that Cargo was built with only Rust in mind; when your world is 100% Rust, you generally don't need much extensibility in your build process. Make, scons, and autotools all seem like they were designed to be more language agnostic from the start. It'll be interesting to see how cargo needs to evolve to be able to support interior with other ecosystems at the level that larger companies need.
- ChrisSD 7y agoThe way I heard it was that Cargo was intentionally avoiding being a complete build system. The idea being that Make et al would still be used when necessary so build.rs (and cargo in general) could be free to concentrate on managing the Rust parts exclusively.
- deleted 7y ago[deleted]
- paulddraper 7y agoFor a modern make, I recommend checking out https://bazel.build/ https://bazel.build/ (or its offspring Buck and Pants). It's mentioned in the writeup.
- mike-cardwell 7y agoIf people are worried about build.rs files running arbitrary things, you can isolate cargo inside docker, using a project I recently released: https://gitlab.com/mikecardwell/saferrust https://gitlab.com/mikecardwell/saferrust