0

Add documentation on contributing to depended-on projects.

Bug: none
Change-Id: Iacdbac73f92e1c188602a3afe58cc6dd9a4cdf3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5777901
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1345824}
This commit is contained in:
Peter Kasting
2024-08-23 06:22:58 +00:00
committed by Chromium LUCI CQ
parent 5845e29ceb
commit 60d3028dc5
3 changed files with 59 additions and 14 deletions

@ -133,8 +133,10 @@ Chromium workflow is not the same as the GitHub pull request workflow.
## Uploading a change for review
Note: go through the [commit checklist][commit-checklist] for Chromium before
uploading a change for review.
Note: If your change is to a dependent project, see the documentation on
[changing dependencies](dependencies.md#changing-dependencies). Otherwise, go
through the [commit checklist][commit-checklist] for Chromium before uploading a
change for review.
Chromium uses a Gerrit instance hosted at
<https://chromium-review.googlesource.com> for code reviews. In order to upload

@ -1,26 +1,27 @@
# Managing Chromium dependencies
Chromium uses gclient (part of depot_tools) to manage dependencies. Information
is stored in DEPS file located in the root of the project. In addition to DEPS
file, gclient may read git submodules (see
Chromium uses `gclient` (part of depot_tools) to manage dependencies (e.g. V8,
WebRTC). Information such as URLs and hashes is stored in the `DEPS` file
located in the root of the project. In addition to `DEPS`, `gclient` may read
git submodules (see
[depot_tools submodules support](https://docs.google.com/document/d/1N_fseFNOj10ETZG3pZ-I30R__w96rYNtvx5y_jFGJWw/view)).
gclient supports three dependency types: git, [gcs](gcs_dependencies.md), and
`gclient` supports three dependency types: git, [gcs](gcs_dependencies.md), and
[cipd](cipd_and_3pp.md).
[TOC]
## Adding dependencies
Add your entry in DEPS file. Then, run `gclient gitmodules` to generate git
submodules (it will contain .gitmodule change, and gitlink). Edit OWNERS file
and add gitlink path. Then, run `git add DEPS OWNERS` to stage those files for
commit, followed by `git commit`. Your change is now ready to be sent for a
review using `git cl upload`.
Add your entry in `DEPS`. Then run `gclient gitmodules` to generate git
submodules; this will contain the `.gitmodule` change and gitlink. Edit the
`OWNERS` file and add the gitlink path. Then, run `git add DEPS OWNERS` to stage
those files for commit, followed by `git commit`. Your change is now ready to be
sent for a review using `git cl upload`.
For example, if new dependency is "src/foo/bar.git", its gitlink path is
"foo/bar", and OWNERS entry at the top level is `per-file foo/bar=*`. You can
confirm that by running `git status`. [Example CL](https://crrev.com/c/4923074).
For example, if your new dependency is "src/foo/bar.git", its gitlink path is
"foo/bar", and the top level `OWNERS` entry is `per-file foo/bar=*`. You can
confirm this by running `git status`. [Example CL](https://crrev.com/c/4923074).
```
# manual edit of DEPS and OWNERS file (see changes below).
@ -110,6 +111,30 @@ remote: https://chromium-review.googlesource.com/c/chromium/src/+/4923074 [DEP
-- snip --
```
## Making changes to dependencies {#changing-dependencies}
If you need a change in a dependency, the general process is to first contribute
the change upstream, then [roll into Chromium](#rolling-dependencies). Some
projects (e.g. Skia) are autorolled, but it is good practice to manually roll
after an upstream change to ensure your change can be successfully rolled and
there are no resulting compile or test failures.
Upstream projects have a variety of contribution workflows. The two most common
are Gerrit-based reviews using `git cl upload` (like Chromium itself) and GitHub
PRs. Some projects have a `CONTRIBUTING.md` file in their root that gives
instructions.
In most cases, creating a standalone checkout/clone of the project you're
modifying, outside your Chromium checkout, is the best way to ensure you're
contributing to upstream `HEAD` and can run the project's presubmit checks.
Follow the project's contribution instructions (e.g. running `fetch` or
`gclient sync` as needed, possibly after downloading or cloning the source). If
you do attempt to create and upload changes directly inside submodules in your
Chromium checkout, be careful not to commit the new submodule hashes to any
Chromium changes. You may also need to
[create symlinks to enable other projects' presubmits](#presubmit-symlinks), or
else skip them by uploading with `--bypass-hooks`.
## Rolling dependencies
### Using gclient
@ -225,3 +250,20 @@ gclient gitmodules
The script will create a new .gitmodules files and update all gitlinks. Please
note that old gitlinks won't be deleted, and you will need to remove them
manually (see section above for deleting dependencies).
## Appendix: Symlinks to enable other projects' presubmits {#presubmit-symlinks}
Creating the following symlinks (POSIX: `ln -s DEST SRC`, Windows:
`mklink /D SRC DEST` from an Admin `cmd` prompt) will get other projects'
presubmit checks working, if you want to upload directly from inside your
Chromium checkout and don't want to use `--bypass-hooks`. All directories assume
you are in your Chromium `src` dir. This list is non-exhaustive; please add to
it as necessary.
* **V8:**
* Link `v8/buildtools` to `buildtools`
* Link `v8/third_party/depot_tools` to `depot_tools`
* **WebRTC:**
* Link `third_party/webrtc/build` to `build`
* Link `third_party/webrtc/buildtools` to `buildtools`
* Link `third_party/src` to `.`

@ -146,6 +146,7 @@
/spirv-headers/src
/spirv-tools/src
/sqlite4java/lib/
/src
/subresource-filter-ruleset/data/*
/swift-format
/swift-toolchain