background

  1. To explore the performance of Flutter Webpng.
  2. Learn the Flutter Engine code
  3. Try to step through the Flutter Engine

To prepare

  1. Depot_tools toolkit
$ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
$ export PATH=$PATH:/path/to/depot_tools
Copy the code

Remember to use source for a long time.

  1. Python v2.7

  2. gclient

  3. Website: github.com/flutter/flu…

Access to rely on

  1. The Fork github.com/flutter/eng… Note: Configure the SSH key and use the SSH download mode when gc sync is performed.

  2. Create the engine folder

  3. Gclient Edit the. Gclient file in the engine folder

$ vim .gclient

Content:

solutions = [
  {
    "managed": False,
    "name": "src/flutter"."url": "[email protected]:< your name >/engine.git"."custom_deps": {},
    "deps_file": "DEPS"."safesync_url": "",},]Copy the code
  1. Go to the engine directory and run the $gclient sync command to obtain all Flutter dependencies.

  2. Synchronize the Flutter Engine code

$ cd src/flutter
$ git remote add upstream [email protected]:flutter/engine.git
$ git pull upstream master 
Copy the code

The Flutte Engine version is synchronized

  1. Under engine/ SRC/Flutter, get the required version number for the current FLUTTER SDK. cat $FLUTTER_SDK_PATH/bin/internal/engine.version

  2. Reset the Flutter Engine to the specified SHA-1. git reset –hard ${engine.version}

  3. Finally, GClient synchronizes the Engine dependencies. gclient sync –with_branch_heads –with_tags

Generate engineering

  • Generated uncompiled project for ios devices./flutter/tools/gn –ios –unoptimized

  • Project generated for ios devices, without symbol table./flutter/tools/gn –ios

  • $./flutter/tools/gn –ios — run-time =release

  • /flutter/tools/gn –ios –simulator

  • Generate unoptimized version for simulator./flutter/tools/gn –ios –simulator — Unoptimized

  • /flutter/tools/gn — runtimemode =release –ios — ios-CPU =arm64

compile

Flutter Engine is compiled using Ninja, which was previously available in the DepTools kit. In the engine/ SRC directory.

  • $ninja -c out/ iOS_release

  • The real machine uses unsigned debug mode: ninja -c out/ iOS_DEBUG && ninja -c out/ host_DEBUG

  • The real machine uses signed debug mode: ninja -c out/ iOS_DEBUG_unopt && ninja -c out/host_debug_unopt

  • Debug mode used by the compiler: ninja -c out/ iOS_DEBUg_sim_unopt && ninja -c out/host_debug_unopt

debugging

Debugging using the official recommended LLDB debugging is complicated, so I recommend using Xcode directly embedded engineering.

  1. Drag products.xcodeProj from Flutte Engine into the Demo project directory that you want to debug

FLUTTER_ROOT=The ${} FlutterSDK path
FLUTTER_APPLICATION_PATH=${Demo project path}
FLUTTER_TARGET=${Demo project path}/lib/main.dart
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/.. /build/ios FLUTTER_FRAMEWORK_DIR=${Flutter_Engine code path}/ SRC/out/ios_debug_sim_unopt FLUTTER_BUILD_NAME = 1.0.0 FLUTTER_BUILD_NUMBER FLUTTER_ENGINE = = 1${Flutter_Engine code path}
LOCAL_ENGINE=${output path (ios_debug_sim_unopt)}
ARCHS=${supported architectures (ARM64)} 
Copy the code
  1. Finally, you can step it.

The last

Finally, this can be broken directly into the Flutter Engine. I found that the optimization of Flutter for Webpng on iOS platform is limited, and finally our multi-graph list needs further optimization.

reference

Thank you

Taught you how to compile the Flutter engine www.jianshu.com/p/6519ed563…

The Compiling the engine github.com/flutter/flu…