Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 | |
| 15 :doctype: article | |
| 16 | |
| 17 = Developing Crashpad | |
| 18 | |
| 19 == Status | |
| 20 | |
| 21 link:status.html[Project status] information has moved to its own page. | |
| 22 | |
| 23 == Introduction | |
| 24 | |
| 25 Crashpad is a https://dev.chromium.org/Home[Chromium project]. Most of | |
| 26 its development practices follow Chromium’s. In order to function on its | |
| 27 own in other projects, Crashpad uses | |
| 28 https://chromium.googlesource.com/chromium/mini_chromium/[mini_chromium], | |
| 29 a small, self-contained library that provides many of Chromium’s useful | |
| 30 low-level base routines. | |
| 31 https://chromium.googlesource.com/chromium/mini_chromium/+/master/README[mini_ch romium’s | |
| 32 README] provides more detail. | |
| 33 | |
| 34 == Prerequisites | |
| 35 | |
| 36 To develop Crashpad, the following tools are necessary, and must be | |
| 37 present in the `$PATH` environment variable: | |
| 38 | |
| 39 * Chromium’s | |
| 40 https://dev.chromium.org/developers/how-tos/depottools[depot_tools]. | |
| 41 * http://git-scm.com/[Git]. This is provided by Xcode on Mac OS X and by | |
| 42 depot_tools on Windows. | |
| 43 * https://www.python.org/[Python]. This is provided by the operating system on | |
| 44 Mac OS X, and by depot_tools on Windows. | |
| 45 * Appropriate development tools. For Mac OS X, this is | |
| 46 https://developer.apple.com/xcode/[Xcode], and for Windows, it’s | |
| 47 https://www.visualstudio.com/[Visual Studio]. | |
| 48 | |
| 49 == Getting the Source Code | |
| 50 | |
| 51 The main source code repository is a Git repository hosted at | |
| 52 https://chromium.googlesource.com/crashpad/crashpad. Although it is possible to | |
| 53 check out this repository directly with `git clone`, Crashpad’s dependencies are | |
| 54 managed by | |
| 55 https://dev.chromium.org/developers/how-tos/depottools#TOC-gclient[`gclient`] | |
| 56 instead of Git submodules, so to work on Crashpad, it is best to use `gclient` | |
| 57 to get the source code. | |
| 58 | |
| 59 `gclient` is part of the | |
| 60 https://dev.chromium.org/developers/how-tos/depottools[depot_tools]. There’s no | |
| 61 need to install it separately. | |
| 62 | |
| 63 === Initial Checkout | |
| 64 | |
| 65 ---- | |
| 66 $ mkdir ~/crashpad | |
| 67 $ cd ~/crashpad | |
| 68 $ gclient config --unmanaged https://chromium.googlesource.com/crashpad/crashpad | |
| 69 $ gclient sync | |
| 70 ---- | |
| 71 | |
| 72 === Subsequent Checkouts | |
| 73 | |
| 74 ---- | |
| 75 $ cd ~/crashpad/crashpad | |
| 76 $ git pull -r | |
| 77 $ gclient sync | |
| 78 ---- | |
| 79 | |
| 80 == Building | |
| 81 | |
| 82 Crashpad uses https://gyp.googlecode.com/[GYP] to generate | |
| 83 https://martine.github.io/ninja/[Ninja] build files. The build is described by | |
| 84 `.gyp` files throughout the Crashpad source code tree. The | |
| 85 `build/gyp_crashpad.py` script runs GYP properly for Crashpad, and is also | |
| 86 called when you run `gclient sync` or `gclient runhooks`. | |
| 87 | |
| 88 The Ninja build files and build output are in the `out` directory. Both debug- | |
| 89 and release-mode configurations are available. The examples below show the debug | |
| 90 configuration. To build and test the release configuration, substitute `Release` | |
| 91 for `Debug`. | |
| 92 | |
| 93 ---- | |
| 94 $ cd ~/crashpad/crashpad | |
| 95 $ ninja -C out/Debug | |
| 96 ---- | |
| 97 | |
| 98 Ninja is part of the | |
| 99 https://dev.chromium.org/developers/how-tos/depottools[depot_tools]. There’s no | |
| 100 need to install it separately. | |
| 101 | |
| 102 == Testing | |
| 103 | |
| 104 Crashpad uses https://googletest.googlecode.com/[Google Test] as its | |
| 105 unit-testing framework, and some tests use | |
| 106 https://googlemock.googlecode.com/[Google Mock] as well. Its tests are currently | |
| 107 split up into several test executables, each dedicated to testing a different | |
| 108 component. This may change in the future. After a successful build, the test | |
| 109 executables will be found at `out/Debug/crashpad_*_test`. | |
| 110 | |
| 111 ---- | |
| 112 $ cd ~/crashpad/crashpad | |
| 113 $ out/Debug/crashpad_minidump_test | |
| 114 $ out/Debug/crashpad_util_test | |
| 115 ---- | |
| 116 | |
| 117 A script is provided to run all of Crashpad’s tests. It accepts a single | |
| 118 argument that tells it which configuration to test. | |
| 119 | |
| 120 ---- | |
| 121 $ cd ~/crashpad/crashpad | |
| 122 $ python build/run_tests.py Debug | |
| 123 ---- | |
| 124 | |
| 125 == Contributing | |
| 126 | |
| 127 Crashpad’s contribution process is very similar to | |
| 128 https://dev.chromium.org/developers/contributing-code[Chromium’s contribution | |
| 129 process]. | |
| 130 | |
| 131 === Code Review | |
| 132 | |
| 133 A code review must be conducted for every change to Crashpad’s source code. Code | |
| 134 review is conducted on https://codereview.chromium.org/[Chromium’s Rietveld] | |
| 135 system, and all code reviews must be sent to an appropriate reviewer, with a Cc | |
| 136 sent to | |
| 137 https://groups.google.com/a/chromium.org/group/crashpad-dev[crashpad-dev]. The | |
| 138 `codereview.settings` file specifies this environment to `git-cl`. | |
| 139 | |
| 140 `git-cl` is part of the | |
| 141 https://dev.chromium.org/developers/how-tos/depottools[depot_tools]. There’s no | |
| 142 need to install it separately. | |
| 143 | |
| 144 [subs="verbatim,macros"] | |
| 145 ---- | |
| 146 $ cd ~/crashpad/crashpad | |
| 147 $ git checkout -b work_branch origin/master | |
| 148 pass:quotes[_…do some work…_] | |
| 149 $ git add … | |
| 150 $ git commit | |
| 151 $ git cl upload | |
| 152 ---- | |
| 153 | |
| 154 Uploading a patch to Rietveld does not automatically request a review. You must | |
| 155 select a reviewer and mail your request to them (with a Cc to crashpad-dev) from | |
| 156 the Rietveld issue page after running `git cl upload`. If you have lost track of | |
| 157 the issue page, `git cl issue` will remind you of its URL. Alternatively, you | |
| 158 can request review when uploading to Rietveld by using `git cl upload | |
| 159 --send-mail` | |
| 160 | |
| 161 Git branches maintain their association with Rietveld issues, so if you need to | |
| 162 make changes based on review feedback, you can do so on the correct Git branch, | |
| 163 committing your changes locally with `git commit`. You can then upload a new | |
| 164 patch set with `git cl upload` and let your reviewer know you’ve addressed the | |
| 165 feedback. | |
| 166 | |
| 167 === Landing Changes | |
| 168 | |
| 169 After code review is complete and “LGTM” (“looks good to me”) has been received | |
| 170 from all reviewers, project members can commit the patch themselves: | |
| 171 | |
| 172 ---- | |
| 173 $ cd ~/crashpad/crashpad | |
| 174 $ git checkout work_branch | |
| 175 $ git cl land | |
| 176 ---- | |
| 177 | |
| 178 Crashpad does not currently have a | |
| 179 https://dev.chromium.org/developers/testing/commit-queue[commit queue], so | |
| 180 contributors that are not project members will have to ask a project member to | |
| 181 commit the patch for them. Project members can commit changes on behalf of | |
| 182 external contributors by patching the change into a local branch and landing it: | |
| 183 | |
| 184 [subs="verbatim,macros"] | |
| 185 ---- | |
| 186 $ cd ~/crashpad/crashpad | |
| 187 $ git checkout -b for_external_contributor origin/master | |
| 188 $ git cl patch 12345678 pass:quotes[_# 12345678 is the Rietveld issue number_] | |
| 189 $ git cl land -c 'External Contributor <\external@contributor.org>' | |
|
Robert Sesek
2015/04/01 15:25:58
Is this \ in the right place?
Mark Mentovai
2015/04/01 16:10:00
Robert Sesek wrote:
| |
| 190 ---- | |
| 191 | |
| 192 === External Contributions | |
| 193 | |
| 194 Copyright holders must complete the | |
| 195 https://developers.google.com/open-source/cla/individual[Individual Contributor | |
| 196 License Agreement] or | |
| 197 https://developers.google.com/open-source/cla/corporate[Corporate Contributor | |
| 198 License Agreement] as appropriate before any submission can be accepted, and | |
| 199 must be listed in the `AUTHORS` file. Contributors may be listed in the | |
| 200 `CONTRIBUTORS` file. | |
| 201 | |
| 202 == Buildbot | |
| 203 | |
| 204 The https://build.chromium.org/p/client.crashpad/[Crashpad Buildbot] performs | |
| 205 automated builds and tests of Crashpad. Before checking out or updating the | |
| 206 Crashpad source code, and after checking in a new change, it is prudent to check | |
| 207 the Buildbot to ensure that “the tree is green.” | |
| OLD | NEW |