Welcome to Chromium! If you're here, you want to learn how to check out the Chromium repository and contribute changes to the Chromium project. This guide will show you how to do that.
If you want to know how to go from checking the code out to making a small change and sending it out for review, here is a very detailed guide that explains all those steps.
Getting StartedChromium supports building on Windows, Mac and Linux. You can also build the mobile versions, iOS (from Mac) and Android (from Linux).
There are two main components to your build environment:
Set up your environmentFirst, check out and install the depot_tools package.Now, create a chromium directory for the checkout and change to it (you can call this whatever you like and put it wherever you like, as long as the path has no spaces):
$ mkdir chromiumMobile builds have their setup documented elsewhere:
Check out the source code.The recommended command to check out the source is:
$ fetch --nohooks chromium # Optionally, --no-historyWith this command, the checkout will consume ~15GB of disk space.
However, if you choose to clone without git history, the checkout will total ~7.2GB. Use
--no-history with fetch to create shallow clones. Use this if you don't need repo history or want a faster clone. Later, git fetch --unshallow can be used to deepen these shallow clones.The fetch can take > 30 min on the fastest connections, and many hours on a slow connection.
Install any necessary dependenciesIf you're on Linux:
$ ./build/install-build-deps.shIf you're on Mac, you need Xcode 5+ to build. (See Mac build instructions for more info).
If you're on Windows, you need Visual Studio 2015 in order to build (see Build Instructions (Windows) for more info; for Googlers, runhooks will install it automatically).
Optional: install API keys which allow your build to use certain Google services.
Run post-sync hooksFinally, runhooks to run any post-sync scripts
$ gclient runhooksNavigate the codebaseFor navigating the codebase, we recommend either browsing the repo or using the code search tool, but there are other ways to browse the Chromium code.
Update the checkoutWhen changes have landed in the source repository and you want to pull those changes into your local checkout, run the following two commands in the root of your src/ checkout:$ git rebase-updateThe first updates the primary Chromium source repository (and rebases your local development branches on top of tip-of-tree), and the second updates all of the dependencies specified in the DEPS file, and deletes any removed folders for you (if you'd like to keep them, don't pass --delete and instead gclient sync will give you warnings about which directories to manually remove). You can read more about our helpful Git tools here, and do a tutorial of all of them here.
If you've checked out the code, you should see the following files and folders in the directory where you ran fetch:
Build commands are generally executed from the src directory:
$ cd src
For a full list of parameters to ninja and what they do, run ninja --help . You can also find more specific build instructions depending on your host and target platform:
TargetsYou can build other targets, such as unit_tests, by changing the target:
$ ninja -C out/Debug unit_tests Some commonly-compiled targets are chrome, unit_tests, browser_tests, components_unittests, content_browsertests, content_unittests, gpu_unittests, and net_unittests. You can find GN targets by running gn ls out/Default from the command line, and GYP targets by grepping .gyp/.gypi files for the string 'target_name':
A bash completion script can be used to tab-complete ninja targets. You simply need to add path/to/bash-completion to your .bashrc to use it.
Running ChromiumYou can run chrome with:
$ out/Debug/chrome You can run the unit tests, for example, with:
$ out/Debug/unit_tests You can specify only a certain set of tests to run using --gtest_filter , e.g.:
$ out/Debug/unit_tests --gtest_filter="PushClientTest.*" You can find out more about GoogleTest on the GoogleTest wiki page.
The best way to debug chrome depends on your platform:
Submitting your codeYou can find detailed instructions on how to submit your code on the depot_tools manpage.
Create a new review with:
$ git cl upload This will upload your code to https://codereview.chromium.org/. You should then add reviewers (see the help command below) and submit your code for review. You can also run your code on the trybots to see if it passes all the tests:
$ git cl try For a full list of options, run git cl help , or for help with a particular command just append --help , e.g. git cl upload --help .
Keeping Multiple ChangesYou can use branches in your local repository to help separate multiple changes you are submitting to the Chromium code. For more help with branches, see the Working with Branches tutorial, or the Managing Multiple CLs and Managing Dependent CLs sections of the man page. You can also set up multiple working directories to have multiple directories that build Chrome all share the same git database.
Changing the RepoChromium uses branches and tags to separate the various versions and releases it manages (see Working with Release Branches). The repository also contains many sub-repositories that point to external repos using the DEPS files (see the Working with Nested Repositories tutorial). Although we would prefer if you commit changes using the process above, sometimes you do need to commit or revert changes manually. You can also find out more about merging changes into release branches on the git-drover tutorial page:
Getting HelpIf you can't get chrome to build and you're not sure why, try the following:
|
For Developers > How-Tos >
