blob: d663727f6f0a1eb970c0ad8afd7dd70496865e44 [file] [log] [blame] [view]
Skyler Kaufman991ae4d2011-04-07 12:30:41 -07001# Submitting Patches #
2
3This page describes the full process of submitting a patch to the AOSP, including reviewing and tracking changes with Gerrit.
4
5## Prerequisites ##
6
7- Before you follow the instructions on this page, you will need to set up your
8local working environment and get the Android source files. For instructions,
9follow the "Getting Started" section [here](downloading.html).
10
11- For details about Repo and Git, see [Version Control](version-control.html).
12
13- For information about the different roles you can play within the Android
Dan Morrill669d3642011-04-07 14:37:55 -070014Open Source community, see [Project roles](/source/roles.html).
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070015
16- If you plan to contribute code to the Android platform, be sure to read
Dan Morrill669d3642011-04-07 14:37:55 -070017the [AOSP's licensing information](/source/licenses.html).
Skyler Kaufman991ae4d2011-04-07 12:30:41 -070018
19- Note that changes to some of the upstream projects used by Android should be
20made directly to that project, as described in [Upstream Projects](#upstream-projects).
21
22## Patch Etiquette ##
23
24### Writing patch descriptions ###
25
26Each change list description will be pushed to the public AOSP repository. Please follow our guidelines for writing change descriptions in order to ensure your change is reviewed and approved.
27
28- Start with a one-line summary, 50-60 characters max, followed by a blank line. This format is used by git and gerrit for various displays.
29
30- The description should focus on what issue it solves, and how it solves it. The second part is somewhat optional when implementing new features, though desirable.
31
32- The description should be self-contained. It should not rely on people having access to any other information.
33
34- The description should be reasonably descriptive. You've spent a few hours or a few days working on your change so you can spend 5 minutes writing a proper description. Maybe write it while you do a final compile before submitting.
35
36## Using the Gerrit code-review tool ##
37
38You can open Gerrit by visiting whatever URL is returned to you from the repo upload command,
39or by visiting [https://review.android.com](https://review.source.android.com)
40
41### Viewing the status of uploaded changes ###
42
43To check the status of a change that you uploaded, open [Gerrit](https://review.source.android.com/mine),
44sign in, and click MyChanges.
45
46### Reviewing a change ###
47
48If you are assigned to be the Approver for a change, you need to determine the following:
49
50- Does this change fit within this project's stated purpose?
51
52- Is this change valid within the project's existing architecture?
53
54- Does this change introduce design flaws that will cause problems in the future?
55
56- Does this change follow the best practices that have been established for this project?
57
58- Is this change a good way to perform the described function?
59
60- Does this change introduce any security or instability risks?
61
62If you approve of the change, mark it with LGTM ("Looks Good to Me") within Gerrit.
63
64### Verifying a change ###
65
66If you are assigned to be the Verifier for a change, you need to do the following:
67
68- Patch the change into your local client using one of the Download commands.
69
70- Build and test the change.
71
72- Within Gerrit use Publish Comments to mark the commit as "Verified" or "Fails," and add a message explaining what problems were identified.
73
74### Viewing diffs and comments ###
75
76To open the details of the change within Gerrit, click on the "Id number" or "Subject" of a change. To compare the established code with the updated code, click the file name under "Side-by-side diffs."
77
78### Adding comments ###
79
80Anyone in the community can use Gerrit to add inline comments to code submissions. A good comment will be relevant to the line or section of code to which it is attached in Gerrit. It might be a short and constructive suggestion about how a line of code could be improved, or it might be an explanation from the author about why the code makes sense the way it is.
81
82To add an inline comment, double-click the relevant line of the code and write your comment in the text box that opens. When you click Save, only you can see your comment.
83
84To publish your comments so that others using Gerrit will be able to see them, click the Publish Comments button. Your comments will be emailed to all relevant parties for this change, including the change owner, the patch set uploader (if different from the owner), and all current reviewers.
85
86### After a submission is approved ###
87
88After a submission makes it through the review and verification process, Gerrit automatically merges the change into the public repository. The change will now be visible in gitweb, and others users will be able to run `repo sync` to pull the update into their local client.
89
90### Downloading changes from Gerrit ###
91
92A submission that has been verified and merged will be downloaded with the next `repo sync`. If you wish to download a specific change that has not yet been approved, run
93
94 $ repo download TARGET CHANGE
95
96where TARGET is the local directory into which the change should be downloaded and CHANGE is the
97change number as listed in [Gerrit](https://review.source.android.com/). For more information,
98see the [Repo reference](/source/using-repo.html).
99
100### How do I become a Verifier or Approver? ###
101
102In short, contribute high-quality code to one or more of the Android projects.
103For details about the different roles in the Android Open Source community and
Dan Morrill669d3642011-04-07 14:37:55 -0700104who plays them, see [Project Roles](/source/roles.html).
Skyler Kaufman991ae4d2011-04-07 12:30:41 -0700105
106## Using GitWeb to track patch histories ##
107
108To view snapshots of the files that are in the public Android repositories and view file histories, use the [Android instance of GitWeb](http://android.git.kernel.org/).
109
110<a name="upstream-projects"></a>
111
112## Upstream Projects ##
113
114Android makes use of a number of other open-source projects, such as the Linux kernel and WebKit, as described in
115[Branches and Releases](/source/code-lines.html). For the upstream projects detailed below, changes should be made directly upstream. Such changes will be incorporated into the Android tree as part of the usual process of pulling these projects.
116
117### WebKit ###
118
119All changes to the WebKit project at `external/webkit` should be made
120upstream at [webkit.org](http://www.webkit.org). The process begins by filing a WebKit bug.
121This bug should use `Android` for the `Platform` and `OS`
122fields only if the bug is specific to Android. Bugs are far more likely to receive the reviewers'
123attention once a proposed fix is added and tests are included. See
124[Contributing Code to WebKit](http://webkit.org/coding/contributing.html) for details.
125
126### V8 ###
127
128All changes to the V8 project at `external/v8` should be submitted upstream at
129[code.google.com/p/v8](http://code.google.com/p/v8). See [Contributing to V8](http://code.google.com/p/v8/wiki/Contributing)
130for details.
131