Skip to content

Repo Manifest Format

EastWoodYang edited this page Oct 23, 2019 · 6 revisions

The repo manifest file describes the organizational structure of the project and the dependencies of the internal modules.

Contents


XML File Format

A manifest XML file (e.g. repo.xml) roughly conforms to the following DTD:

<!DOCTYPE manifest [
  <!ELEMENT manifest (default?,
                      project*,
                      module*)>

  <!ELEMENT default EMPTY>
  <!ATTLIST default fetch             CDATA #IMPLIED>
  <!ATTLIST default push              CDATA #IMPLIED>

  <!ELEMENT project (include*)>
  <!ATTLIST project origin            CDATA #IMPLIED>

  <!ELEMENT include EMPTY>
  <!ATTLIST include name              IDREF #REQUIRED>

  <!ELEMENT module (dependencies*)>
  <!ATTLIST module name               ID #REQUIRED>
  <!ATTLIST module branch             CDATA #IMPLIED>
  <!ATTLIST module origin             CDATA #IMPLIED>
  <!ATTLIST module path               CDATA #IMPLIED>
  <!ATTLIST module substitute         CDATA #IMPLIED>
  
  <!ELEMENT dependencies ANY>

]>

A description of the elements and their attributes follows.

Element manifest

The root element of the file.

Element default

Attribute fetch: The Git URL prefix for all modules and project which use this fetch. Each module's origin or project's origin is appended to this prefix to form the actual URL used to clone the project.

Attribute push: The Git “push” URL prefix for all modules and project which use this push. Each module's origin or project's origin is appended to this prefix to form the actual URL used to “git push” the project. This attribute is optional; if not specified then “git push” will use the same URL as the fetch attribute.

Element project

At most one project element may be specified. The project element describes the remote Git repository URL of the root project. The root project must have the most basic project structure of the Gradle project and include repo.xml:

.
├── build.gradle
├── repo.xml
└── settings.gradle

NOTE: must apply gradle-repo plugin in build.gradle and settings.gradle.

Attribute origin: The URL of the remote Git repository. the actual URL format: ${fetch}/${origin}.git, or the full URL.

Element module

One or more module elements may be specified.
Each module element represents a module in the project. Its describes the module's remote Git repository URL, local branches used, and other related configurations.

Attribute name: A unique name for this module. The module name must match the directory name of this module.

Attribute local: The path of the module relative to the root project. Cannot be outside the root project path. If not specified, it is located under the root project directory by default. This attribute is optional;

Attribute origin: The URL of the remote Git repository. the actual URL format: ${fetch}/${origin}.git, or the full URL.

Attribute branch: The name of the Git branch. If not specified, it is consistent with the project branch.

Attribute substitute: Replaced dependency. More detail see DependencySubstitutions:substitute.

Element include

Zero or more include elements may be specified as children of a project element.
Define which module and the root project are in the same Git repository.

  • Attribute name: The value must match the element module name.
Element dependencies

At most one project may be specified as children of a module element.
Used to declare dependencies between modules.

Chile Element Node Name must match the name Gradle Dependency Configurations identified. e.g.

<?xml version='1.0' encoding='UTF-8'?>  
<manifest>  
	...
    <module name="app">  
        <dependencies>  
            <api name="mylibrary2" />
            <debugApi name="mylibrary2" />
            <implementation name="mylibrary2" />
            ... 
        </dependencies>  
    </module>   
    ...
</manifest>

Attribute name: The value must match the element module name.

repo-local.xml

Under root project directory ($root_project/repo-local.xml)。Only the module element and the dependencies element are supported in the local manifest. e.g.

<?xml version='1.0' encoding='UTF-8'?>  
<manifest>

    <module name="xxx">  
        <dependencies>  
            <implementation name="xxx" />  
        </dependencies>  
    </module>
    
    <module name="xxx" origin="xxx.git" />  
    
</manifest>