-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove build.rs
#489
Comments
Note that there is work ongoing to make atomic feature detection possible directly with |
Sounds like a great improvement. I'll take a look. |
So as mentionned in #490, it seems to be impossible.
The only option here would be to use a proc-macro. Would that be acceptable or is a |
A proc-macro would be a separate crate that must be built separately, just like the build script, so it would not be better. |
|
There was some discussion about this on Zulip. One recent comment:
I know very little about these platforms that don't support atomics, but it does seem like the thread is worth reading. Perhaps removing the build.rs is still possible with the current state of |
In general, I kind of suspect the majority of library build scripts could be killed off with some expanded If we reach a point where we can remove the build script here I'd be 100% for it. |
As of |
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.15 to 4.0.16. - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](clap-rs/clap@v4.0.15...v4.0.16) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
log
'sbuild.rs
file is very simple. It just checks the target platform and then tells Cargo to pass in--cfg=atomic_cas
and/or--cfg=has_atomics
as necessary. Those conditions are then used in about 10 different places, all insrc/lib.rs
.This use of
build.rs
is understandable. It's the only way to easily give a name to a condition, and these two conditions are somewhat verbose, checking against four targets for each one.However, @lqd and I have recently been doing some large scale measurement and analysis of popular crates. We have learned several relevant things.
log
is a very popular crate, the 7th most commonly used in our data set.std
. Around 4MB is typical on my Linux machine.log
's build script is number 28 in the list of compile times across our entire analysis, even though it's so tiny. (log
itself is number 23.)Full data is available here.
With all this in mind, it seems worth eliminating
log
'sbuild.rs
file. To avoid repeating the target conditions multiple times, it would make sense to restructure the conditional code into modules. I haven't tried this myself, but just from looking at the code it doesn't look too hard. The change to do this should include a comment explaining why a build script is worth avoiding 😄This change will make little difference to the build times seen by the
log
developers, but would save a little compile time for everyone who develops code that depends onlog
. Across the entire Rust ecosystem, this will have a significant effect.The text was updated successfully, but these errors were encountered: