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 a specific feature during doc generation #50

Closed
dflemstr opened this issue Sep 19, 2016 · 1 comment · Fixed by #131
Closed

Set a specific feature during doc generation #50

dflemstr opened this issue Sep 19, 2016 · 1 comment · Fixed by #131

Comments

@dflemstr
Copy link

Use case: if your library depends on some native library or otherwise does something funky during build, it won't be exposed on docs.rs.

The build could check for the presence of a docs feature in the Cargo.toml file, for example like this:

cargo read-manifest | rq 'select"$.features"|map(o)=>{_.keys(o)}|spread|some(x)=>{"docs"==x}'

(Shameless plug: rq)

Setting this docs feature would allow the library to "defuse" itself, by not running a build script or not trying to link a native library.

@onur
Copy link
Member

onur commented Sep 22, 2016

This is a good idea but I was planning to add an option for extra-features and no-default-features. This is a most requested feature for docs.rs. See: #29

Checking docs feature can also be useful.

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 added a commit that referenced this issue Feb 5, 2017
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 #131 Jun 7, 2017
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

Successfully merging a pull request may close this issue.

2 participants