-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[cargo doc] build.rs does not cover the use cases very well #3053
Comments
Build scripts can also output |
@cuviper I do not disagree, but as I already said, the influence is not meaningful. Those cfgs reflect the build environment of whatever is building your documentation and not the environment your user (the person reading documentation) has. This leads to essentially the same problem as showing linux documentation for a user on windows (resulting in empty/missing In order to specify cfgs for docs.rs, I think one would end up using similar scheme as the one you’d use to specify features (https://github.com/onur/docs.rs/issues/29). |
Yeah it's true that build scripts are basically just large black boxes today, so I think it's correct for now to default to trying to run them to generate docs. I'd be up for exploring the space of more targeted build scripts for situations like this, but that's certainly RFC territory to be implemented. |
@alexcrichton what about
|
We could perhaps add a flag to |
Can't the build script check |
Any progress on this issue? |
This sounds like it might fall under eRFC 2136, Cargo build system integration. |
As far as I can tell, #8811 is a dupe of this but since it has more recent notes on direction, I'm closing this in favor of it. If there is a reason we need this separate issue, let us know and we can revisit! |
With docs.rs out, we’ve noticed a problem with cargo running
build.rs
scripts when documenting each crate, while it shouldn’t be necessary in majority of the cases.Namely, most of the crates use build.rs scripts for one of these three large categories:
First and second use case will not influence the resulting documentation in meaningful ways, while the third use-case almost always will. First and second use-cases are target-dependent and may require cross-compilation toolchains, whereas the third use-case as well as documentation generation are obviously target-agnostic and can be done without any extra tooling or knowledge about the target platform.
It is counter-productive to not make any distinction between these cases. A project like docs.rs ideally shouldn’t need to install any native dependencies (see https://github.com/onur/docs.rs/issues/23) in order to generate documentation (because they are irrelevant for documentation generation purposes!)
There’s multiple ways one could proceed here:
generate.rs
, do not runbuild.rs
scripts oncargo doc
;Cargo.toml
(e.g.run_build_script_for_docs = false
) defaulting to not running build.rs before generating documentation and making people using third use case specify that variable to true;[metadata]
Cargo.toml section instructing docs.rs to runbuild.rs
);cc @onur
The text was updated successfully, but these errors were encountered: