diff options
author | Sunjay Varma <sunjay@users.noreply.github.com> | 2017-10-17 22:51:10 -0400 |
---|---|---|
committer | Sunjay Varma <varma.sunjay@gmail.com> | 2017-10-17 23:05:45 -0400 |
commit | 790604adad9fd02b92c59d1f937edb902a58b036 (patch) | |
tree | 5846bf4c37f6484e7d41077d3464d69a7a08f5a5 /CONTRIBUTING.md | |
parent | Added a section about updating submodules (diff) | |
download | grust-790604adad9fd02b92c59d1f937edb902a58b036.tar.gz grust-790604adad9fd02b92c59d1f937edb902a58b036.tar.bz2 grust-790604adad9fd02b92c59d1f937edb902a58b036.tar.xz |
Updating the instructions for when a tool breaks to use the new toolstate feature
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r-- | CONTRIBUTING.md | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 34789f144f..0f6cba7a95 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md | |||
@@ -363,46 +363,56 @@ outside the submodule. | |||
363 | It can also be more convenient during development to set `submodules = false` | 363 | It can also be more convenient during development to set `submodules = false` |
364 | in the `config.toml` to prevent `x.py` from resetting to the original branch. | 364 | in the `config.toml` to prevent `x.py` from resetting to the original branch. |
365 | 365 | ||
366 | #### Breaking rustfmt or rls | 366 | #### Breaking Tools Built With The Compiler |
367 | [breaking-rustfmt-or-rls]: #breaking-rustfmt-or-rls | 367 | [breaking-tools-built-with-the-compiler]: #breaking-tools-built-with-the-compiler |
368 | 368 | ||
369 | Rust's build system also builds the | 369 | Rust's build system builds a number of tools that make use of the |
370 | [RLS](https://github.com/rust-lang-nursery/rls) | 370 | internals of the compiler. This includes clippy, |
371 | and [rustfmt](https://github.com/rust-lang-nursery/rustfmt). If these tools | 371 | [RLS](https://github.com/rust-lang-nursery/rls) and |
372 | [rustfmt](https://github.com/rust-lang-nursery/rustfmt). If these tools | ||
372 | break because of your changes, you may run into a sort of "chicken and egg" | 373 | break because of your changes, you may run into a sort of "chicken and egg" |
373 | problem. Both tools rely on the latest compiler to be built so you can't update | 374 | problem. These tools rely on the latest compiler to be built so you can't update |
374 | them until the changes you are making to the compiler land. In the meantime, you | 375 | them to reflect your changes to the compiler until those changes are merged into |
375 | can't land your changes to the compiler because the build won't pass until those | 376 | the compiler. At the same time, you can't get your changes merged into the compiler |
376 | tools are fixed. | 377 | because the rust-lang/rust build won't pass until those tools build and pass their |
378 | tests. | ||
377 | 379 | ||
378 | That means that, in the default state, you can't update the compiler without | 380 | That means that, in the default state, you can't update the compiler without first |
379 | fixing rustfmt and rls first. | 381 | fixing rustfmt, rls and the other tools that the compiler builds. |
380 | 382 | ||
381 | When this happens, follow these steps: | 383 | Luckily, a feature was [added to Rust's build](https://github.com/rust-lang/rust/pull/45243) |
384 | to make all of this easy to handle. The idea is that you mark the tools as "broken", | ||
385 | so that the rust-lang/rust build passes without trying to build them, then land the change | ||
386 | in the compiler, wait for a nightly, and go update the tools that you broke. Once you're done | ||
387 | and the tools are working again, you go back in the compiler and change the tools back | ||
388 | from "broken". | ||
382 | 389 | ||
383 | 1. First, if it doesn't exist already, create a `config.toml` by copying | 390 | This should avoid a bunch of synchronization dances and is also much easier on contributors as |
391 | there's no need to block on rls/rustfmt/other tools changes going upstream. | ||
392 | |||
393 | Here are those same steps in detail: | ||
394 | |||
395 | 1. (optional) First, if it doesn't exist already, create a `config.toml` by copying | ||
384 | `config.toml.example` in the root directory of the Rust repository. | 396 | `config.toml.example` in the root directory of the Rust repository. |
385 | Set `submodules = false` in the `[build]` section. This will prevent `x.py` | 397 | Set `submodules = false` in the `[build]` section. This will prevent `x.py` |
386 | from resetting to the original branch after you make your changes. If you | 398 | from resetting to the original branch after you make your changes. If you |
387 | need to [update any submodules to their latest versions][updating-submodules], | 399 | need to [update any submodules to their latest versions][updating-submodules], |
388 | see the section of this file about that for more information. | 400 | see the section of this file about that for more information. |
389 | 2. Run `./x.py test src/tools/rustfmt`. Fix any errors in the submodule itself | 401 | 2. (optional) Run `./x.py test src/tools/rustfmt` (substituting the submodule |
390 | (the `src/tools/rustfmt` directory) until it works. | 402 | that broke for `rustfmt`). Fix any errors in the submodule (and possibly others). |
391 | 3. Run `./x.py test src/tools/rls`. Fix any errors in the submodule itself | 403 | 3. (optional) Make commits for your changes and send them to upstream repositories as a PR. |
392 | (the `src/tools/rls` directory) until it works. | 404 | 4. (optional) Maintainers of these submodules will **not** merge the PR. The PR can't be |
393 | 4. Make a commit for `rustfmt`, if necessary, and send a PR to the master | 405 | merged because CI will be broken. You'll want to write a message on the PR referencing |
394 | branch of rust-lang-nursery/rustfmt | 406 | your change, and how the PR should be merged once your change makes it into a nightly. |
395 | 5. Do the same, if necessary for the RLS | 407 | 5. Update `src/tools/toolstate.toml` to indicate that the tool in question is "broken", |
396 | 6. A maintainer of rls/rustfmt will **not** merge the PR. The PR can't be | 408 | that will disable building it on CI. See the documentation in that file for the exact |
397 | merged because CI will be broken. Instead a new branch will be created, | 409 | configuration values you can use. |
398 | and the PR will be pushed to the branch (the PR is left open) | 410 | 6. Commit the changes to `src/tools/toolstate.toml`, **do not update submodules in your commit**, |
399 | 7. On your branch, update the rls/rustfmt submodules to these branches | 411 | and then update the PR you have for rust-lang/rust. |
400 | 8. Commit the changes, update your PR to rust-lang/rust | 412 | 7. Wait for your PR to merge. |
401 | 9. Wait for the branch to merge | 413 | 8. Wait for a nightly |
402 | 10. Wait for a nightly | 414 | 9. (optional) Help land your PR on the upstream repository now that your changes are in nightly. |
403 | 11. A maintainer of rls/rustfmt will merge the original PRs to rls/rustfmt | 415 | 10. (optional) Send a PR to rust-lang/rust updating the submodule, reverting `src/tools/toolstate.toml` back to a "building" or "testing" state. |
404 | 12. Eventually the rls/rustfmt submodules will get re-updated back to the | ||
405 | master branch | ||
406 | 416 | ||
407 | #### Updating submodules | 417 | #### Updating submodules |
408 | [updating-submodules]: #updating-submodules | 418 | [updating-submodules]: #updating-submodules |