README.md
1# Third-Party Dependencies
2
3The Open Screen library includes its dependencies as DEPS in the source
4tree under the `//third_party/` directory. They are structured as follows:
5
6```
7 //third_party/<library>
8 BUILD.gn
9 ...other necessary adapter files...
10 src/
11 <library>'s source
12```
13
14## Adding a new dependency
15
16When adding a new dependency to the project, you should first add an entry
17to the DEPS file. For example, let's say we want to add a
18new library called `alpha`. Opening up DEPS, you would add
19
20``` python
21 deps = {
22 ...
23 'src/third_party/alpha/src': 'https://repo.com/path/to/alpha.git'
24 + '@' + '<revision>'
25```
26
27Then you need to add a BUILD.gn file for it under `//third_party/alpha`,
28assuming it doesn't already provide its own BUILD.gn.
29
30Finally, add a new entry for the "src" directory of your dependency to
31the //third_party/.gitignore.
32
33## Roll a dependency to a new version
34
35Rolling a dependency forward (or to any different version really) consists of
36two steps:
37 1. Update the revision string for the dependency in the DEPS file.
38 1. `git add` the DEPS file and commit, then run gclient sync.
39
40Of course, you should also make sure that the new change is still compatible
41with the rest of the project, including any adapter files under
42`//third_party/<library>` (e.g. BUILD.gn). Any necessary updates to make the
43rest of the project work with the new dependency version should happen in the
44same change.
45
46## Build Failures
47
48If after running `gclient sync`, your build starts failing due to errors in
49`//third_party/`, then do the following:
50
51 1. Delete the `//out/` directory.
52 1. Delete the `src/` directory of the failing `//third_party` library.
53 1. Re-run `gclient sync`.
54
55This will remove any directories and files which were removed in the updated
56library but not deleted by `gclient sync`.
57