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 [subs="verbatim,quotes"] |
| 66 ---- |
| 67 $ *mkdir \~/crashpad* |
| 68 $ *cd ~/crashpad* |
| 69 $ *gclient config --unmanaged https://chromium.googlesource.com/crashpad/crashpa
d* |
| 70 $ *gclient sync* |
| 71 ---- |
| 72 |
| 73 === Subsequent Checkouts |
| 74 |
| 75 [subs="verbatim,quotes"] |
| 76 ---- |
| 77 $ *cd ~/crashpad/crashpad* |
| 78 $ *git pull -r* |
| 79 $ *gclient sync* |
| 80 ---- |
| 81 |
| 82 == Building |
| 83 |
| 84 Crashpad uses https://gyp.googlecode.com/[GYP] to generate |
| 85 https://martine.github.io/ninja/[Ninja] build files. The build is described by |
| 86 `.gyp` files throughout the Crashpad source code tree. The |
| 87 `build/gyp_crashpad.py` script runs GYP properly for Crashpad, and is also |
| 88 called when you run `gclient sync` or `gclient runhooks`. |
| 89 |
| 90 The Ninja build files and build output are in the `out` directory. Both debug- |
| 91 and release-mode configurations are available. The examples below show the debug |
| 92 configuration. To build and test the release configuration, substitute `Release` |
| 93 for `Debug`. |
| 94 |
| 95 [subs="verbatim,quotes"] |
| 96 ---- |
| 97 $ *cd ~/crashpad/crashpad* |
| 98 $ *ninja -C out/Debug* |
| 99 ---- |
| 100 |
| 101 Ninja is part of the |
| 102 https://dev.chromium.org/developers/how-tos/depottools[depot_tools]. There’s no |
| 103 need to install it separately. |
| 104 |
| 105 == Testing |
| 106 |
| 107 Crashpad uses https://googletest.googlecode.com/[Google Test] as its |
| 108 unit-testing framework, and some tests use |
| 109 https://googlemock.googlecode.com/[Google Mock] as well. Its tests are currently |
| 110 split up into several test executables, each dedicated to testing a different |
| 111 component. This may change in the future. After a successful build, the test |
| 112 executables will be found at `out/Debug/crashpad_*_test`. |
| 113 |
| 114 [subs="verbatim,quotes"] |
| 115 ---- |
| 116 $ *cd ~/crashpad/crashpad* |
| 117 $ *out/Debug/crashpad_minidump_test* |
| 118 $ *out/Debug/crashpad_util_test* |
| 119 ---- |
| 120 |
| 121 A script is provided to run all of Crashpad’s tests. It accepts a single |
| 122 argument that tells it which configuration to test. |
| 123 |
| 124 [subs="verbatim,quotes"] |
| 125 ---- |
| 126 $ *cd ~/crashpad/crashpad* |
| 127 $ *python build/run_tests.py Debug* |
| 128 ---- |
| 129 |
| 130 == Contributing |
| 131 |
| 132 Crashpad’s contribution process is very similar to |
| 133 https://dev.chromium.org/developers/contributing-code[Chromium’s contribution |
| 134 process]. |
| 135 |
| 136 === Code Review |
| 137 |
| 138 A code review must be conducted for every change to Crashpad’s source code. Code |
| 139 review is conducted on https://codereview.chromium.org/[Chromium’s Rietveld] |
| 140 system, and all code reviews must be sent to an appropriate reviewer, with a Cc |
| 141 sent to |
| 142 https://groups.google.com/a/chromium.org/group/crashpad-dev[crashpad-dev]. The |
| 143 `codereview.settings` file specifies this environment to `git-cl`. |
| 144 |
| 145 `git-cl` is part of the |
| 146 https://dev.chromium.org/developers/how-tos/depottools[depot_tools]. There’s no |
| 147 need to install it separately. |
| 148 |
| 149 [subs="verbatim,quotes"] |
| 150 ---- |
| 151 $ *cd ~/crashpad/crashpad* |
| 152 $ *git checkout -b work_branch origin/master* |
| 153 _…do some work…_ |
| 154 $ *git add …* |
| 155 $ *git commit* |
| 156 $ *git cl upload* |
| 157 ---- |
| 158 |
| 159 Uploading a patch to Rietveld does not automatically request a review. You must |
| 160 select a reviewer and mail your request to them (with a Cc to crashpad-dev) from |
| 161 the Rietveld issue page after running `git cl upload`. If you have lost track of |
| 162 the issue page, `git cl issue` will remind you of its URL. Alternatively, you |
| 163 can request review when uploading to Rietveld by using `git cl upload |
| 164 --send-mail` |
| 165 |
| 166 Git branches maintain their association with Rietveld issues, so if you need to |
| 167 make changes based on review feedback, you can do so on the correct Git branch, |
| 168 committing your changes locally with `git commit`. You can then upload a new |
| 169 patch set with `git cl upload` and let your reviewer know you’ve addressed the |
| 170 feedback. |
| 171 |
| 172 === Landing Changes |
| 173 |
| 174 After code review is complete and “LGTM” (“looks good to me”) has been received |
| 175 from all reviewers, project members can commit the patch themselves: |
| 176 |
| 177 [subs="verbatim,quotes"] |
| 178 ---- |
| 179 $ *cd ~/crashpad/crashpad* |
| 180 $ *git checkout work_branch* |
| 181 $ *git cl land* |
| 182 ---- |
| 183 |
| 184 Crashpad does not currently have a |
| 185 https://dev.chromium.org/developers/testing/commit-queue[commit queue], so |
| 186 contributors that are not project members will have to ask a project member to |
| 187 commit the patch for them. Project members can commit changes on behalf of |
| 188 external contributors by patching the change into a local branch and landing it: |
| 189 |
| 190 [subs="verbatim,quotes"] |
| 191 ---- |
| 192 $ *cd ~/crashpad/crashpad* |
| 193 $ *git checkout -b for_external_contributor origin/master* |
| 194 $ *git cl patch 12345678* _# 12345678 is the Rietveld issue number_ |
| 195 $ *git cl land -c \'External Contributor <external@contributor.org>'* |
| 196 ---- |
| 197 |
| 198 === External Contributions |
| 199 |
| 200 Copyright holders must complete the |
| 201 https://developers.google.com/open-source/cla/individual[Individual Contributor |
| 202 License Agreement] or |
| 203 https://developers.google.com/open-source/cla/corporate[Corporate Contributor |
| 204 License Agreement] as appropriate before any submission can be accepted, and |
| 205 must be listed in the `AUTHORS` file. Contributors may be listed in the |
| 206 `CONTRIBUTORS` file. |
| 207 |
| 208 == Buildbot |
| 209 |
| 210 The https://build.chromium.org/p/client.crashpad/[Crashpad Buildbot] performs |
| 211 automated builds and tests of Crashpad. Before checking out or updating the |
| 212 Crashpad source code, and after checking in a new change, it is prudent to check |
| 213 the Buildbot to ensure that “the tree is green.” |
OLD | NEW |