-
Notifications
You must be signed in to change notification settings - Fork 300
Add docs.rs post about fewer targets #603
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
posts/inside-rust/2020-05-27-docs-rs-building-fewer-targets.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
layout: post | ||
title: "docs.rs will start building fewer targets" | ||
author: Joshua Nelson | ||
team: the docs.rs team <https://www.rust-lang.org/governance/teams/dev-tools#docs-rs> | ||
--- | ||
|
||
Starting soon, docs.rs will by default only build one target for crates published to crates.io. | ||
This is a breaking change, and if you own a crate that is different on different platforms, | ||
you should consider specifying your targets explicitly. | ||
|
||
## What does this change? | ||
|
||
Currently, docs.rs builds documentation for all [tier 1 platforms][platform support] by default. | ||
After this change, docs.rs will only build one platform by default. | ||
Usually the platform is `x86_64-unknown-linux-gnu`, but this can be configured. | ||
This only changes the default, you can still opt-in to more targets if you choose. | ||
|
||
## Why is this change being made? | ||
|
||
Building all 5 tier-one targets means that builds take 5x as long to finish. | ||
Additionally, it means that docs.rs stores 5x as much documentation, increasing our fixed costs. | ||
For most crates, the documentation is the same on every platform, so there is no need to build it many times. | ||
|
||
## Who will this affect? | ||
|
||
This will affect Rust developers who maintain or use a crate which is different on different platforms | ||
(i.e. uses [conditional compilation]) and also does not explicitly specify the targets it should be built on. | ||
For example, [winapi](https://docs.rs/winapi/0.3.8/) only has documentation on windows platforms, | ||
so it needs to specify all windows targets in order for them to show up. | ||
|
||
As a quick rule of thumb, if you go to a docs.rs page that looks like `docs.rs/:crate/:version/:target`, | ||
where `:target` is a tier 1 platform, that page may be affected. | ||
|
||
## Will old documentation be deleted? | ||
|
||
No, any existing documentation for different targets will remain up. | ||
There is no plan to delete docs.rs documentation that has already been built. | ||
|
||
## How do I make sure my crate doesn't break? | ||
|
||
If you are a maintainer of a crate that uses conditional compilation, | ||
you can explicitly specify your targets in `Cargo.toml` like so: | ||
|
||
```toml | ||
[package.metadata.docs.rs] | ||
# replace these with the targets you actually want to build | ||
targets = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"] | ||
``` | ||
|
||
Any target supported by `rustup add target` is also supported by docs.rs. | ||
See [the metadata documentation](https://docs.rs/about#metadata) for more details. | ||
|
||
If you develop but do not maintain a crate that uses conditional compilation, | ||
you can open an issue or PR to add these targets. | ||
|
||
## When is this change being made? | ||
|
||
There is no set time frame yet. | ||
We can guarantee at least a month (July 1st) before we will implement the change. | ||
|
||
## How can I learn more? | ||
|
||
More information on targets is available in the [platform support] page. | ||
You can learn more about the change in [the issue proposing it][docs.rs#343] and [the PR with the implementation][docs.rs#532]. | ||
If you want to discuss the change with the docs.rs team, | ||
feel free to join the [docs.rs discord channel] or [open an issue][issue link]. | ||
|
||
|
||
[platform support]: https://forge.rust-lang.org/release/platform-support.html | ||
[docs.rs#343]: https://github.com/rust-lang/docs.rs/issues/343 | ||
[docs.rs#532]: https://github.com/rust-lang/docs.rs/issues/532 | ||
[docs.rs discord channel]: https://discord.gg/f7mTXPW | ||
[conditional compilation]: https://doc.rust-lang.org/reference/conditional-compilation.html#forms-of-conditional-compilation | ||
[issue link]: (https://github.com/rust-lang/docs.rs/issues/new?title=Changing%20default%20targets) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's specify this will build on
x86_64-unknown-linux-gnu
.