Skip to content

Commit bd045f2

Browse files
authored
Merge pull request #403 from rust-lang/docsrs-changes
"Upcoming docs.rs changes"
2 parents f454a4a + 6ff3fb9 commit bd045f2

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
layout: post
3+
title: "Upcoming docs.rs changes"
4+
author: The Rust Infrastructure Team
5+
---
6+
7+
On September 30th breaking changes will be deployed to the [docs.rs] build
8+
environment. [docs.rs] is a free service building and hosting documentation for
9+
all the crates published on [crates.io]. It's [open source][docsrs-source],
10+
maintained by the [Rustdoc team][rustdoc-team] and operated by the
11+
[Infrastructure team][infra-team].
12+
13+
## What will change
14+
15+
Builds will be executed inside the [rustops/crates-build-env] Docker image.
16+
That image contains a lot of system dependencies installed to ensure we can
17+
build as many crates as possible. It's already used by [Crater], and we added
18+
all the dependencies previously installed in the legacy build environment.
19+
20+
To ensure we can continue operating the service in the future and to increase
21+
its reliability we also improved the sandbox the builds are executed in, adding
22+
new limits:
23+
24+
* Each platform will now have **15 minutes** to build its dependencies and
25+
documentation.
26+
* **3 GB of RAM** will be available for the build.
27+
* Network access will be **disabled** (crates.io dependencies will still be
28+
fetched).
29+
* Only the `target/` directory will be writable, and it will be purged after
30+
each build.
31+
32+
Finally, docs.rs will now use the latest nightly available when building
33+
crates, instead of using a manually updated pinned version of nightly.
34+
35+
## How to prepare for the changes
36+
37+
To test if your crate builds inside the new environment you can download the
38+
Docker image locally and execute a shell inside it:
39+
40+
```
41+
docker pull rustops/crates-build-env
42+
docker run --rm --memory 3221225472 -it rustops/crates-build-env bash
43+
```
44+
45+
Once you're in a shell you can install [rustup] (it's not installed by default
46+
in the image), install Rust nightly, clone your crate's repository and then
47+
build the documentation:
48+
49+
```
50+
time cargo doc --no-deps
51+
```
52+
53+
To aid your testing these commands will limit the available RAM to 3 GB and
54+
show the total execution time of `cargo doc`, but network access will not be
55+
blocked as you'll need to fetch dependencies.
56+
57+
If your project needs a system dependency missing in the build environment,
58+
please [open an issue][crates-build-env-issue] on the Docker image's
59+
[repository][rustops/crates-build-env] and we'll consider adding it.
60+
61+
If your crate fails to build because it took more than 15 minutes to generate
62+
its docs or it uses more than 3 GB of RAM please [open an issue][docsrs-issue]
63+
and we will consider reasonable limit increases for your crate. We will **not**
64+
enable network access for your crate though: you'll need to change your crate
65+
not to require any external resource at build time.
66+
67+
We recommend using [Cargo features] to remove the parts of the code causing
68+
build failures, enabling those features with [docs.rs metadata].
69+
70+
## Acknowledgements
71+
72+
The new build environment is based on [Rustwide], the library powering
73+
[Crater]. It was extracted from the Crater codebase, and created both by the
74+
[Crater contributors] and the [Rustwide contributors].
75+
76+
The implementation work on the docs.rs side was done by [Pietro Albini][pietro]
77+
and [Onur Aslan][onur], with [QuietMisdreavus][misdreavus] and [Mark
78+
Rousskov][mark] reviewing the changes.
79+
80+
[docs.rs]: https://docs.rs
81+
[crates.io]: https://crates.io
82+
[docsrs-source]: https://github.com/rust-lang/docs.rs
83+
[rustdoc-team]: https://www.rust-lang.org/governance/teams/dev-tools#rustdoc
84+
[infra-team]: https://www.rust-lang.org/governance/teams/operations#infra
85+
[rustops/crates-build-env]: https://hub.docker.com/r/rustops/crates-build-env
86+
[Crater]: https://github.com/rust-lang/crater
87+
[rustup]: https://rustup.rs
88+
[crates-build-env-issue]: https://github.com/rust-lang/crates-build-env/issues
89+
[docsrs-issue]: https://github.com/rust-lang/crates-build-env/issues
90+
[Cargo features]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section
91+
[docs.rs metadata]: https://docs.rs/about
92+
[rustwide]: https://github.com/rust-lang/rustwide
93+
[Crater contributors]: https://github.com/rust-lang/crater/graphs/contributors
94+
[Rustwide contributors]: https://github.com/rust-lang/rustwide/graphs/contributors
95+
[pietro]: https://github.com/pietroalbini
96+
[onur]: https://github.com/onur
97+
[mark]: https://github.com/Mark-Simulacrum
98+
[misdreavus]: https://github.com/QuietMisdreavus

src/main.rs

+5
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ impl Blog {
121121
// yeah this might blow up, but it won't
122122
let filename = path.file_name().unwrap().to_str().unwrap();
123123

124+
// ignore vim temporary files
125+
if filename.starts_with(".") && filename.ends_with(".swp") {
126+
continue;
127+
}
128+
124129
// we need to get the metadata out of the url
125130
let mut split = filename.splitn(4, "-");
126131

0 commit comments

Comments
 (0)