Android uses repo to manage multiple git projects. It requires a manifest XML file to indicate the attributes of these git projects.
Repo manifest XML can contain the following elements.
- Manifest: the top-level XML element.
- Remote element: sets the attributes of the remote git server, including the following attributes.
- Name: the name of the remote git server, which is directly used for git fetch, git remote, and other operations.
- Alias: the alias of the remote git server. If it is specified, it overwrites the name setting. In a manifest,
Name cannot be duplicate, but alias can be duplicate.
- Fetch: git URL prefix of all projects
- Review: Specify the Gerrit server name for the repo upload operation. If not specified, the repo upload has no effect.
Example:
<Remote fetch = "ssh: // git.example.com" name = "test" review = "gerrit.example.com"/>
- Default element: sets the default attribute values of all projects. If no attribute is specified in the project element, the attribute values of the default element are used.
- Remote: The name attribute value in a previously defined remote element, used to specify which remote git server to use.
- Revision: git branch name, such as master or refs/heads/master
- Sync_j: default number of parallel operations in repo sync.
- Sync_c: if it is set to true, only the specified Branch (specified by the revision attribute) is synchronized, instead of all the ref content.
- Sync_s: if it is set to true, the sub-project of git is synchronized.
Example:
<Default remote = "main" revision = "platform/main"/>
- Manifest-server element: you can only have one element. Its url attribute is used to specify the URL of the manifest service, usually an xml rpc service.
It supports the following RPC methods:
- GetApprovedManifest (branch, target): returns a manifest to indicate the branches and compilation targets of all projects.
The target parameter comes from the environment variables TARGET_PRODUCT and TARGET_BUILD_VARIANT to form $ TARGET_PRODUCT-$ TARGET_BUILD_VARIANT.
- GetManifest (tag): returns the manifest of the specified tag.
- Project element: Specifies a git repository to be cloned.
- Name: a unique name that identifies a project. It is also used to generate a git repository URL. The format is as follows:
$ {Remote_fetch}/$ {project_name}. git
- Path: an optional path. Specify the subdirectory where the code cloned by git is stored. If not specified, the name is used as the sub-directory name.
- Remote: specify the name of a previous remote element.
- Revision: Specifies the git submission point to be obtained, which can be the master, refs/heads/master, tag or SHA-1 values.
- Groups: Lists groups to which a project belongs. Multiple group names are separated by spaces or commas. All projects automatically belong to the "all" group. Each project automatically belongs
Name: 'name' and path: 'path' groups. For example, <project name = "monkeys" path = "barrel-of"/> automatically belongs to the default, name: monkeys, and path: barrel-of group. If a project belongs to the notdefault group, it will not be downloaded during repo sync.
- Sync_c: if it is set to true, only the specified Branch (specified by the revision attribute) is synchronized, instead of all the ref content.
- Sync_s: if it is set to true, the sub-projects of git are synchronized.
- Upstream: The git branch in which a SHA1 can be found. Used to synchronize the manifest (-c mode) locked by revision ). This mode avoids synchronizing the entire ref space.
- Annotation: there can be multiple annotation, in the format of name-value pair. In the repo forall command, these values are imported to the environment variable.
- Remove-project: delete a specified project from the internal manifest table. It is often used in local manifest files. You can replace the definition of a project.
Example:
<Project groups = "aosp" path = "device/driver/armv7" revision = "600aab270ce712b62b268055737cabcded59bf04"/>
- Include: You can use the name attribute to introduce another manifest file (the path is relative to the manifest repository's root ).
Local manifest
The local manifest file is stored in $ (TOP_DIR)/. repo/local_manifest/*. xml. $ TOP_DIR/. repo/local_manifests/local_manifest.xml
If yes, it is first loaded. Then the $ TOP_DIR/. repo/local_manifests/*. xml file is in alphabetical order. These manifest will be synchronized in the repo sync
Previously processed. Allows repo to download and manage additional projects.
Example:
$ Ls. repo/local_manifests
Local_manifest.xml
Another_local_manifest.xml
$ Cat. repo/local_manifests/local_manifest.xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<Manifest>
<Project path = "manifest"
Name = "tools/manifest"/>
<Projectpath = "platform-manifest"
Name = "platform/manifest"/>
</Manifest>