Android Repo的manifest XML檔案格式

來源:互聯網
上載者:User

Android使用repo來管理多個git項目。它需要一個manifest  XML檔案來指示這些git項目的屬性。

repo manifest XML可以包含下面的元素。

  • manifest: 最頂層的XML元素。
  • remote元素: 設定遠程git伺服器的屬性,包括下面的屬性
    • name: 遠程git伺服器的名字,直接用於git fetch, git remote 等操作
    • alias: 遠程git伺服器的別名,如果指定了,則會覆蓋name的設定。在一個manifest中,
      name不能重名,但alias可以重名。
    • fetch: 所有projects的git URL 首碼
    • review: 指定Gerrit的伺服器名,用於repo upload操作。如果沒有指定,則repo upload沒有效果。

Example:

<remote fetch="ssh://git.example.com" name="test"review="gerrit.example.com"/>

 

  • default元素:設定所有projects的預設屬性值,如果在project元素裡沒有指定一個屬性,則使用default元素的屬性值。

    • remote: 之前定義的某一個remote元素中name屬性值,用於指定使用哪一個遠程git伺服器。
    • revision: git分支的名字,例如master或者refs/heads/master
    • sync_j: 在repo sync中預設並行的數目。
    • sync_c: 如果設定為true,則只同步指定的分支(revision 屬性指定),而不是所有的ref內容。
    • sync_s: 如果設定為true,則會同步git的子項目

Example:

<default remote="main" revision="platform/main"/>

 

  • manifest-server元素: 只能有一個該元素。它的url屬性用於指定manifest服務的URL,通常是一個XML RPC 服務。
    它要支援一下RPC方法:

    • GetApprovedManifest(branch, target): 返回一個manifest用於指示所有projects的分支和編譯目標。
          target參數來自環境變數TARGET_PRODUCT和TARGET_BUILD_VARIANT,組成$TARGET_PRODUCT-$TARGET_BUILD_VARIANT。
    • GetManifest(tag):  返回指定tag的manifest

 

  • project元素:指定一個需要clone的git倉庫。

    • name: 唯一的名字標識project,同時也用於產生git倉庫的URL。格式如下:
            ${remote_fetch}/${project_name}.git
    • path: 可選的路徑。指定git clone出來的代碼存放在本地的子目錄。如果沒有指定,則以name作為子目錄名。
    • remote: 指定之前在某個remote元素中的name。
    • revision: 指定需要擷取的git提交點,可以是master, refs/heads/master, tag或者SHA-1值。
    • groups: 列出project所屬的組,以空格或者逗號分隔多個組名。所有的project都自動屬於"all"組。每一個project自動屬於
      name:'name' 和path:'path'組。例如<project name="monkeys" path="barrel-of"/>,它自動屬於default, name:monkeys, and path:barrel-of組。如果一個project屬於notdefault組,則,repo sync時不會下載。
    • sync_c: 如果設定為true,則只同步指定的分支(revision 屬性指定),而不是所有的ref內容。
    • sync_s: 如果設定為true,則會同步git的子項目。
    • upstream: 在哪個git分支可以找到一個SHA1。用於同步revision鎖定的manifest(-c 模式)。該模式可以避免同步整個ref空間。
    • annotation: 可以有多個annotation,格式為name-value pair。在repo forall 命令中這些值會匯入到環境變數中。
    • remove-project: 從內部的manifest表中刪除指定的project。經常用於本地的manifest檔案,使用者可以替換一個project的定義。

Example:

             <project groups="aosp" path="device/driver/armv7" revision="600aab270ce712b62b268055737cabcded59bf04"/>

 

  • include: 通過name屬性可以引入另外一個manifest檔案(路徑相對與manifest repository's root)。

 

本地manifest

本地的manifest檔案存放在$(TOP_DIR)/.repo/local_manifest/*.xml。$TOP_DIR/.repo/local_manifests/local_manifest.xml
如果存在,會被最先裝入。然後是以字母順序的$TOP_DIR/.repo/local_manifests/*.xml檔案。這些manifest會在repo sync
之前被處理。以便repo下載和管理額外的project。

 

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>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.