You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否通过local_manifest.xml从单个仓库提取Android 10的多个指定目录?

单个Bitbucket仓库同步Android的external、kernel、vendor目录实现方案

完全可以实现将这三个目录合并到单个Bitbucket仓库,通过修改local_manifest.xml配置完成同步映射,具体步骤如下:

1. 合并原三个仓库到单个Bitbucket仓库

  • 在本地新建git仓库,初始化后创建external、kernel、vendor三个子目录
  • 将原external仓库的所有内容复制到新仓库的external目录,提交后推送到本地Bitbucket的目标仓库
  • 重复上述操作,分别将原kernel、vendor仓库的内容复制到新仓库对应子目录,完成提交推送

2. 修改local_manifest.xml配置

移除原有针对三个独立仓库的remove-project和project标签,替换为以下配置:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
    <!-- 移除原三个仓库的配置(替换为你实际的仓库name) -->
    <remove-project name="platform/external"/>
    <remove-project name="kernel/common"/>
    <remove-project name="vendor/manufacturer"/>

    <!-- 定义本地Bitbucket远程仓库(如果主manifest已定义可省略) -->
    <remote name="local-bitbucket"
            fetch="ssh://git@你的Bitbucket服务器地址:7999/"
            review="你的Bitbucket服务器地址"/>

    <!-- 拉取合并后的单个仓库 -->
    <project name="你的项目名/android_combined_repo"
             path="tmp/combined_repo"
             remote="local-bitbucket"
             revision="master">
        <!-- 映射仓库子目录到源码根目录对应路径 -->
        <linkfile src="external" dest="external"/>
        <linkfile src="kernel" dest="kernel"/>
        <linkfile src="vendor" dest="vendor"/>
    </project>
</manifest>

3. 同步验证

  • 执行repo sync命令,系统会拉取合并后的仓库到tmp/combined_repo,并在Android源码根目录创建external、kernel、vendor的符号链接,指向仓库内的对应子目录
  • 若不需要符号链接,可将linkfile标签替换为copyfile,同步时会直接复制目录内容到目标路径,但后续更新需重新执行repo sync触发复制

注意事项

  • 确保合并后的仓库目录结构完整,每个子目录对应原仓库的全部内容
  • revision字段可指定具体分支、tag或commit hash,适配你的版本需求
  • 远程仓库地址需替换为你本地Bitbucket的实际访问路径

内容的提问来源于stack exchange,提问作者user2669989

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 19:40:42