maruel | 9e198a8 | 2016-08-11 15:32:19 | [diff] [blame] | 1 | # gclient |
| 2 | |
| 3 | gclient is a tool for managing a modular checkout of source code from multiple |
| 4 | source code repositories. It wraps underlying source code management commands |
| 5 | to provide support for distributing tree updates, status commands, and diffs |
| 6 | across multiple checked-out working directories. |
| 7 | |
| 8 | The gclient script is controlled by a `.gclient` file at the top of a directory |
| 9 | tree which will contain source code from multiple locations. A `.gclient` file |
| 10 | is a Python script that defines a list of `solutions` with the following format: |
| 11 | |
| 12 | solutions = [ |
| 13 | { "name" : "src", |
| 14 | "url" : "svn://svnserver/component/trunk/src", |
| 15 | "custom_deps" : { |
| 16 | # To use the trunk of a component instead of what's in DEPS: |
| 17 | #"component": "https://svnserver/component/trunk/", |
| 18 | # To exclude a component from your working copy: |
| 19 | #"data/really_large_component": None, |
| 20 | } |
| 21 | }, |
| 22 | ] |
| 23 | |
| 24 | A `solution` is a collection of component pieces of software that will be |
| 25 | checked out in a specific directory layout for building together. |
| 26 | |
| 27 | Each entry in the `solutions` list is defined by a Python dictionary that |
| 28 | contains the following items: |
| 29 | |
| 30 | - `name`: The name of the directory in which the solution will be checked out. |
| 31 | - `url`: The URL from which this solution will be checked out. gclient expects |
| 32 | that the checked-out solution will contain a file named `DEPS` that in turn |
| 33 | defines the specific pieces that must be checked out to create the working |
| 34 | directory layout for building and developing the solution's software. |
| 35 | - `deps_file`: A string containing just the filename (not a path) of the file in |
| 36 | the solution dir to use as the list of dependencies. This tag is optional, and |
| 37 | defaults to `DEPS`. |
| 38 | - `custom_deps`: A dictionary containing optional custom overrides for entries |
| 39 | in the solution's `DEPS` file. This can be used to have the local working |
| 40 | directory *not* check out and update specific components, or to sync the local |
| 41 | working-directory copy of a given component to a different specific revision, |
| 42 | or a branch, or the head of a tree. It can also be used to append new entries |
| 43 | that do not exist in the `DEPS` file. |
| 44 | |
| 45 | Within each checked-out solution, gclient expects to find a file typically named |
| 46 | `DEPS` (it actually uses the value of the `deps_file` key above) which defines |
| 47 | the different component pieces of software that must be checked out for the |
| 48 | solution. The `DEPS` file is a Python script that defines a dictionary named |
| 49 | `deps`: |
| 50 | |
| 51 | deps = { |
| 52 | "src/outside": "https://outside-server/one/repo.git@12345677890123456778901234567789012345677890", |
| 53 | "src/component": "https://dont-use-github.com/its/unreliable.git@0000000000000000000000000000000000000000", |
| 54 | "src/relative": "/another/repo.git@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", |
| 55 | } |
| 56 | |
| 57 | Each item in the `deps` dictionary consists of a key-value pair. The key is the |
| 58 | directory into which the component will be checked out, relative to the |
| 59 | directory containing the `.gclient` file. The value is the URL from which that |
| 60 | directory will be checked out. If there is no address scheme (that is, no |
| 61 | `http:` or `svn:` prefix), then the value must begin with a slash and is treated |
| 62 | relative to the root of the solution's repository. |
| 63 | |
| 64 | The URL typically contains a specific revision or change number (as appropriate |
| 65 | for the underlying SCM system) to `freeze` the external software at a specific, |
| 66 | known state. Alternatively, if there is no revision or change number, the URL |
| 67 | will track the latest changes on the specific trunk or branch. |