Skip to content

Commit 0ec6d7b

Browse files
Small fixes, missing steps added, copy-past-able
docs.rs needs to be cloned before you can change to /path/to/docs.rs "docker build —tag build-env ." must be run in directory linux inside crates-build-env in docs.rs the .env.sample needs to be copied to .env environment variable DOCS_RS_LOCAL_DOCKER_IMAGE is outdated and must be replaced with DOCSRS_DOCKER_IMAGE lint.sh is in the root directory of crates-build-env new Ubuntu version respected moved defining the crate directory to the beginning mentioned alphabetical order when adding package name of dependency
1 parent 5b54a8f commit 0ec6d7b

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

src/docs-rs/add-dependencies.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,29 @@ Rustwide internally uses `rustops/crates-build-env` as the build environment for
44

55
## Getting started
66

7-
First, clone the crates-build-env repo:
7+
First, clone the crates-build-env and the docs.rs repos:
88

99
```sh
10-
git clone https://github.com/rust-lang/crates-build-env && cd crates-build-env
10+
git clone https://github.com/rust-lang/crates-build-env
11+
git clone https://github.com/rust-lang/docs.rs
1112
```
1213

13-
Next, add the package to `packages.txt`. This should be the name of a package in the **Ubuntu 18.04** Repositories. See [the package home page](https://packages.ubuntu.com/) for a full list/search bar, or use `apt search` locally.
14+
Set the path to the directory of your crate. This must be an absolute path, not a relative path! On platforms with coreutils, you can instead use `$(realpath ../relative/path)` (relative to the docs.rs directory).
15+
16+
```sh
17+
YOUR_CRATE=/path/to/your/crate
18+
```
19+
20+
## Add package
21+
22+
Next, add the package to `crates-build-env/linux/packages.txt` in the correct alphabetical order. This should be the name of a package in the **Ubuntu 20.04** Repositories. See [the package home page](https://packages.ubuntu.com/) for a full list/search bar, or use `apt search` locally.
1423

1524
## Building the image
1625

1726
Now build the image. This will take a very long time, probably 10-20 minutes.
1827

1928
```sh
29+
cd crates-build-env/linux
2030
docker build --tag build-env .
2131
```
2232

@@ -25,14 +35,12 @@ docker build --tag build-env .
2535
Use the image to build your crate.
2636

2737
```sh
28-
cd /path/to/docs.rs
38+
cd ../../docs.rs
39+
cp .env.sample .env
2940
docker-compose build
30-
# NOTE: this must be an absolute path, not a relative path
31-
# On platforms with coreutils, you can instead use `$(realpath ../relative/path)`
32-
YOUR_CRATE=/path/to/your/crate
3341
# avoid docker-compose creating the volume if it doesn't exist
3442
if [ -e "$YOUR_CRATE" ]; then
35-
docker-compose run -e DOCS_RS_LOCAL_DOCKER_IMAGE=build-env \
43+
docker-compose run -e DOCSRS_DOCKER_IMAGE=build-env \
3644
-e RUST_BACKTRACE=1 \
3745
-v "$YOUR_CRATE":/opt/rustwide/workdir \
3846
web build crate --local /opt/rustwide/workdir
@@ -49,17 +57,23 @@ On line 7 of the Dockerfile, add this line: `RUN apt-get install -y your_second_
4957
Rerun the build and start the container; it should take much less time now:
5058

5159
```sh
52-
cd /path/to/crates-build-env
60+
cd ../crates-build-env/linux
5361
docker build --tag build-env .
54-
cd /path/to/docs.rs
62+
cd ../../docs.rs
5563
docker-compose run -e DOCS_RS_LOCAL_DOCKER_IMAGE=build-env \
64+
-e RUST_BACKTRACE=1 \
5665
-v "$YOUR_CRATE":/opt/rustwide/workdir \
5766
web build crate --local /opt/rustwide/workdir
5867
```
5968

6069
## Run the lint script
6170

62-
Before you make a PR, run the shell script `ci/lint.sh` and make sure it passes. It ensures `packages.txt` is in order and will tell you exactly what changes you need to make if not.
71+
Before you make a PR, run the shell script `lint.sh` and make sure it passes. It ensures `packages.txt` is in order and will tell you exactly what changes you need to make if not.
72+
73+
```sh
74+
cd ../crates-build-env
75+
./lint.sh
76+
```
6377

6478
## Make a pull request
6579

0 commit comments

Comments
 (0)