diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3dd10f9bee..cd2dd5e44c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,5 @@ +# Contributing + ## Intro This article goes into detail about multiple areas of interest to contributors, @@ -44,14 +46,75 @@ The `./test_all` script will use docker containers to run all tests for crosvm. For more details on using the docker containers for running tests locally, including faster, iterative test runs, see `ci/README.md`. -### Submitting Code +### Style guidelines -See also, -[Chrome OS Contributing Guide](https://chromium.googlesource.com/chromiumos/docs/+/HEAD/contributing.md) +To format all code, crosvm defers to rustfmt. In addition, the code adheres to +the following rules: -Once your change is reviewed by a crosvm -[owner](https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/crosvm/OWNERS) -it will need to go through two layers of presubmit checks. +The `use` statements for each module should be grouped in this order + +1. `std` +2. third-party crates +3. chrome os crates +4. crosvm crates +5. `crate` + +crosvm uses the [remain](https://github.com/dtolnay/remain) crate to keep error +enums sorted, along with the `#[sorted]` attribute to keep their corresponding +match statements in the same order. + +## Submitting Code + +Since crosvm is one of Chromium OS projects, please read through +[Chrome OS Contributing Guide] first. This section describes the crosvm-specific +workflow. + +[Chrome OS Contributing Guide]: https://chromium.googlesource.com/chromiumos/docs/+/HEAD/contributing.md + +### Creating a CL + +We use [Chromium Gerrit](https://chromium-review.googlesource.com/) for code +reviewing. All crosvm CLs are listed at the [crosvm component]. + +> Note: We don't accept any pull requests on the [GitHub mirror]. + +[Chromium Gerrit]: https://chromium-review.googlesource.com +[crosvm component]: https://chromium-review.googlesource.com/q/project:chromiumos%252Fplatform%252Fcrosvm +[GitHub mirror]: https://github.com/google/crosvm + +#### For Chromium OS Developers + +If you have already set up the `chromiumos` repository and the `repo` command, +you can simply create and upload your CL in the same way as other Chromium OS +projects. + +#### For non-Chromium OS Developers + +If you are not interested in other Chromium OS components, you can simply clone +and contribute crosvm only. Before you make a commit locally, please set up +[Gerrit's Change-Id hook] on your system. + +[Gerrit's Change-Id hook]: https://gerrit-review.googlesource.com/Documentation/user-changeid.html + +```bash +$ git clone https://chromium.googlesource.com/chromiumos/platform/crosvm +# Modify code and make a git commit with a commit message following this rule: +# https://chromium.googlesource.com/chromiumos/docs/+/HEAD/contributing.md#Commit-messages +$ git commit +# Push your commit to Chromium Gerrit (https://chromium-review.googlesource.com/). +$ git push origin HEAD:refs/for/main +``` + +### Code review + +Your change must be reviewed and approved by one of [crosvm owners]. + +[crosvm owners]: https://chromium.googlesource.com/chromiumos/platform/crosvm/+/HEAD/OWNERS + +### Presubmit checking + +Once your change is reviewed, it will need to go through two layers of presubmit +checks. The review will trigger Kokoro to run crosvm specific tests. If you want to check kokoro results before a review, you can set 'Commit Queue +1' in gerrit to @@ -77,20 +140,3 @@ Failures here will cause the commit queue to reject the change until it is re-added (CQ+2). Unfortunately, it is extremely common for false negatives to cause a change to get rejected, so be ready to re-apply the CQ+2 label if you're the owner of a ready to submit change. - -### Style guidelines - -To format all code, crosvm defers to rustfmt. In addition, the code adheres to -the following rules: - -The `use` statements for each module should be grouped in this order - -1. `std` -2. third-party crates -3. chrome os crates -4. crosvm crates -5. `crate` - -crosvm uses the [remain](https://github.com/dtolnay/remain) crate to keep error -enums sorted, along with the `#[sorted]` attribute to keep their corresponding -match statements in the same order. diff --git a/docs/book/src/contributing.md b/docs/book/src/contributing.md index 3cac78018d..9cdba4c602 100644 --- a/docs/book/src/contributing.md +++ b/docs/book/src/contributing.md @@ -1,3 +1 @@ -# Contributing - {{#include ../../../CONTRIBUTING.md}}