Skip to content

feat: add snapshot build script for HarmonyOS Flutter SDK - #17

Open
YoloMao wants to merge 1 commit into
masterfrom
feat/ohos-snapshot-script
Open

feat: add snapshot build script for HarmonyOS Flutter SDK#17
YoloMao wants to merge 1 commit into
masterfrom
feat/ohos-snapshot-script

Conversation

@YoloMao

@YoloMao YoloMao commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

概述

为 HarmonyOS 特制版 Flutter SDK(openharmony-sig/flutter_flutter)提供无埋点 AOP snapshot 的构建能力。特制版的 Dart VM 由 引擎 dart 补丁 重新构建,上游构建的 snapshot 加载时报 Wrong full snapshot version,故需专用构建流程与专用 tag。

变更内容

  • 新增 flutter_snapshot_dump_ohos.sh:可复用的 ohos snapshot 构建脚本,用于制作 3.xx.x-ohos 版本,流程为:
    1. checkout 上游 dart-lang/sdk 对应版本源码
    2. 应用 dart_flutter.patch(AOP 转换器)
    3. 下载并应用 gitee 引擎仓库 attachment/repos/dart.<dart_version>.patch(ohos 支持)
    4. 对齐 pkg/vm 的 FFI ABI 列表(gitee 补丁缺少 ohosX64,与引擎 platform dill 不一致会报 Type IntPtr has no mapping for ABI,脚本自动补齐)
    5. 用特制版 SDK 内置的 dart 二进制构建 JIT + AOT snapshot(snapshot 版本哈希由构建所用 dart 二进制决定,因此无需编译 engine)
  • README 新增 HarmonyOS 章节:集成方式(3.22 起工具链实际加载的是 AOT 版 frontend_server_aot.dart.snapshot,必须替换)与新版本制作流程

验证

  • flutter 3.22.1-ohos-1.0.4(Dart 3.4.0)下构建通过,dump_kernel 确认 app.dill 中 29 处钩子调用点(GestureRecognizer/PageRoute/SchedulerBinding 等)
  • 真机(OpenHarmony 6.1.0,CDP 模式)验证无埋点 PAGE / VIEW_CLICK 事件正常上报
  • 首个产物已发布为 tag 3.22.1-ohosrelease/3.22.1-ohos 分支,含 darwin_arm64 AOT + JIT 产物)

🤖 Generated with Claude Code

The OpenHarmony Flutter SDK rebuilds the Dart VM with its own patches,
so snapshots built against upstream Dart fail to load (wrong full
snapshot version). flutter_snapshot_dump_ohos.sh builds JIT + AOT
frontend server snapshots with the ohos SDK's own dart binary, on top
of dart_flutter.patch plus the OpenHarmony engine dart patch, aligning
the pkg/vm ffi abi list (ohosX64) with the engine platform dill.

Verified with flutter 3.22.1-ohos-1.0.4 (Dart 3.4.0): injection call
sites present in app.dill and autotrack events reported on device.
Released as tag 3.22.1-ohos.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant