Skip to content

Commit eb70681

Browse files
committed
Document josh subtrees and update subtree repository list (#2182)
1 parent 4a73eba commit eb70681

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

Diff for: src/external-repos.md

+21-9
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@
33
The `rust-lang/rust` git repository depends on several other repos in the `rust-lang` organization.
44
There are three main ways we use dependencies:
55
1. As a Cargo dependency through crates.io (e.g. `rustc-rayon`)
6-
2. As a git subtree (e.g. `clippy`)
6+
2. As a git (e.g. `clippy`) or a [josh][josh] (e.g. `miri`) subtree
77
3. As a git submodule (e.g. `cargo`)
88

99
As a general rule, use crates.io for libraries that could be useful for others in the ecosystem; use
1010
subtrees for tools that depend on compiler internals and need to be updated if there are breaking
1111
changes; and use submodules for tools that are independent of the compiler.
1212

13-
## External Dependencies (subtree)
13+
## External Dependencies (subtrees)
1414

15-
As a developer to this repository, you don't have to treat the following external projects
16-
differently from other crates that are directly in this repo:
15+
The following external projects are managed using some form of a `subtree`:
1716

18-
* [Clippy](https://github.com/rust-lang/rust-clippy)
19-
* [Miri]
17+
* [clippy](https://github.com/rust-lang/rust-clippy)
18+
* [miri](https://github.com/rust-lang/miri)
2019
* [rustfmt](https://github.com/rust-lang/rustfmt)
2120
* [rust-analyzer](https://github.com/rust-lang/rust-analyzer)
22-
23-
[Miri]: https://github.com/rust-lang/miri
21+
* [rustc_codegen_cranelift](https://github.com/rust-lang/rustc_codegen_cranelift)
2422

2523
In contrast to `submodule` dependencies
2624
(see below for those), the `subtree` dependencies are just regular files and directories which can
@@ -29,6 +27,20 @@ to these tools should be filed against the tools directly in their respective
2927
upstream repositories. The exception is that when rustc changes are required to
3028
implement a new tool feature or test, that should happen in one collective rustc PR.
3129

30+
`subtree` dependencies are currently managed by two distinct approaches:
31+
32+
* Using `git subtree`
33+
* `clippy` ([sync guide](https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html#performing-the-sync-from-rust-langrust-to-clippy))
34+
* `rustfmt`
35+
* `rustc_codegen_cranelift` ([sync script](https://github.com/rust-lang/rustc_codegen_cranelift/blob/113af154d459e41b3dc2c5d7d878e3d3a8f33c69/scripts/rustup.sh#L7))
36+
* Using the [josh][josh] tool
37+
* `miri` ([sync guide](https://github.com/rust-lang/miri/blob/master/CONTRIBUTING.md#advanced-topic-syncing-with-the-rustc-repo))
38+
* `rust-analyzer` ([sync script](https://github.com/rust-lang/rust-analyzer/blob/2e13684be123eca7181aa48e043e185d8044a84a/xtask/src/release.rs#L147))
39+
40+
The [josh][josh] tool is an alternative to git subtrees, which manages git history in a different way and scales better to larger repositories. Specific tooling is required to work with josh, you can check out the `miri` or `rust-analyzer` scripts linked above for inspiration. If you want to migrate a subtree from `git subtree` to josh, you can check out [this guide](https://hackmd.io/7pOuxnkdQDaL1Y1FQr65xg).
41+
42+
Below you can find a guide on how to perform push and pull synchronization with the main rustc repo using `git subtree`, although these instructions might differ repo from repo.
43+
3244
### Synchronizing a subtree
3345

3446
Periodically the changes made to subtree based dependencies need to be synchronized between this
@@ -84,7 +96,6 @@ Now you're done, the `src/tools/clippy` directory behaves as if Clippy were
8496
part of the rustc monorepo, so no one but you (or others that synchronize
8597
subtrees) actually needs to use `git subtree`.
8698

87-
8899
## External Dependencies (submodules)
89100

90101
Building Rust will also use external git repositories tracked using [git
@@ -111,3 +122,4 @@ the week leading up to the beta cut.
111122
[The Rust Reference]: https://github.com/rust-lang/reference/
112123
[toolstate website]: https://rust-lang-nursery.github.io/rust-toolstate/
113124
[Toolstate chapter]: https://forge.rust-lang.org/infra/toolstate.html
125+
[josh]: https://josh-project.github.io/josh/intro.html

0 commit comments

Comments
 (0)