前言
根据设置引擎开发环境的描述,确保有以下可用依赖项:
- Linux、macOS 或 Windows。
- Linux 支持 Android 和 Fuchsia 的交叉编译工件,但不支持 iOS。
- macOS 支持 Android 和 iOS 的交叉编译工件。
- Windows 不支持任何 Android、Fuchsia 或 iOS 的交叉编译工件。
- git(用于源代码版本控制)。
- 一个IDE。另请参阅本页底部的部分,了解有关在编辑引擎时设置语法突出显示的建议。
- 一个 ssh 客户端(用于通过 GitHub 进行身份验证)。
- Chromium 的 depot_tools (确保它在你的路径中)。我们使用gclien tdepot_tools 中的工具。
- Python(被我们许多工具使用,包括gclient)。
- 在 macOS 和 Linux 上:curl 和 unzip(被gclient sync使用)。
- 在 Windows 上:
- Visual Studio 2017 或更高版本(仅非 Google 员工需要)。
- Windows 10 SDK(仅非 Google 员工需要)。
- 请务必安装“Windows 调试工具”功能。
- 在 macOS 上:最新的 Xcode。
- 推荐给 Google 员工:用于分布式构建的 Goma。该编译页有关于如何设置此详细信息。
不需要安装Dart,因为 Dart 工具链会作为“获取代码”步骤的一部分自动下载。类似的对于 Android SDK,它是通过以下gclient sync步骤下载的。
1 flutter engine
1.1 win10
根据flutter官方的wiki设置引擎开发环境,做好前置工作,主要是depot_tools的安装
depot_tools是Google专门为开发大项目开发的.git代码仓库管理的python脚本,统一管理整个源码仓库的所有依赖,depot_tools使用说明
但是给的链接不能访问,找到以下命令git下载depot_tools,但是这个仍然需要科学上网,这里可以直接看第1.2章
git clone https://chromium.googlesource.com/chromium/tools/depot_tools
用git下载好后,得到depot_tools文件夹,可以将depot_tools路径加到环境变量PATH
Fork https://github.com/flutter/engine到你自己的GitHub帐户
然后创建engine文件夹,在engine文件夹内创建.gclient文件,并且替换<your_name_here>为你的GitHub帐户名
solutions = [
{
"managed": False,
"name": "src/flutter",
"url": "git@github.com:<your_name_here>/engine.git",
"custom_deps": {
},
"deps_file": "DEPS",
"safesync_url": "",
"custom_vars" : {
"download_android_deps" : False,
"download_windows_deps" : False,
},
},
]
然后在engine目录执行
../depot_tools/gclient sync
报错如下,这是在win10系统下,这是不能访问服务器导致
Downloading CIPD client for windows-amd64 from https://chrome-infra-packages.appspot.com/client?platform=windows-amd64&version=git_revision:9464003f070813371070f9b8f7c350d87619d145...
Failed to download the file, check your network connection, 使用“2”个参数调用“DownloadFile”时发生异常:“无法连接到远程服务器”
Retrying after a short nap...
Failed to download the file, check your network connection, 使用“2”个参数调用“DownloadFile”时发生异常:“无法连接到远程服务器”
Retrying after a short nap...
Failed to download the file, check your network connection, 使用“2”个参数调用“DownloadFile”时发生异常:“无法连接到远程服务器”
所在位置 D:\depot_tools\.cipd_impl.ps1:112 字符: 5
+ throw "Failed to download the file, check your network connection ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<