搭建 android 代码镜像服务
16lz
2021-12-04
1. 搭建 git 服务器
git服务器有很多,比如使用android 提供的 gerrit 服务器,安装方法参见gerrit 环境搭建
2 同步远程库
$ mkdir ~/review_site/git/google$ cd ~/review_site/git/google$ repo init -u https://android.googlesource.com/platform/manifest$ head -n 12 .repo/manifest.xml直接同步(sync)会出现”代码库不存在“错误,是因为使用的repo不支持manifest相对路径。 如果从http://android.git.kernel.org/repo 下载 repo 就会有这个问题,建议从https://chromium.googlesource.com/external/repo 下载 需要参照上面修改.repo/manifest.xml 文件中的 fetch 节点,然后再同步。<?xml version="1.0" encoding="UTF-8"?>
<manifest> <remote name="aosp" fetch="https://android.googlesource.com/" review="https://android-review.googlesource.com/" /> <default revision="master" remote="aosp" sync-j="4" /> <project path="build" name="platform/build" groups="pdk" > <copyfile src="core/root.mk" dest="Makefile" />$ repo sync
3 调整代码库
如果需要对 android 进行二次开发,最好创建自己的分支,方法如下:3.1 所有项目增加分支
直接在代码库中执行$ repo forall -c git branch --no-track mybranch master
3.2 manifest 项目增加相应分支
- 首先,在本地同步manifest 库
$ cd ~$ git clone ~/review/git/platform/manifest.git
- 其次,增加新分支,并对 default.xml 作相应调整
$ cd ~/manifest$ git checkout -b mybranch origin/master$ head -12 defalut.xml<?xml version="1.0" encoding="UTF-8"?><manifest> <remote name="myserver" fetch=".." /> <default revision="mybranch " remote="myserver" sync-j="1" /> <project path="build" name="platform/build"> <copyfile src="core/root.mk" dest="Makefile" /> </project>
- 推送到代码库中
$ git add defalut.xml$ git commit -m "modify manifest"$ git push origin mybranch:mybranch
更多相关文章
- android源代码下载
- android 单选框
- Android(安卓)zxing change orientation to portrait
- Android(安卓)SyncManager 实现
- How To Open An URL In Android’s Web Browser
- Android也有beacon了
- 利用Handler来更新android的UI
- 系出名门Android(8) - 控件(View)之TextSwitcher, Gallery, Imag
- Android(安卓)旋转屏幕捕获当前屏幕的状态