https://medium.com/flutter-io/flutters-ios-application-bundle-6f56d4e88cf8
This document describes how Flutter’s build system converts your Flutter project (along with its assets), into an iOS application bundle. I hope to demystify some of the build steps and explain the purpose of generated artifacts, so that you can integrate the same processes into your custom build environment.
A note about workflow: When building your application for release, you may use Flutter tooling, which makes the build process easy. However, some developers may find that this process is not as configurable, or doesn’t fit well in their custom build or continuous integration (CI) setups.
If you have a custom Xcode build or Gradle setup, all the "magic" added by Flutter tooling is optional, and you can configure the build to suit your own workflow.
All the information in this document applies to iOS application bundles prepared for release to the App Store. This means projects built to Flutter’s release mode. Compiling to either debug or profile mode uses a different runtime and packaging model in order to support tooling such as hot reload and observatory.
A Flutter application renders the user interface into a single view in the native view hierarchy.
本文档描述了Flutter的构建系统如何将Flutter项目(及其资产)转换为iOS应用程序包。我希望揭开一些构建步骤的神秘面纱并解释生成工件的目的,以便您可以将相同的流程集成到自定义构建环境中。
关于工作流的注意事项:在构建应用程序以进行发布时,您可以使用Flutter工具,这使构建过程变得简单。但是,一些开发人员可能会发现此过程不是可配置的,或者不适合他们的自定义构建或持续集成(CI)设置。
如果您有自定义Xcode构建或Gradle设置,则Flutter工具添加的所有“魔法”都是可选的,您可以配置构建以适合您自己的工作流程。
本文档中的所有信息均适用于准备发布到App Store的iOS应用程序包。这意味着为Flutter的发布模式构建的项目。编译为调试或配置文件模式使用不同的运行时和打包模型,以支持热重载和天文台等工具。
Flutter应用程序将用户界面呈现为本机视图层次结构中的单个视图。
The Application Bundle
The application bundle created using the flutter build ios --release command (or using your IDE) looks remarkably similar to a typical iOS app bundle that contains the application executable along with any referenced frameworks and resources.
Flutter’s generated bundle for the Runner app:
应用程序包
使用flutter build ios --release命令(或使用您的IDE)创建的应用程序包看起来非常类似于包含应用程序可执行文件以及任何引用的框架和资源的典型iOS应用程序包。
Flutter为Runner应用程序生成的包:
Compiling the Application
When compiling a release mode version of the app (as opposed to profile or debug modes), artifacts from both the buildbots and your host machine are needed. (For more information on the buildbots, part of the engine build that uses GN and Ninja, see Contributing to the Flutter engine.)
When you install the SDK, Flutter tools are cached on your machine. You can see them by looking inside the bin/cache directory in your copy of the Flutter SDK. If you decide to integrate any steps of this process into your own build system, this directory contains all the versioned tools you need for working with Flutter.
The following sections describe some of the files unique to Flutter’s iOS app bundles.
Flutter Engine framework bundle
The Flutter.framework directory, packaged as an iOS framework bundle, includes:
Flutter engine
Contains the core libraries (for example, graphics, file and network I/O, accessibility support, plugin architecture), the DartVM, and the Skia renderer.
Assets referenced by the Flutter engine
This currently is just ICU data.
The buildbots generate the Flutter engine framework bundle, and the Flutter tools download and cache it on your machine.
编译应用程序
在编译应用程序的发布模式版本时(与配置文件或调试模式相反),需要来自buildbots和主机的工件。 (有关buildbots的更多信息,使用GN和Ninja的引擎构建的一部分,请参阅Conututing to Flutter引擎。)
安装SDK时,Flutter工具将缓存在您的计算机上。您可以通过查看Flutter SDK副本中的bin / cache目录来查看它们。如果您决定将此过程的任何步骤集成到您自己的构建系统中,则此目录包含使用Flutter所需的所有版本化工具。
以下部分描述了Flutter iOS应用程序包的一些独特文件。
Flutter Engine框架包
Flutter.framework目录打包为iOS框架包,包括:
颤动发动机
包含核心库(例如,图形,文件和网络I / O,可访问性支持,插件架构),DartVM和Skia渲染器。
Flutter引擎引用的资产
目前这只是ICU数据。
buildbots生成Flutter引擎框架包,Flutter工具下载并将其缓存在您的计算机上。