Skip to content
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

Set default target for certain crates, also features #29

Closed
retep998 opened this issue Aug 26, 2016 · 10 comments
Closed

Set default target for certain crates, also features #29

retep998 opened this issue Aug 26, 2016 · 10 comments

Comments

@retep998
Copy link
Member

For certain crates I'd like it if I could set the default target, so that when someone looks up a certain crate, they'd get the documentation I want them to get by default. Particularly useful for crates that only define things for certain targets, such as winapi.

Also useful would be a way to tell docs.rs which features to enable when building a crate. winapi 0.3 will have almost everything disabled by default, and then opting in with features, but that would end up with docs.rs generating useless documentation.

@Yamakaky
Copy link

Same idea, but different problem: https://docs.rs/crate/clang-sys fails to find libclang (obviously). There is a feature to do a runtime link instead of a compile time link, so it should fix the problem.

@onur
Copy link
Member

onur commented Aug 27, 2016

I will add building crates with extra features but where is best place to define docs.rs specific options?

Maybe a docs.rs section in Cargo.toml?

@steveklabnik
Copy link
Member

IIRC, we made a meta section of Cargo.toml for this kind of thing

@steveklabnik
Copy link
Member

Oh, it's metadata http://doc.crates.io/manifest.html#the-metadata-table-optional

@frewsxcv
Copy link
Member

A use-case I have: cocoa-rs is a crate managed by Servo. Servo currently does not build documentation on the OSX builders (https://doc.servo.org is Linux IIRC). It'd be nice if I could link to the documentation for cocoa-rs for the latest published version that was built on OSX. That said, I juts checked it looks like cocoa-rs isn't building on docs.rs, which makes my whole comment moot anyways.

@bluss
Copy link
Member

bluss commented Sep 19, 2016

Doc features are great. What I do in ndarray is to build with the "docs" feature that depends on the optional crate features. Then I've made sure each of the items enabled by that mentions this in the docs (“Requires crate feature "serde"”). Adding this to docs.rs would make it have "feature parity" and I'll switch.

onur added a commit that referenced this issue Oct 20, 2016
This patch is adding `Metadata` type used in `cargo::ops::CompileOptions` to customize
docs.rs builds.

An example metadata in Cargo.toml:

```text
[package]
name = "test"

[package.metadata.docs.rs]
features = [ "feature1", "feature2" ]
all-features = true
no-default-features = true
default-target = "x86_64-unknown-linux-gnu"
rustc-args = [ "--example-rustc-arg" ]
rustdoc-args = [ "--example-rustdoc-arg" ]
dependencies = [ "example-system-dependency" ]
```

This patch is still work in progress and aiming to fix: #29, #48 and #50

- [ ] Save default target to database.
- [ ] Install system dependencies before building a package.
@onur onur mentioned this issue Jun 7, 2017
2 tasks
@onur onur closed this as completed in 7e36f87 Jun 7, 2017
@onur
Copy link
Member

onur commented Jun 7, 2017

This is partially fixed, looks like a commit closed this.

Docs.rs now supports building non-default features but it is not redirecting to default-target yet.

@onur onur reopened this Jun 7, 2017
@retep998
Copy link
Member Author

Would be really cool to have the default-target redirect working. It's incredibly frustrating when people look for the documentation for winapi only to find empty documentation.

@est31
Copy link
Member

est31 commented Nov 2, 2018

#255 fixed this

@QuietMisdreavus
Copy link
Member

Crates that set a default-target in their [package.metadata.docs.rs] will now run their "test build" for that target, and their default docs set will be run on that target. In addition, crates with a default-target already set have had their latest version rebuilt; for example https://docs.rs/winapi/ now contains the proper docs for x86_64-pc-windows-msvc without having to redirect to that target's page. (Note that the builds still all run on a Linux system, so if your crate is target-specific because of a system library, that will still need to be available on Debian for the docs to build!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants