Skip to content

Commit a81e470

Browse files
committed
Move development guid to docs/development.md
I want to make the readme more aimed at people interested in the tool and project in general, not necessarily at developers hacking on RCL itself. Let's move that to a separate manual section, since there is already a development section in there.
1 parent 69f1a99 commit a81e470

File tree

4 files changed

+105
-34
lines changed

4 files changed

+105
-34
lines changed

README.md

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -142,40 +142,9 @@ favorite editor if it is not yet supported.
142142

143143
## Development
144144

145-
Run all tests and checks below in one command:
145+
To get started hacking on RCL, see [`docs/development.md`][dev-docs].
146146

147-
nix flake check
148-
149-
Run golden tests:
150-
151-
cargo build
152-
golden/run.py
153-
154-
Run unit tests and lints:
155-
156-
cargo test
157-
cargo clippy
158-
159-
Typecheck Python sources
160-
161-
mypy --strict --exclude pyrcl .
162-
mypy --strict pyrcl
163-
164-
Check formatting:
165-
166-
cargo fmt
167-
black .
168-
169-
View coverage of the golden tests:
170-
171-
nix build .#coverage --out-link result
172-
xdg-open result/index.html
173-
174-
For how to run the fuzzers, see [`docs/testing.md`](docs/testing.md).
175-
176-
## Building WASM
177-
178-
See [the readme in the `wasm` directory](wasm/README.md).
147+
[dev-docs]: https://docs.ruuda.nl/rcl/development/
179148

180149
## License
181150

docs/building.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@ fix the discrepancies is welcome:
4848
* aarch64-apple-darwin
4949

5050
[reproducible]: https://reproducible-builds.org/
51+
52+
## Python module
53+
54+
See the readme in the `pyrcl` directory for how to build the Python module.
55+
56+
## Wasm module
57+
58+
See the readme in the `wasm` directory for how to build the Webassembly module.

docs/development.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Developing RCL
2+
3+
This chapter explains the tools and workflows involved in hacking on <abbr>RCL</abbr>.
4+
To get started, clone the repository from one of the two mirrors:
5+
6+
git clone https://codeberg.org/ruuda/rcl.git
7+
git clone https://github.com/ruuda/rcl.git
8+
9+
## Building
10+
11+
RCL is written in Rust and builds with Cargo:
12+
13+
cargo build
14+
target/debug/rcl --help
15+
16+
See the [building chapter](building.md) for more details and alternative build
17+
configurations.
18+
19+
## CI and automated tests
20+
21+
Almost all of the checks that are part of the <abbr>RCL</abbr> development
22+
process are automated, and included in [the Nix flake][flake]. These checks are
23+
verified on <abbr>CI</abbr> by [Garnix], but you can run them locally as well:
24+
25+
nix flake check
26+
27+
This means that you can reproduce and debug any <abbr>CI</abbr> run locally.
28+
29+
While it is convenient to be able to run all checks in one command, if you know
30+
what parts of <abbr>RCL</abbr> you changed, you can run just the relevant
31+
checks. They are listed in [the section below](#individual-checks).
32+
33+
## Development environment
34+
35+
For the tools used for development, the Nix flake includes a devshell with the
36+
right version of development dependencies (Python, MkDocs, Tree-sitter, ets.)
37+
that you can enter with:
38+
39+
nix develop --command $SHELL
40+
41+
Sourcing your tools elsewhere (e.g. your system package manager) will probably
42+
work, but only the Nix flake is continuously tested on <abbr>CI</abbr>.
43+
44+
[flake]: installation.md#as-a-nix-flake
45+
[Garnix]: https://app.garnix.io/repo/ruuda/rcl
46+
47+
## Individual checks
48+
49+
50+
Run the [golden tests](testing.md#golden-tests):
51+
52+
cargo build
53+
golden/run.py
54+
55+
View coverage of the golden tests:
56+
57+
nix build .#coverage --out-link result
58+
xdg-open result/index.html
59+
60+
Run unit tests and lints:
61+
62+
cargo test --workspace
63+
cargo clippy --workspace
64+
65+
Typecheck Python sources:
66+
67+
mypy --strict --exclude pyrcl .
68+
mypy --strict pyrcl
69+
70+
Autoformat Rust, Python, and <abbr>RCL</abbr> code:
71+
72+
<!-- For some reason MkDocs highlights `exec` in an indented code block ... -->
73+
```sh
74+
cargo fmt
75+
black .
76+
fd . --extension .rcl --exclude golden --exec-batch rcl format --in-place
77+
```
78+
79+
Build and preview the manual:
80+
81+
mkdocs serve
82+
83+
Build crate documentation and check for issues:
84+
85+
RUSTFLAGS="--deny warnings" cargo doc --no-deps --workspace
86+
87+
## Fuzz tests
88+
89+
After implementing a feature, run the fuzzers to ensure the code still respects
90+
all invariants and is free of crashes. See [the fuzzing section in the testing
91+
chapter][fuzz].
92+
93+
[fuzz]: testing.md#running-the-fuzzers

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ nav:
4949
- "rcl patch": "rcl_patch.md"
5050
- "rcl query": "rcl_query.md"
5151
- "Development":
52-
- "About": "about.md"
52+
- "Overview": "development.md"
5353
- "Building": "building.md"
5454
- "Testing": "testing.md"
5555
- "Grammars": "grammars.md"
5656
- "Tree-sitter": "tree_sitter.md"
5757
- "Releasing": "releasing.md"
58+
- "About": "about.md"

0 commit comments

Comments
 (0)