dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 1 | # Checking out and Building Chromium for Windows |
| 2 | |
Bruce Dawson | 4d1de59 | 2017-09-08 00:24:00 | [diff] [blame] | 3 | There are instructions for other platforms linked from the |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 4 | [get the code](get_the_code.md) page. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 5 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 6 | ## Instructions for Google Employees |
| 7 | |
| 8 | Are you a Google employee? See |
scottmg | 292538ae | 2017-01-12 00:10:55 | [diff] [blame] | 9 | [go/building-chrome-win](https://goto.google.com/building-chrome-win) instead. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 10 | |
| 11 | [TOC] |
| 12 | |
| 13 | ## System requirements |
| 14 | |
| 15 | * A 64-bit Intel machine with at least 8GB of RAM. More than 16GB is highly |
| 16 | recommended. |
dpranke | 4b470c5b | 2017-01-19 17:38:04 | [diff] [blame] | 17 | * At least 100GB of free disk space on an NTFS-formatted hard drive. FAT32 |
| 18 | will not work, as some of the Git packfiles are larger than 4GB. |
Bruce Dawson | 97367b7 | 2017-10-18 00:47:49 | [diff] [blame] | 19 | * An appropriate version of Visual Studio, as described below. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 20 | * Windows 7 or newer. |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 21 | |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 22 | ## Setting up Windows |
| 23 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 24 | ### Visual Studio |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 25 | |
Bruce Dawson | e9f20fff | 2018-03-03 01:58:38 | [diff] [blame^] | 26 | As of September, 2017 (R503915) Chromium requires Visual Studio 2017 update 3.x |
| 27 | to build. The clang-cl compiler is used but Visual Studio's header files, |
| 28 | libraries, and some tools are required. Visual Studio Community Edition should |
| 29 | work if its license is appropriate for you. You must install the "Desktop |
| 30 | development with C++" component and the "MFC and ATL support" sub-component. |
| 31 | This can be done from the command line by passing these arguments to the Visual |
| 32 | Studio installer that you download: |
Bruce Dawson | 1c0979a6 | 2017-09-13 17:47:21 | [diff] [blame] | 33 | ```shell |
Bruce Dawson | 97367b7 | 2017-10-18 00:47:49 | [diff] [blame] | 34 | --add Microsoft.VisualStudio.Workload.NativeDesktop |
Bruce Dawson | 1c0979a6 | 2017-09-13 17:47:21 | [diff] [blame] | 35 | --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended |
| 36 | ``` |
pwnall | 43b43ba | 2016-08-22 19:29:29 | [diff] [blame] | 37 | |
Bruce Dawson | e9f20fff | 2018-03-03 01:58:38 | [diff] [blame^] | 38 | You must have the version 10.0.15063 Windows 10 SDK installed. This can be |
| 39 | installed separately or by checking the appropriate box in the Visual Studio |
| 40 | Installer. |
| 41 | |
| 42 | The SDK Debugging Tools must also be installed. If the Windows 10 SDK was |
| 43 | installed via the Visual Studio installer, then they can be installed by going |
| 44 | to: Control Panel → Programs → Programs and Features → Select the "Windows |
| 45 | Software Development Kit" → Change → Change → Check "Debugging Tools For |
| 46 | Windows" → Change. Or, you can download the standalone SDK installer and use it |
| 47 | to install the Debugging Tools. |
Robert Sesek | c8ffa1b | 2017-08-04 19:55:22 | [diff] [blame] | 48 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 49 | ## Install `depot_tools` |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 50 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 51 | Download the [depot_tools bundle](https://storage.googleapis.com/chrome-infra/depot_tools.zip) |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 52 | and extract it somewhere. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 53 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 54 | *** note |
| 55 | **Warning:** **DO NOT** use drag-n-drop or copy-n-paste extract from Explorer, |
| 56 | this will not extract the hidden “.git” folder which is necessary for |
Bruce Dawson | 4d1de59 | 2017-09-08 00:24:00 | [diff] [blame] | 57 | depot_tools to autoupdate itself. You can use “Extract all…” from the |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 58 | context menu though. |
| 59 | *** |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 60 | |
Bruce Dawson | 4d1de59 | 2017-09-08 00:24:00 | [diff] [blame] | 61 | Add depot_tools to the start of your PATH (must be ahead of any installs of |
dpranke | 4b470c5b | 2017-01-19 17:38:04 | [diff] [blame] | 62 | Python). Assuming you unzipped the bundle to C:\src\depot_tools, open: |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 63 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 64 | Control Panel → System and Security → System → Advanced system settings |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 65 | |
dpranke | 4b470c5b | 2017-01-19 17:38:04 | [diff] [blame] | 66 | If you have Administrator access, Modify the PATH system variable and |
| 67 | put `C:\src\depot_tools` at the front (or at least in front of any directory |
| 68 | that might already have a copy of Python or Git). |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 69 | |
dpranke | 4b470c5b | 2017-01-19 17:38:04 | [diff] [blame] | 70 | If you don't have Administrator access, you can add a user-level PATH |
| 71 | environment variable and put `C:\src\depot_tools` at the front, but |
| 72 | if your system PATH has a Python in it, you will be out of luck. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 73 | |
| 74 | Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set |
| 75 | it to 0. This tells depot_tools to use your locally installed version of Visual |
| 76 | Studio (by default, depot_tools will try to use a google-internal version). |
| 77 | |
| 78 | From a cmd.exe shell, run the command gclient (without arguments). On first |
| 79 | run, gclient will install all the Windows-specific bits needed to work with |
| 80 | the code, including msysgit and python. |
| 81 | |
| 82 | * If you run gclient from a non-cmd shell (e.g., cygwin, PowerShell), |
| 83 | it may appear to run properly, but msysgit, python, and other tools |
| 84 | may not get installed correctly. |
| 85 | * If you see strange errors with the file system on the first run of gclient, |
| 86 | you may want to [disable Windows Indexing](http://tortoisesvn.tigris.org/faq.html#cantmove2). |
| 87 | |
Bruce Dawson | 4d1de59 | 2017-09-08 00:24:00 | [diff] [blame] | 88 | After running gclient open a command prompt and type `where python` and |
| 89 | confirm that the depot_tools `python.bat` comes ahead of any copies of |
| 90 | python.exe. Failing to ensure this can lead to overbuilding when |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 91 | using gn - see [crbug.com/611087](https://crbug.com/611087). |
| 92 | |
| 93 | ## Get the code |
| 94 | |
Leonard Mosescu | 718c9ac | 2017-06-20 18:06:32 | [diff] [blame] | 95 | First, configure Git: |
| 96 | |
| 97 | ```shell |
| 98 | $ git config --global user.name "My Name" |
| 99 | $ git config --global user.email "[email protected]" |
| 100 | $ git config --global core.autocrlf false |
| 101 | $ git config --global core.filemode false |
| 102 | $ git config --global branch.autosetuprebase always |
| 103 | ``` |
| 104 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 105 | Create a `chromium` directory for the checkout and change to it (you can call |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 106 | this whatever you like and put it wherever you like, as |
| 107 | long as the full path has no spaces): |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 108 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 109 | ```shell |
| 110 | $ mkdir chromium && cd chromium |
| 111 | ``` |
| 112 | |
| 113 | Run the `fetch` tool from `depot_tools` to check out the code and its |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 114 | dependencies. |
| 115 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 116 | ```shell |
xiaoyin.l | 802e4b3e | 2016-12-04 22:17:30 | [diff] [blame] | 117 | $ fetch chromium |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 118 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 119 | |
| 120 | If you don't want the full repo history, you can save a lot of time by |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 121 | adding the `--no-history` flag to `fetch`. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 122 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 123 | Expect the command to take 30 minutes on even a fast connection, and many |
| 124 | hours on slower ones. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 125 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 126 | When `fetch` completes, it will have created a hidden `.gclient` file and a |
| 127 | directory called `src` in the working directory. The remaining instructions |
| 128 | assume you have switched to the `src` directory: |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 129 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 130 | ```shell |
| 131 | $ cd src |
| 132 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 133 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 134 | *Optional*: You can also [install API |
| 135 | keys](https://www.chromium.org/developers/how-tos/api-keys) if you want your |
| 136 | build to talk to some Google services, but this is not necessary for most |
| 137 | development and testing purposes. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 138 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 139 | ## Setting up the build |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 140 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 141 | Chromium uses [Ninja](https://ninja-build.org) as its main build tool along |
| 142 | with a tool called [GN](../tools/gn/docs/quick_start.md) to generate `.ninja` |
| 143 | files. You can create any number of *build directories* with different |
| 144 | configurations. To create a build directory: |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 145 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 146 | ```shell |
| 147 | $ gn gen out/Default |
| 148 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 149 | |
sdy | 93387fa | 2016-12-01 01:03:44 | [diff] [blame] | 150 | * You only have to run this once for each new build directory, Ninja will |
| 151 | update the build files as needed. |
| 152 | * You can replace `Default` with another name, but |
| 153 | it should be a subdirectory of `out`. |
| 154 | * For other build arguments, including release settings, see [GN build |
| 155 | configuration](https://www.chromium.org/developers/gn-build-configuration). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 156 | The default will be a debug component build matching the current host |
| 157 | operating system and CPU. |
| 158 | * For more info on GN, run `gn help` on the command line or read the |
| 159 | [quick start guide](../tools/gn/docs/quick_start.md). |
| 160 | |
| 161 | ### Using the Visual Studio IDE |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 162 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 163 | If you want to use the Visual Studio IDE, use the `--ide` command line |
| 164 | argument to `gn gen` when you generate your output directory (as described on |
xiaoyin.l | 1003c0b | 2016-12-06 02:51:17 | [diff] [blame] | 165 | the [get the code](https://dev.chromium.org/developers/how-tos/get-the-code) |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 166 | page): |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 167 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 168 | ```shell |
| 169 | $ gn gen --ide=vs out\Default |
| 170 | $ devenv out\Default\all.sln |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 171 | ``` |
| 172 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 173 | GN will produce a file `all.sln` in your build directory. It will internally |
| 174 | use Ninja to compile while still allowing most IDE functions to work (there is |
| 175 | no native Visual Studio compilation mode). If you manually run "gen" again you |
| 176 | will need to resupply this argument, but normally GN will keep the build and |
thakis | 3e861de | 2016-06-14 14:24:01 | [diff] [blame] | 177 | IDE files up to date automatically when you build. |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 178 | |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 179 | The generated solution will contain several thousand projects and will be very |
| 180 | slow to load. Use the `--filters` argument to restrict generating project files |
| 181 | for only the code you're interested in, although this will also limit what |
| 182 | files appear in the project explorer. A minimal solution that will let you |
| 183 | compile and run Chrome in the IDE but will not show any source files is: |
| 184 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 185 | ``` |
| 186 | $ gn gen --ide=vs --filters=//chrome out\Default |
| 187 | ``` |
brettw | c25693b3 | 2016-05-26 01:11:52 | [diff] [blame] | 188 | |
| 189 | There are other options for controlling how the solution is generated, run `gn |
| 190 | help gen` for the current documentation. |
| 191 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 192 | ### Faster builds |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 193 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 194 | * Reduce file system overhead by excluding build directories from |
| 195 | antivirus and indexing software. |
| 196 | * Store the build tree on a fast disk (preferably SSD). |
brucedawson | cfc7fd5 | 2017-07-06 18:41:01 | [diff] [blame] | 197 | * The more cores the better (20+ is not excessive) and lots of RAM is needed |
| 198 | (64 GB is not excessive). |
tfarina | 502f388 | 2016-03-23 12:48:10 | [diff] [blame] | 199 | |
brucedawson | cfc7fd5 | 2017-07-06 18:41:01 | [diff] [blame] | 200 | There are some gn flags that can improve build speeds. You can specify these |
| 201 | in the editor that appears when you create your output directory |
| 202 | (`gn args out/Default`) or on the gn gen command line |
| 203 | (`gn gen out/Default --args="is_component_build = true is_debug = true"`). |
| 204 | Some helpful settings to consider using include: |
Bruce Dawson | e9f20fff | 2018-03-03 01:58:38 | [diff] [blame^] | 205 | * `use_jumbo_build = true` - *experimental* [Jumbo/unity](jumbo.md) builds. |
brucedawson | cfc7fd5 | 2017-07-06 18:41:01 | [diff] [blame] | 206 | * `is_component_build = true` - this uses more, smaller DLLs, and incremental |
| 207 | linking. |
Bruce Dawson | fcd3deb1 | 2017-07-28 17:12:20 | [diff] [blame] | 208 | * `enable_nacl = false` - this disables Native Client which is usually not |
| 209 | needed for local builds. |
brucedawson | cfc7fd5 | 2017-07-06 18:41:01 | [diff] [blame] | 210 | * `target_cpu = "x86"` - x86 builds are slightly faster than x64 builds and |
| 211 | support incremental linking for more targets. Note that if you set this but |
Bruce Dawson | fcd3deb1 | 2017-07-28 17:12:20 | [diff] [blame] | 212 | don't' set enable_nacl = false then build times may get worse. |
brucedawson | cfc7fd5 | 2017-07-06 18:41:01 | [diff] [blame] | 213 | * `remove_webcore_debug_symbols = true` - turn off source-level debugging for |
| 214 | blink to reduce build times, appropriate if you don't plan to debug blink. |
brucedawson | cfc7fd5 | 2017-07-06 18:41:01 | [diff] [blame] | 215 | |
Bruce Dawson | e9f20fff | 2018-03-03 01:58:38 | [diff] [blame^] | 216 | In order to ensure that linking is fast enough we recommend that you use one of |
| 217 | these settings - they all have tradeoffs: |
| 218 | * `use_lld = true` - this linker is very fast on full links but does not support |
| 219 | incremental linking. |
| 220 | * `is_win_fastlink = true` - this option makes the Visual Studio linker run much |
| 221 | faster, and incremental linking is supported, but it can lead to debugger |
| 222 | slowdowns or out-of-memory crashes. |
| 223 | * `symbol_level = 1` - this option reduces the work the linker has to do but |
| 224 | when this option is set you cannot do source-level debugging. |
brucedawson | cfc7fd5 | 2017-07-06 18:41:01 | [diff] [blame] | 225 | |
Bruce Dawson | e9f20fff | 2018-03-03 01:58:38 | [diff] [blame^] | 226 | In addition, Google employees should use goma, a distributed compilation system. |
| 227 | Detailed information is available internally but the relevant gn arg is: |
| 228 | * `use_goma = true` |
brucedawson | cfc7fd5 | 2017-07-06 18:41:01 | [diff] [blame] | 229 | |
| 230 | To get any benefit from goma it is important to pass a large -j value to ninja. |
Bruce Dawson | e9f20fff | 2018-03-03 01:58:38 | [diff] [blame^] | 231 | A good default is 10\*numCores to 20\*numCores. If you run autoninja then it |
| 232 | will automatically pass an appropriate -j value to ninja for goma or not. |
| 233 | |
| 234 | ```shell |
| 235 | $ autoninja -C out\Default chrome |
| 236 | ``` |
brucedawson | cfc7fd5 | 2017-07-06 18:41:01 | [diff] [blame] | 237 | |
| 238 | When invoking ninja specify 'chrome' as the target to avoid building all test |
| 239 | binaries as well. |
| 240 | |
| 241 | Still, builds will take many hours on many machines. |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 242 | |
Bruce Dawson | e9f20fff | 2018-03-03 01:58:38 | [diff] [blame^] | 243 | ### Why is my build slow? |
| 244 | |
| 245 | Many things can make builds slow, with Windows Defender slowing process startups |
| 246 | being a frequent culprit. Have you ensured that the entire Chromium src |
| 247 | directory is excluded from anti-virus scanning (on Google machines this means |
| 248 | putting it in a ``src`` directory in the root of a drive)? Have you tried the |
| 249 | different settings listed above, including different link settings and -j |
| 250 | values? Have you asked on the chromium-dev mailing list to see if your build is |
| 251 | slower than expected for your machine's specifications? |
| 252 | |
| 253 | The next step is to gather some data. There are several options. Setting |
| 254 | [NINJA_STATUS](https://ninja-build.org/manual.html#_environment_variables) lets |
| 255 | you configure Ninja's output so that, for instance, you can see how many |
| 256 | processes are running at any given time, how long the build has been running, |
| 257 | etc., as shown here: |
| 258 | |
| 259 | ```shell |
| 260 | $ set NINJA_STATUS=[%r processes, %f/%t @ %o/s : %es ] |
| 261 | $ autoninja -C out\Default base |
| 262 | ninja: Entering directory `out\Default' |
| 263 | [1 processes, 86/86 @ 2.7/s : 31.785s ] LINK(DLL) base.dll base.dll.lib base.dll.pdb |
| 264 | ``` |
| 265 | |
| 266 | In addition, if you set the ``NINJA_SUMMARIZE_BUILD`` environment variable to 1 then |
| 267 | autoninja will print a build performance summary when the build completes, |
| 268 | showing the slowest build steps and build-step types, as shown here: |
| 269 | |
| 270 | ```shell |
| 271 | $ set NINJA_SUMMARIZE_BUILD=1 |
| 272 | $ autoninja -C out\Default base |
| 273 | Longest build steps: |
| 274 | ... |
| 275 | 1.2 weighted s to build base.dll, base.dll.lib, base.dll.pdb (1.2 s CPU time) |
| 276 | 8.5 weighted s to build obj/base/base/base_jumbo_38.obj (30.1 s CPU time) |
| 277 | Time by build-step type: |
| 278 | ... |
| 279 | 1.2 s weighted time to generate 1 PEFile (linking) files (1.2 s CPU time) |
| 280 | 30.3 s weighted time to generate 45 .obj files (688.8 s CPU time) |
| 281 | 31.8 s weighted time (693.8 s CPU time, 21.8x parallelism) |
| 282 | 86 build steps completed, average of 2.71/s |
| 283 | ``` |
| 284 | |
| 285 | You can also get a visual report of the build performance with |
| 286 | [ninjatracing](https://github.com/nico/ninjatracing). This converts the |
| 287 | .ninja_log file into a .json file which can be loaded into chrome://tracing: |
| 288 | |
| 289 | ```shell |
| 290 | $ python ninjatracing out\Default\.ninja_log >build.json |
| 291 | ``` |
| 292 | |
| 293 | Finally, Ninja can report on its own overhead which can be helpful if, for |
| 294 | instance, process creation is making builds slow, perhaps due to anti-virus |
| 295 | interference due to clang-cl not being in an excluded directory: |
| 296 | |
| 297 | ```shell |
| 298 | $ autoninja -d stats -C out\Default base |
| 299 | metric count avg (us) total (ms) |
| 300 | .ninja parse 3555 1539.4 5472.6 |
| 301 | canonicalize str 1383032 0.0 12.7 |
| 302 | canonicalize path 1402349 0.0 11.2 |
| 303 | lookup node 1398245 0.0 8.1 |
| 304 | .ninja_log load 2 118.0 0.2 |
| 305 | .ninja_deps load 2 67.5 0.1 |
| 306 | node stat 2516 29.6 74.4 |
| 307 | depfile load 2 1132.0 2.3 |
| 308 | StartEdge 88 3508.1 308.7 |
| 309 | FinishCommand 87 1670.9 145.4 |
| 310 | CLParser::Parse 45 1889.1 85.0 |
| 311 | ``` |
| 312 | |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 313 | ## Build Chromium |
| 314 | |
Bruce Dawson | e9f20fff | 2018-03-03 01:58:38 | [diff] [blame^] | 315 | Build Chromium (the "chrome" target) with Ninja (or autoninja) using the |
| 316 | command: |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 317 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 318 | ```shell |
| 319 | $ ninja -C out\Default chrome |
| 320 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 321 | |
| 322 | You can get a list of all of the other build targets from GN by running |
| 323 | `gn ls out/Default` from the command line. To compile one, pass to Ninja |
| 324 | the GN label with no preceding "//" (so for `//chrome/test:unit_tests` |
| 325 | use ninja -C out/Default chrome/test:unit_tests`). |
| 326 | |
| 327 | ## Run Chromium |
| 328 | |
| 329 | Once it is built, you can simply run the browser: |
| 330 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 331 | ```shell |
| 332 | $ out\Default\chrome.exe |
| 333 | ``` |
| 334 | |
| 335 | (The ".exe" suffix in the command is actually optional). |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 336 | |
| 337 | ## Running test targets |
| 338 | |
| 339 | You can run the tests in the same way. You can also limit which tests are |
| 340 | run using the `--gtest_filter` arg, e.g.: |
| 341 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 342 | ```shell |
| 343 | $ out\Default\unit_tests.exe --gtest_filter="PushClientTest.*" |
| 344 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 345 | |
| 346 | You can find out more about GoogleTest at its |
| 347 | [GitHub page](https://github.com/google/googletest). |
| 348 | |
| 349 | ## Update your checkout |
| 350 | |
| 351 | To update an existing checkout, you can run |
| 352 | |
dpranke | 1a70d0c | 2016-12-01 02:42:29 | [diff] [blame] | 353 | ```shell |
| 354 | $ git rebase-update |
| 355 | $ gclient sync |
| 356 | ``` |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 357 | |
| 358 | The first command updates the primary Chromium source repository and rebases |
| 359 | any of your local branches on top of tip-of-tree (aka the Git branch `origin/master`). |
Bruce Dawson | 4d1de59 | 2017-09-08 00:24:00 | [diff] [blame] | 360 | If you don't want to use this script, you can also just use `git pull` or |
dpranke | 0ae7cad | 2016-11-30 07:47:58 | [diff] [blame] | 361 | other common Git commands to update the repo. |
| 362 | |
| 363 | The second command syncs the subrepositories to the appropriate versions and |
| 364 | re-runs the hooks as needed. |