1. 安装depot_tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
2. 配置环境变量
export PATH="$PATH:/path/to/depot_tools"
3. 创建chromium目录
mkdir chromium && cd chromium
4. 获取代码
fetch ios
如果想要仓库小一些可以 fetch --nohooks --no-history ios
由于vpn差或者网络不稳定,这步经常失败,失败的话可以gclient sync --force继续。或者直接从github镜像拉取代码 git clone https://github.com/chromium/chromium.git
拉取代码之后需要在src同级目录生成.gclient 文件 touch .gclient, 文件内容为
solutions = [
{
"name": "src",
"url": "https://chromium.googlesource.com/chromium/src.git",
"managed": False,
"custom_deps": {},
"custom_vars": {},
},
]
target_os = ["ios"]
target_os_only = "True"
5. 安装依赖
gclient sync
6. 生成xcode工程
进入 chromium/src/components/cronet/tools/ 目录
./cr_cronet.py gn -i --release 真机release
./cr_cronet.py gn --release 模拟器release
./cr_cronet.py gn -i 真机debug
./cr_cronet.py gn 模拟器debug