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

Add docs.rs metadata and custom builds #73

Merged
merged 5 commits into from
Jun 7, 2017
Merged

Add docs.rs metadata and custom builds #73

merged 5 commits into from
Jun 7, 2017

Conversation

onur
Copy link
Member

@onur onur commented 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:

[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

TODO

  • Save default target to database.
  • Install system dependencies before building a package.
  • Redirect to default-target if its specified.

@briansmith
Copy link

Do you have a staging server? I'd be happy to test this out for you with the ring crate, which needs to be built with --features=rsa_signing to get correct documentation.

@onur
Copy link
Member Author

onur commented Oct 20, 2016

Unfortunately there isn't any staging server and docs.rs is only working with central repository (crates.io). I'll upload a dummy package to test this.

@lucab
Copy link

lucab commented Dec 8, 2016

Coming here from https://github.com/onur/docs.rs/issues/23#issuecomment-242943910.

We are facing a similar issue while trying to automate Debian packaging, and we'd like to have some hints from crate author regarding which system packages need to be installed in order to properly build.

The package.metadata.docs.rs.dependencies could be a good start, but I think it is possibly missing:

  • distro selector (a library may have a different package name in debian, ubuntu, fedora, etc...)
  • suite selector (a library may get renamed/split in debian-jessie->debian-stretch->debian-sid)
  • a version selector (a crate may depends on symbols introduced in newer versions of a library, even without soname changes)

May I suggest putting together a strawman proposal of a metadata schema somewhere (eg. https://wiki.debian.org/Teams/RustPackaging/)?

/cc @infinity0 @joshtriplett

@infinity0
Copy link

opam, the ocaml package manager, is able to deal with non-ocaml system dependencies and interact generically with a system package manager. I will dig out docs for that later today and comment in more detail.

@sfackler
Copy link
Member

sfackler commented Feb 3, 2017

What is this blocked on?

@onur
Copy link
Member Author

onur commented Feb 4, 2017

Actually there is nothing blocking this issue. I wanted docs.rs to build everything automatically without requiring any user input but looks like its not enough. I'll finish this feature and add into docs.rs next week.

@lucab
Copy link

lucab commented Feb 4, 2017

@onur have you seen https://github.com/joshtriplett/metadeps? It is supposed to solve this problem in a distro-agnostic way.

/cc @joshtriplett

onur added 2 commits February 5, 2017 12:20
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.
@SergioBenitez
Copy link

This is so very sorely needed. Can this be merged soon?

@onur
Copy link
Member Author

onur commented Feb 16, 2017

@SergioBenitez I am working on it.

@SergioBenitez
Copy link

Checking in. How's it going, @onur?

@alexreg
Copy link

alexreg commented Apr 18, 2017

Good work with this. This would be great for a number of projects that are currently failing to build on docs.rs. If there's any way we can help, let us know.

@onur onur changed the base branch from master to next May 24, 2017 10:29
Docs.rs is never running rustc on main crate and because of this reason,
cargo is ignoring rustdoc-args when rustc-args set. Users must define
rustdoc-args to manipulate rustc.
@onur onur merged commit 0010939 into next Jun 7, 2017
@onur onur deleted the metadata branch June 7, 2017 09:29
pkgw referenced this pull request in tectonic-typesetting/tectonic Jun 7, 2017
A new feature was just merged into docs.rs
(https://github.com/onur/docs.rs/pull/73) which will hopefully make it
possible for Tectonic to build on their system, which would be great.

As far as I can tell, we won't be able to check if this is working until the
next release is made, since docs.rs pulls releases from crates.io. But might
as well get it in now.
Marwes referenced this pull request in Marwes/clap-rs Jul 7, 2017
All the other features are either irrelevant, for nightly or already included by default so this should build with all features.

https://github.com/onur/docs.rs/pull/73

Fixes clap-rs#73
Marwes referenced this pull request in Marwes/clap-rs Jul 7, 2017
All the other features are either irrelevant, for nightly or already included by default so this should build with all features.

https://github.com/onur/docs.rs/pull/73

Fixes clap-rs#911
the8472 referenced this pull request in the8472/simd Jul 16, 2017
the8472 referenced this pull request in the8472/simd Jul 17, 2017
BurntSushi referenced this pull request in hsivonen/simd Jul 17, 2017
kbknapp referenced this pull request in clap-rs/clap Jul 21, 2017
All the other features are either irrelevant, for nightly or already included by default so this should build with all features.

https://github.com/onur/docs.rs/pull/73

Fixes #911
tmerr referenced this pull request in tmerr/i3ipc-rs Sep 24, 2017
Just learned about docs.rs which automatically builds docs for crates.
Tell it to build i3ipc with the "dox" feature, which it should listen
to thanks to onur/docs.rs#73.
tmerr referenced this pull request in tmerr/i3ipc-rs Sep 24, 2017
Just learned about docs.rs which automatically builds docs for crates.
Tell it to build i3ipc with the "dox" feature, which it should listen
to thanks to onur/docs.rs#73.
tmerr referenced this pull request in tmerr/i3ipc-rs Sep 24, 2017
Just learned about docs.rs which automatically builds docs for crates.
Tell it to build i3ipc with the "dox" feature, which it should listen
to thanks to onur/docs.rs#73.
tmerr referenced this pull request in tmerr/i3ipc-rs Sep 24, 2017
Just learned about docs.rs which automatically builds docs for crates.
Tell it to build i3ipc with the "dox" feature, which it should listen
to thanks to onur/docs.rs#73.
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 this pull request may close these issues.

7 participants