blob: 1b16bf60475092736e68c25b04f449b136ab9dcb [file] [log] [blame] [view]
Daniel Cheng86135f32019-02-27 07:10:381# Contributing to Chromium
2
3This page assumes a working Chromium [checkout and build][checkout-and-build].
4Note that a full Chromium checkout includes external repositories with their
5own workflows for contributing, such as [v8][v8-dev-guide] and
6[Skia][skia-dev-guide]. Similarly, ChromiumOS, which includes Chromium as a
7subrepository, has its own [development workflow][cros-dev-guide].
8
9[TOC]
10
11## Related resources
12
13- [Life of a Chromium Developer][life-of-a-chromium-developer], which is mostly
14 up-to-date.
Toby Huang5105f812019-08-08 23:47:5715- [Tutorial][noms-tutorial] by committer emeritus [email protected].
16- [Commit Checklist][commit-checklist], a useful checklist to go through before
17 submitting each CL on Gerrit.
Daniel Cheng86135f32019-02-27 07:10:3818
19## Communicate
20
21When writing a new feature or fixing an existing bug, get a second opinion
22before going too far. If it's a new feature idea, propose it to the appropriate
23[discussion group][discussion-groups]. If it's in the existing code base, talk
24to some of the folks in the "OWNERS" file (see [code review
25policies][code-reviews] for more) for the code being changed.
26
27- If a change needs further context outside the CL, it should be tracked in the
28 [bug system][crbug]. Bugs are the right place for long histories, discussion
29 and debate, attaching screenshots, and linking to other associated bugs. Bugs
30 are unnecessary for changes isolated enough to need none of these.
31- If there isn't a bug and there should be one, please [file a new
32 bug][crbug-new].
33- Just because there is a bug in the bug system doesn't necessarily mean that a
34 patch will be accepted.
35
John Abd-El-Malek27e1cf02019-12-18 17:35:1836## Design Documents
37Any nontrivial technical effort that will significantly impact Chromium should
38have a design doc ([template][design-doc-template]). Specifically, we require
39design docs in the following cases:
40- When writing code that will have a large impact on Chromium as a whole, e.g.
41 when you are changing code in Chromium's critical path (page loading,
42 rendering).
43- When beginning a large technical undertaking that should be documented for
44 historical reasons (>1 person-month of work can be used as a general guideline).
45
46Send public design docs to
47[[email protected]][chromium-design-docs]. Google internal Chrome
48design docs should follow the process at
49[go/chrome-dd-review-process][chrome-dd-review-process].
50
Daniel Cheng86135f32019-02-27 07:10:3851## Legal stuff
52
Dirk Prankeb12d67032022-01-13 17:19:2153All contributors must have valid Gerrit/Google accounts (which means you must
54be [old enough to manage your own
55account](https://support.google.com/accounts/answer/1350409)) and complete the
56contributor license agreement.
57
58For individual contributors, please complete the [Individual Contributor License
Daniel Cheng86135f32019-02-27 07:10:3859Agreement][individual-cla] online. Corporate contributors must fill out the
60[Corporate Contributor License Agreement][corporate-cla] and send it to us as
61described on that page.
62
63### First-time contributors
64
65Add your (or your organization's) name and contact info to the AUTHORS file for
66[Chromium][cr-authors] or [Chromium OS][cros-authors]. Please include this as
67part of your first patch and not as a separate standalone patch.
68
69### External contributor checklist for reviewers
70
71Before LGTMing a change from a non-chromium.org address, ensure that the
72contribution can be accepted:
73
74- Definition: The "author" is the email address that owns the code review
75 request on <https://chromium-review.googlesource.com>
76- Ensure the author is already listed in [AUTHORS][cr-authors]. In some cases, the
77 author's company might have a wildcard rule (e.g. \*@google.com).
78- If the author or their company is not listed, the CL should include a new
79 AUTHORS entry.
80 - Ensure the new entry is reviewed by a reviewer who works for Google.
Vincent Scheib04582d842020-04-24 18:41:3681 - Contributor License Agreement can be verified by Googlers at http://go/cla.
Daniel Cheng86135f32019-02-27 07:10:3882 - If there is a corporate CLA for the author's company, it must list the
83 person explicitly (or the list of authorized contributors must say
84 something like "All employees"). If the author is not on their company's
85 roster, do not accept the change.
86
87## Initial git setup
88
Allen Li14a38882025-03-24 21:01:13891. Set up [Gerrit access](gerrit_guide.md).
Daniel Cheng86135f32019-02-27 07:10:38902. Tell git about your name, email and some other settings.
91 ```
92 git config --global user.name "My Name"
93 git config --global user.email "[email protected]"
94 git config --global core.autocrlf false
95 git config --global core.filemode false
96 git config --local gerrit.host true
97 # Uncomment this if you want your pull commands to always rebase.
98 # git config --global branch.autosetuprebase always
99 # Uncomment if you want new branches to track the current branch.
100 # git config --global branch.autosetupmerge always
101 ```
Francois Marier197916f2020-01-16 02:23:021023. Visit <https://chromium-review.googlesource.com/settings/> to ensure that
103 your preferred email is set to the same one you use in your git
104 configuration.
Daniel Cheng86135f32019-02-27 07:10:38105
106## Creating a change
107
108First, create a new branch for your change in git. Here, we create a branch
Emily Stark84d57192021-05-14 18:58:25109called `mychange` (use whatever name you want here), with `origin/main` as
Daniel Cheng86135f32019-02-27 07:10:38110the upstream branch.
111
112```
Emily Stark84d57192021-05-14 18:58:25113git checkout -b mychange -t origin/main
Daniel Cheng86135f32019-02-27 07:10:38114```
115
116Write and test your change.
117
118- Conform to the [style guide][cr-styleguide].
119- Include tests.
120- Patches should be a reasonable size to review. Review time often increases
Joshua Berenhaus98d2fbc2020-01-07 18:50:42121 exponentially with patch size.
Daniel Cheng86135f32019-02-27 07:10:38122
123Commit your change locally in git:
124
125```
126git commit -a
127```
128
129If you are not familiar with `git`, GitHub's [resources to learn
130git][github-tutorial] is useful for the basics. However, keep in mind that the
131Chromium workflow is not the same as the GitHub pull request workflow.
132
133## Uploading a change for review
134
Peter Kasting60d30282024-08-23 06:22:58135Note: If your change is to a dependent project, see the documentation on
136[changing dependencies](dependencies.md#changing-dependencies). Otherwise, go
137through the [commit checklist][commit-checklist] for Chromium before uploading a
138change for review.
Toby Huang5105f812019-08-08 23:47:57139
Daniel Cheng86135f32019-02-27 07:10:38140Chromium uses a Gerrit instance hosted at
141<https://chromium-review.googlesource.com> for code reviews. In order to upload
142your local change to Gerrit, use `git-cl` from
143[depot\_tools][depot-tools-setup] to create a new Gerrit change, based on the
144diff between the current branch and its upstream branch:
145
146```
147git cl upload
148```
149
150This will open a text editor to create a description for the new change. This
151description will be used as the commit message when the change is landed in the
152Chromium tree. Descriptions should be formatted as follows:
153
154```
155Summary of change (one line)
156
157Longer description of change addressing as appropriate: why the change
158is made, context if it is part of many changes, description of previous
159behavior and newly introduced differences, etc.
160
161Long lines should be wrapped to 72 columns for easier log message
162viewing in terminals.
163
164Bug: 123456
165```
166
167A short subject and a blank line after the subject are crucial: `git` uses this
168as a heuristic for tools like `git log --oneline`. Use the bug number from the
Kalvin Lee23598832020-07-22 07:36:28169[issue tracker][crbug] (see more on [CL footer syntax](#cl-footer-reference)).
170Also see [How to Write a Git Commit Message][good-git-commit-message], which
171has more in-depth tips for writing a good commit description.
Daniel Cheng86135f32019-02-27 07:10:38172
173### Chromium-specific description tips
174
175- Links to previous CLs should be formatted as `https://crrev.com/c/NUMBER`,
Kalvin Lee313a7f22022-08-22 08:20:45176 which is slightly shorter than <https://chromium-review.googlesource.com>.
Daniel Cheng86135f32019-02-27 07:10:38177
178- If there are instructions for testers to verify the change is correct,
179 include them with the `Test:` tag:
180
181 ```
182 Test: Load example.com/page.html and click the foo-button; see
183 crbug.com/123456 for more details.
184 ```
185
186After saving the change description, `git-cl` runs some presubmit scripts to
187check for common errors. If everything passes, `git-cl` will print something
188like this:
189
190```
191remote: SUCCESS
192remote:
193remote: New Changes:
194remote: https://chromium-review.googlesource.com/c/chromium/src/+/1485699 Use base::TimeDelta::FromTimeSpec helper in more places. [WIP]
195```
196
197Additional flags can be used to specify reviewers, bugs fixed by the change, et
198cetera:
199
200```
201git cl upload -r [email protected],[email protected] -b 123456
202```
203
204See `git cl help upload` for a full list of flags.
205
Andrea Orru771255242023-02-27 02:41:28206### Uploading dependent changes
207
208If you wish to work on multiple related changes without waiting for
209them to land, you can do so in Gerrit using dependent changes.
210
211To put this into an example, let‘s say you have a commit for feature A
212and this is in the process of being reviewed on Gerrit. Now let’s say
213you want to start more work based on it before it lands on main.
214
Svend Larsene82469322025-01-24 16:47:06215Gerrit has the concept of a “relation chain”. For our example above, we want to
216create a relation chain where the feature A change is the parent of the feature
217B change. Once we create the relation chain, the Gerrit review view for change B
218will show the diff vs. change A, rather than vs. the main branch.
219
220To create a relation chain, upload a change that has an upstream branch
221associated with the parent CL. The steps to do so are slightly different when
222you own the parent change vs. when someone else owns the parent change.
223
224#### When you own the parent change
225
226Using the example of features A and B above, if you own the change for feature A
227and you want to upload a dependent change for feature B:
228
Andrea Orru771255242023-02-27 02:41:28229```
230git checkout featureA
231git checkout -b featureB
232git branch --set-upstream-to featureA
233# ... edit some files
234# ... git add ...
235git commit
236git cl upload
237```
238
Svend Larsene82469322025-01-24 16:47:06239#### When someone else owns the parent change
240
241If someone else owns the change for feature A:
242
243```
244# First, open the change for feature A in Gerrit -> "Download patch" -> copy and
245# run "Branch" command. Then, starting from the branch that command created:
246git cl patch --force <parent-CL-number>
247git checkout -b featureB
248git branch --set-upstream-to change-<parent-CL-number>
249# ... edit some files
250# ... git add ...
251git commit
252git cl upload
253```
254
255Note that, after running `git cl patch --force <parent-CL-number>`, if you
256upload changes from branch `change-<parent-CL-number>`, you will upload a new
257patchset to the original author's change.
258
259If the other author uploads a new patchset to the change your change depends on,
260you can update your local copy of their change by running:
261
262```
263git checkout change-<parent-CL-number>
264git fetch origin [sha hash for latest patchset] && git reset --hard FETCH_HEAD
265```
Andrea Orru771255242023-02-27 02:41:28266
Vincent Scheib66fc2d42024-10-30 02:55:03267## Code review {#code-review}
Daniel Cheng86135f32019-02-27 07:10:38268
Vincent Scheib66fc2d42024-10-30 02:55:03269This section describes the mechanics and process of code reviews. See also:
270- [Code review policies](code_reviews.md) page for committer, OWNERS, and other
271rules
272- [Code of conduct](../CODE_OF_CONDUCT.md)
273- [Respectful Changes](cl_respect.md)
274- [Respectful Code Reviews](cr_respect.md)
Daniel Cheng86135f32019-02-27 07:10:38275
276### Finding a reviewer
277
Ramzi Nbe25013d2023-11-02 00:47:53278Please note here that a "reviewer" in this context is someone that not
279only provides comment on the CL but also someone who can approve the
Erik Staab2e34edb2024-02-23 18:39:40280submission by providing a "Code-Review +1".
Daniel Cheng86135f32019-02-27 07:10:38281
Ramzi Nbe25013d2023-11-02 00:47:53282Reviewers must be [committers](https://www.chromium.org/getting-involved/become-a-committer/).
283Ideally they should be committers who are familiar with the area of code
284in question. If you're not sure who these should be, check with anyone in
285the nearest ancestor OWNERS file.
286
287- There must be at least one owner for each affected directory.
288- If there are multiple reviewers, make it clear what each reviewer is
289expected to review.
290- `git cl owners` automatically suggests reviewers based on the OWNERS
291files.
Daniel Cheng86135f32019-02-27 07:10:38292
Devlin Croninefe2e5872020-05-06 16:34:57293_Note:_ By default, please only select one reviewer for each file (that is, a
294single reviewer may review multiple files, but typically each file only needs
295to be reviewed by one person). It can be tempting to add multiple reviewers so
296that "whoever gets to it first" can review, but this has two common failure
297modes:
298- Reviewer Alpha and Beta both review the CL, resulting in duplicate effort.
299- Out of fear of the above failure case, neither reviewer Alpha nor Beta review
300 the CL.
301
302There are times when requesting multiple reviewers for the same file may be
303desirable - such as when the code is particularly complicated, or when the file
304uses multiple systems and a perspective from each is valuable. In this case,
305please make it explicit that you would like both reviewers to review.
306
Ramzi Nbe25013d2023-11-02 00:47:53307Submissions to the chromium/src repository by a change contributor who is
Erik Staab2e34edb2024-02-23 18:39:40308not a Chromium committer will require two committers to "Code-Review +1" the
Ramzi Nbe25013d2023-11-02 00:47:53309submissions. If the owner of the CL is already a committer, then only one
Erik Staab2e34edb2024-02-23 18:39:40310other committer is needed to "Code-Review +1".
Ramzi Nbe25013d2023-11-02 00:47:53311
Daniel Cheng86135f32019-02-27 07:10:38312### Requesting review
313
314Open the change on [the web][crrev]. If you can't find the link, running `git
315cl issue` will display the review URL for the current branch. Alternatively,
316visit <https://chromium-review.googlesource.com> and look in the "Outgoing
317Reviews" section.
318
319Reviewers expect to review code that compiles and passes tests. If you have
320access, now is a good time to run your change through the [automated
321tests](#running-automated-tests).
322
Avi Drissmand8dac6952024-12-04 15:49:34323Click the big blue **Start Review** button near the top of the page. (If you are
324not signed in, the button will instead say "Sign In", so click it to sign in.)
325An in-page dialog will appear, and there will be a **Reviewers** field in which
326you can specify reviewers for the change. To the right of the field, in the
327upper-right of the in-page dialog, will be a link titled "Suggest Owners" which,
328when clicked, will suggest owners relevant to your change. Unless you have a
329specific reason not to, it is recommended to click it and rely on its suggestion
330of owners.
Daniel Cheng86135f32019-02-27 07:10:38331
332In the same dialog, you can include an optional message to your reviewers. This
Avi Drissmand8dac6952024-12-04 15:49:34333space can be used for specific questions or instructions. Once you're done, make
334sure to click **Send and Start Review**, which notifies the requested reviewers
335that they should review your change.
Daniel Cheng86135f32019-02-27 07:10:38336
Avi Drissmand8dac6952024-12-04 15:49:34337**⚠️ Be sure to click the "Send and Start Review" button as NO ONE WILL LOOK AT
338YOUR CHANGE UNTIL YOU DO SO ⚠️**
Daniel Cheng86135f32019-02-27 07:10:38339
340### Review process
341
342All changes must be reviewed (see [code review policies][code-reviews]).
343
344You should get a response within **one** business day; re-ping your reviewers
345if you do not.
346
347To upload new patch sets that address comments from the reviewers, simply
348commit more changes to your local branch and run `git cl upload` again.
349
350### Approval
351
352When the reviewer is happy with the change, they will set the "Code-Review +1"
353label. Owners of all affected files must approve before a change can be
354committed. See: [code review policies: owners][code-reviews-owners].
355
Erik Staab3d5a4b992024-03-20 16:33:57356All code review comments must be marked resolved before a CL can be committed.
357In some cases a reviewer may give "Code-Review +1" with some additional
358comments. These should be addressed and responded to, or at least acknowledged
359with the ACK button to resolve them. If you cannot resolve all comments an
360override is provided through an "Unresolved-Comment-Reason:" stanza in your
361commit message.
362
Devlin Cronin6a484822025-02-05 16:41:14363### Code Review Votes
364
365Submitting a CL requires different approvals depending on whether the author
366[is a committer][becoming-a-committer] and on the affected files.
367
368There are two types of approvals:
369* Code-Review approvals. These are CL-wide and can be granted by any committer
370 (other than the author themselves). Committers need one Code-Review +1
371 approval; non-committers require two separate Code-Review +1 approvals.
372* Code-Owners approvals. Files have different owners, which are specified in the
373 `OWNERS` files. Every file requires either an owner to +1 the CL or for the
374 author to be an OWNER of the file.
375
376#### Copying Votes to New Patch Sets
377
378When a new patch set is uploaded, approvals may be removed (in order to prevent
379someone from landing significantly different unreviewed code after getting
380approval in a previous patch set).
381
382Approvals may be copied between patch sets in some situations.
383* Code-Review approvals will be copied between patch sets if:
384 * It is a trivial rebase (as detected by Gerrit),
385 * It is a commit message change, or
386 * The author is a committer *and* the list of modified files has not changed
387 (for non-committers, any code change will result in loss of Code-Review
388 approvals).
389* Code-Owners approvals are *always* copied between patch sets (even if the
390 reviewer's +1 is no longer shown in Gerrit).
391
392If a patch set loses its approvals, these will need to be re-added before the
Devlin Cronin672902a2025-02-11 20:37:26393patch set can be committed (one +1 for committers, two +1s for non-committers).
Devlin Cronin6a484822025-02-05 16:41:14394
Daniel Cheng86135f32019-02-27 07:10:38395## Running automated tests
396
397Before being submitted, a change must pass the commit queue (CQ). The commit
398queue is an automated system which sends a patch to multiple try bots running
399different platforms: each try bot compiles Chromium with the patch and ensures
400the tests still pass on that platform.
401
402To trigger this process, click **CQ Dry Run** in the upper right corner of the
403code review tool. Note that this is equivalent to setting the "Commit-Queue +1"
404label. Anyone can set this label; however, the CQ will not process the patch
405unless the person setting the label has [try job access][try-job-access].
406
407If you don't have try job access and:
408
409- you have an @chromium.org email address, request access for yourself.
410- you have contributed a few patches, ask a reviewer to nominate you for access.
411- neither of the above is true, request that a reviewer run try jobs for you in
412 the code review request message.
413
414The status of the latest try job for a given patchset is visible just below the
415list of changed files. Each bot has its own bubble, using one of the following
416colors to indicate its status:
417
418- Gray: the bot has not started processing the patch yet.
419- Yellow: the run is in progress. Check back later!
420- Purple: the trybot encountered an exception while processing the patch.
421 Usually, this is not the fault of the patch. Try clicking **CQ Dry Run**
422 again.
423- Red: tests failed. Click on the failed bot to see what tests failed and why.
424- Green: the run passed!
425
426## Committing
427
Erik Staab2e34edb2024-02-23 18:39:40428Changes are committed via the [commit queue][commit-queue].
Daniel Cheng86135f32019-02-27 07:10:38429This is done by clicking **Submit to CQ** in the upper right corner, or setting
430the "Commit-Queue +2" label on the change. The commit queue will then
431send the patch to the try bots. If all try bots return green, the change will
432automatically be committed. Yay!
433
434Sometimes a test might be flaky. If you have an isolated failure that appears
435unrelated to your change, try sending the change to the commit queue again.
436
Erik Staab2e34edb2024-02-23 18:39:40437In emergencies, a developer with commit access can [directly
438commit][direct-commit] a change, bypassing the commit queue and all safety nets.
Daniel Cheng86135f32019-02-27 07:10:38439
Ben Pastene893979e2022-10-06 17:22:55440## Relanding a change
441
442Occasionally changes that pass the [commit queue][commit-queue] and get
443submitted into Chromium will later be reverted. If this happens to your change,
444don't be discouraged! This can be a common part of the Chromium development
445cycle and happens for a variety of reasons, including a conflict with an
446unanticipated change or tests not covered on the commit queue.
447
448If this happens to your change, you're encouraged to pursue a reland. When doing
449so, following these basic steps can streamline the re-review process:
450- **Create the reland**: Click the `CREATE RELAND` button on the original change
451 in Gerrit. This will create a new change whose diff is identical to the
452 original, but has a small paper-trail in the commit message that leads back to
453 the original. This can be useful for sheriffs when debugging regressions.
454- **Append the fix**: If the reland requires file modifications not present in
455 the original change, simply upload these fixes in a subsequent patchset to the
456 reland change. By comparing the first patchset with the latest, this gives
457 reviewers the ability to see the diff of _just_ the reland fix.
458- **Describe the fix**: In the commit message of the reland change, briefly
459 summarize what's changed that makes relanding again safe. Explanations can
460 include: "included needed fix", "disabled failing tests", "crash was fixed
461 elsewhere". Specifically for that last case: if the reland change is identical
462 to the original and the reland fix was handled separately in a preceding
463 change, make sure to link to that change in the commit message of the reland.
464
Darin Fisher0e196ee82019-09-06 22:39:12465## Code guidelines
466
467In addition to the adhering to the [styleguide][cr-styleguide], the following
468general rules of thumb can be helpful in navigating how to structure changes:
469
Darin Fisherf061fb12019-11-15 23:46:13470- **Code in the Chromium project should be in service of other code in the
471 Chromium project.** This is important so developers can understand the
472 constraints informing a design decision. Those constraints should be apparent
473 from the scope of code within the boundary of the project and its various
Peter Kasting54275102022-06-16 21:00:17474 repositories. In general, for each line of code, you should be able to find a
475 product in the Chromium repositories that depends on that line of code or else
476 the line of code should be removed.
Darin Fisher0e196ee82019-09-06 22:39:12477
Peter Kastingbeb265c2024-10-31 20:22:56478 When you are adding support for a new OS, architecture, compiler/STL
479 implementation, platform, or simply a new top-level directory, please send an
480 email to [email protected] and get approval. For long-term maintenance
Kentaro Harac196ba12022-09-26 07:57:33481 reasons, we will accept only things that are used by the Chromium project
482 (including Chromium-supported projects like V8 and Skia) and things whose
483 benefit to Chromium outweighs any cost increase in maintaining Chromium's
Peter Kastingbeb265c2024-10-31 20:22:56484 supported toolchains, architectures, and platforms (e.g. adding one ifdef
485 branch for an unsupported architecture has negligible cost and is likely fine,
Kentaro Harac196ba12022-09-26 07:57:33486 but introducing new abstractions or changes to higher level directories has
487 a high cost and would need to provide Chromium with corresponding benefit).
Peter Kastingbeb265c2024-10-31 20:22:56488 See the [documentation on toolchain support](toolchain_support.md) for more
489 details. Note that an unsupported configuration will not have bots on
Kentaro Harac196ba12022-09-26 07:57:33490 Google-managed waterfalls (even FYI bots) or maintained by Chromium
491 developers. Please use existing ifdef branches as much as possible.
Dirk Prankebfd0b6e2020-06-16 23:09:53492
Darin Fisher0e196ee82019-09-06 22:39:12493- **Code should only be moved to a central location (e.g., //base) when
494 multiple consumers would benefit.** We should resist the temptation to
495 build overly generic common libraries as that can lead to code bloat and
496 unnecessary complexity in common code.
497
498- **The code likely wasn't designed for everything we are trying to do with it
499 now.** Take time to refactor existing code to make sure the new feature or
500 subcomponent you are developing fits properly within the system. Technical
501 debt is easy to accumulate and is everyone's responsibility to avoid.
502
503- **Common code is everyone's responsibility.** Large files that are at the
504 cross-roads of many subsystems, where integration happens, can be some of the
505 most fragile in the system. As a companion to the previous point, be
506 cognizant of how you may be adding more complexity to the commons as you
507 venture to complete your task.
508
509- **Changes should include corresponding tests.** Automated testing is at the
510 heart of how we move forward as a project. All changes should include
511 corresponding tests so we can ensure that there is good coverage for code and
512 that future changes will be less likely to regress functionality. Protect
513 your code with tests!
514
Darin Fisher943fdf992020-10-29 18:02:50515- **Stick to the current set of supported languages as described in the
516 [styleguide][cr-styleguide].** While there is likely always a slightly better
517 tool for any particular job, maintainability of the codebase is paramount.
518 Reducing the number of languages eases toolchain and infrastructure
519 requirements, and minimizes the learning hurdles for developers to be
520 successful contributing across the codebase. Additions of new languages must
Takuto Ikuta9bc7d4ef2023-01-06 17:55:45521 be approved by [//ATL_OWNERS](../ATL_OWNERS).
Darin Fisher943fdf992020-10-29 18:02:50522
Kentaro Haradd8f7d702022-05-18 15:45:51523- **When your team is making API changes or migrating between services, the
524 team mandating the change needs to do at least 80% of the work.** The
525 rationale is to reduce externalities by having the team that requires a
526 change spend the vast majority of the time required to make it happen.
527 This naturally encourages designing to minimize the cost of change, be it
528 through automation, tooling, or pooled centralized expertise. You can find
529 more detailed rationale in [this doc](https://docs.google.com/document/d/1elJisUpOb3h4-7WA4Wn754nzfgeCJ4v2kAFvMOzNfek/edit#)
530 (Google internal). If you need an exception or help, please contact
531 [email protected].
532
Daniel Cheng86135f32019-02-27 07:10:38533## Tips
534
Dominik Röttschesd113bfa2019-07-10 08:56:24535### Review etiquette
536
Daniel Cheng86135f32019-02-27 07:10:38537During the lifetime of a review, you may want to rebase your change onto a newer
538source revision to minimize merge conflicts. The reviewer-friendly way to do
539this is to first address any unresolved comments and upload those changes as a
540patchset. Then, rebase to the newer revision and upload that as its own
541patchset (with no other changes). This makes it easy for reviewers to see the
542changes made in response to their comments, and then quickly verify the diffs
543from the rebase.
544
545Code authors and reviewers should keep in mind that Chromium is a global
546project: contributors and reviewers are often in time zones far apart. Please
547read these guidelines on [minimizing review lag][review-lag] and take them in
548consideration both when writing reviews and responding to review feedback.
549
Dominik Röttschesd113bfa2019-07-10 08:56:24550### Watchlists
551
552If you would like to be notified about changes to a set of files covering a
553topic or an area of Chromium, you may use the [watchlists][watchlist-doc]
554feature in order to receive email notifications.
555
Kalvin Lee23598832020-07-22 07:36:28556## Appendix: CL footer reference {#cl-footer-reference}
557
558Chromium stores a lot of information in footers at the bottom of commit
559messages. With the exception of `R=`, these footers are only valid in the
560last paragraph of a commit message; any footers separated from the last
561line of the message by whitespace or non-footer lines will be ignored.
562This includes everything from the unique `Change-Id` which identifies a
563Gerrit change, to more useful metadata like bugs the change helps fix,
564trybots which should be run to test the change, and more. This section
565includes a listing of well-known footers, their meanings, and their
566formats.
567
568* **Bug:**
569 * A comma-separated list of bug references.
570 * A bug reference
571 * can be a bare number, e.g. `Bug: 123456`, or
572 * can specify a project and a number, e.g. `Bug: skia:1234`.
573 * On chromium-review, the default project is assumed to be `chromium`,
574 so all bugs in non-chromium projects on bugs.chromium.org should be
575 qualified by their project name.
576 * The Google-internal issue tracker is accessible by using the `b:`
577 project prefix.
578* **Fixed:** The same as `Bug:`, but will automatically close the
579 bug(s) as fixed when the CL lands.
580* **R=**
581 * This footer is _deprecated_ in the Chromium project; it was
582 deprecated when code review migrated to Gerrit. Instead, use
583 `-r [email protected]` when running `git cl upload`.
584 * A comma-separated list of reviewer email addresses (e.g.
585 [email protected], [email protected]).
Kalvin Lee23598832020-07-22 07:36:28586* **Cq-Include-Trybots:**
587 * A comma-separated list of trybots which should be triggered and
588 checked by the CQ in addition to the normal set.
L. David Baron08adb302021-12-13 14:23:43589 * Trybots are indicated in `bucket:builder` format (e.g.
590 `luci.chromium.try:android-asan`).
591 * The "Choose Tryjobs" UI in the "Checks" tab in Gerrit shows (and has
592 a button to copy) the Cq-Include-Trybots syntax for the currently
593 selected tryjobs.
Kalvin Lee23598832020-07-22 07:36:28594* **No-Presubmit:**
595 * If present, the value should always be the string `true`.
596 * Indicates to the CQ that it should not run presubmit checks on the CL.
597 * Used primarily on automated reverts.
598* **No-Try:**
599 * If present, the value should always be the string `true`.
600 * Indicates to the CQ that it should not start or check the results of
601 any tryjobs.
602 * Used primarily on automated reverts.
603* **No-Tree-Checks:**
604 * If present, the value should always be the string `true`.
605 * Indicates to the CQ that it should ignore the tree status and submit
606 the change even to a closed tree.
607 * Used primarily on automated reverts.
608* **Test:**
609 * A freeform description of manual testing performed on the change.
610 * Not necessary if all testing is covered by trybots.
611* **Reviewed-by:**
612 * Automatically added by Gerrit when a change is submitted.
613 * Lists the names and email addresses of the people who approved
614 (set the `Code-Review` label on) the change prior to submission.
615* **Reviewed-on:**
616 * Automatically added by Gerrit when a change is submitted.
617 * Links back to the code review page for easy access to comment and
618 patch set history.
619* **Change-Id:**
620 * Automatically added by `git cl upload`.
621 * A unique ID that helps Gerrit keep track of commits that are part of
622 the same code review.
623* **Cr-Commit-Position:**
624 * Automatically added by the git-numberer Gerrit plugin when a change
625 is submitted.
626 * This is of the format `fully/qualified/ref@{#123456}` and gives both
627 the branch name and "sequence number" along that branch.
628 * This approximates an SVN-style monotonically increasing revision
629 number.
630* **Cr-Branched-From:**
631 * Automatically added by the git-numberer Gerrit plugin on changes
Emily Stark84d57192021-05-14 18:58:25632 which are submitted to non-main branches.
633 * Aids those reading a non-main branch history in finding when a
634 given commit diverged from main.
Dominik Röttschesd113bfa2019-07-10 08:56:24635
Daniel Cheng86135f32019-02-27 07:10:38636[//]: # (the reference link section should be alphabetically sorted)
Devlin Cronin6a484822025-02-05 16:41:14637[becoming-a-committer]: https://www.chromium.org/getting-involved/become-a-committer/
John Palmer046f9872021-05-24 01:24:56638[checkout-and-build]: https://chromium.googlesource.com/chromium/src/+/main/docs/#checking-out-and-building
John Abd-El-Malek27e1cf02019-12-18 17:35:18639[chrome-dd-review-process]: http://go/chrome-dd-review-process
640[chromium-design-docs]: https://groups.google.com/a/chromium.org/forum/#!forum/chromium-design-docs
Daniel Cheng86135f32019-02-27 07:10:38641[code-reviews-owners]: code_reviews.md#OWNERS-files
642[code-reviews]: code_reviews.md
Toby Huang5105f812019-08-08 23:47:57643[commit-checklist]: commit_checklist.md
Daniel Cheng86135f32019-02-27 07:10:38644[commit-queue]: infra/cq.md
645[core-principles]: https://www.chromium.org/developers/core-principles
646[corporate-cla]: https://cla.developers.google.com/about/google-corporate?csw=1
647[cr-authors]: https://chromium.googlesource.com/chromium/src/+/HEAD/AUTHORS
John Palmer046f9872021-05-24 01:24:56648[cr-styleguide]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/styleguide.md
Daniel Cheng86135f32019-02-27 07:10:38649[crbug-new]: https://bugs.chromium.org/p/chromium/issues/entry
650[crbug]: https://bugs.chromium.org/p/chromium/issues/list
John Palmer046f9872021-05-24 01:24:56651[cros-authors]: https://chromium.googlesource.com/chromium/src/+/main/AUTHORS
652[cros-dev-guide]: https://chromium.googlesource.com/chromiumos/docs/+/main/developer_guide.md
Daniel Cheng86135f32019-02-27 07:10:38653[crrev]: https://chromium-review.googlesource.com
654[depot-tools-setup]: https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up
John Abd-El-Malek27e1cf02019-12-18 17:35:18655[design-doc-template]: https://docs.google.com/document/d/14YBYKgk-uSfjfwpKFlp_omgUq5hwMVazy_M965s_1KA
Daniel Cheng86135f32019-02-27 07:10:38656[direct-commit]: https://dev.chromium.org/developers/contributing-code/direct-commit
657[discussion-groups]: https://www.chromium.org/developers/discussion-groups
658[github-tutorial]: https://try.github.io
659[good-git-commit-message]: https://chris.beams.io/posts/git-commit/
660[individual-cla]: https://cla.developers.google.com/about/google-individual?csw=1
Daniel Cheng737635ba2021-11-05 15:25:46661[life-of-a-chromium-developer]: https://docs.google.com/presentation/d/1abnqM9j6zFodPHA38JG1061rG2iGj_GABxEDgZsdbJg/edit
Daniel Cheng86135f32019-02-27 07:10:38662[noms-tutorial]: https://meowni.ca/posts/chromium-101
663[review-lag]: https://dev.chromium.org/developers/contributing-code/minimizing-review-lag-across-time-zones
Nourhan Hasan571a2f22024-07-26 16:50:48664[skia-dev-guide]: https://skia.org/docs/dev/contrib/
Daniel Cheng86135f32019-02-27 07:10:38665[try-job-access]: https://www.chromium.org/getting-involved/become-a-committer#TOC-Try-job-access
666[v8-dev-guide]: https://v8.dev/docs
Dominik Röttschesd113bfa2019-07-10 08:56:24667[watchlist-doc]: infra/watchlists.md