Compare commits

...
8 Commits
13 changed files with 327 additions and 54 deletions

No files matched your search

+3
View File
@@ -16,6 +16,9 @@ node_modules/
# HarmonyOS / DevEco common outputs
.local/
.cache/
local.properties
AppScope/*.p12
AppScope/*.mobileprovision
# Logs
*.log
+95 -38
View File
@@ -1,53 +1,110 @@
# MRP Simulator HarmonyOS
MRP 模拟器鸿蒙化项目。
HarmonyOS 侧的 MRP 模拟器 POC/Alpha 工程。
当前目标不是直接做“大而全”的正式产品,而是先完成一轮 **HarmonyOS 技术验证 / POC**,验证现有 MRP 模拟器能力是否能在鸿蒙侧形成稳定闭环。
当前代码状态不是“纯方案仓库”,而是已经包含:
- **标准 HarmonyOS/DevEco 工程壳**
- **ArkTS 壳层页面与运行页占位链路**
- **Native/NAPI/C++ 最小骨架**
- **RunPage -> Native smoke start -> pullFrame() 占位渲染** 的首轮联调路径
## 当前阶段
---
处于 **第一阶段:方案收敛 + 技术验证准备**。
当前共识:
- 一期按 **POC / Alpha** 推进
- 先做 **单实例、本地导入、可启动、可渲染、可输入、可退出、可存档**
- 推荐路线:
- **ArkTS 做应用壳/UI**
- **C++ 做模拟器核心**
- **NAPI 做粗粒度桥接**
- 服务端/BFF 暂不进入运行时闭环,只在后续按需参与外围能力
## 目录说明
## 当前仓库结构(最小可导入)
```text
.
├─ docs/
│ ├─ project/
│ ├─ product/
│ ├─ architecture/
│ ├─ harmonyos/
│ └─ qa/
├─ research/
├─ prototypes/
└─ scripts/
├─ AppScope/
│ └─ app.json5
├─ build-profile.json5
├─ hvigorfile.ts
├─ hvigorw
├─ hvigorw.bat
├─ local.properties.example
├─ oh-package.json5
├─ entry/
│ ├─ build-profile.json5
│ ├─ oh-package.json5
│ └─ src/main/
│ ├─ module.json5
│ ├─ ets/
│ ├─ cpp/
│ └─ resources/
└─ README.md
```
## 当前文档
---
- 项目链路:`docs/project/AGENT_CHAIN.md`
- 项目概览:`docs/project/PROJECT_OVERVIEW.md`
- 一期范围:`docs/product/MVP_SCOPE.md`
- 第一轮架构判断:`docs/architecture/ARCHITECTURE_V1.md`
- 鸿蒙技术路线:`docs/harmonyos/HARMONYOS_TECH_ROUTE_V1.md`
- 下一步行动项:`docs/project/NEXT_ACTIONS.md`
## 先说明 3 个容易误解的点
## 下一步
### 1. `local.properties`
这是**本地机器文件**,不应提交真实值进仓库。
仓库提供了:
- `local.properties.example`
1. 明确现有 MRP 模拟器代码资产与语言栈
2. 识别可复用核心与必须重写部分
3. 建立 HarmonyOS POC 工程骨架
4. 选定首批样例集并形成验证基线
你需要自己复制一份:
## 状态说明
```bash
cp local.properties.example local.properties
```
当前仓库以 **方案与技术验证文档** 为主,代码实现将在明确现有内核资产后逐步落地。
然后把 `hwsdk.dir` 改成你本机 HarmonyOS SDK 路径。
### 2. 签名文件
仓库**不再引用**不存在的:
- `AppScope/debug.p12`
- `AppScope/debug.mobileprovision`
原因:这些是本地/团队环境相关文件,硬编码到仓库会直接阻塞初始化。
### 3. `hvigorw` / `hvigorw.bat`
已补入仓库。它们会优先调用:
- 本地 `node_modules/.bin/hvigor`
- 或系统中的 `hvigor`
如果你的环境里还没有 `hvigor`,先用 DevEco Studio 打开项目同步,或自行安装 hvigor。
---
## 初始化步骤(可复现)
### 方式 A:DevEco Studio 导入(推荐)
1. 克隆仓库
2. 复制模板:`local.properties.example -> local.properties`
3. 修改 `local.properties` 中的 `hwsdk.dir`
4. 用 DevEco Studio 打开**仓库根目录**
5. 等待工程同步完成
6. 如需构建/运行,在 DevEco 中补本地调试签名配置
### 方式 B:命令行初始化
前提:本机已具备 `node` 和 `hvigor`
```bash
cp local.properties.example local.properties
# 编辑 local.properties,填入 hwsdk.dir
./hvigorw tasks
```
如果 `./hvigorw` 提示找不到 `hvigor`,先回到方式 A,用 DevEco 完成首次同步。
---
## 当前可验证结果
当前工程已具备以下最小可验证链路:
- `EntryAbility` 可加载 `ShellRootPage`
- 运行页可进入 native smoke 启动路径
- `pullFrame()` 已接到 ArkTS 层
- 页面可显示测试帧元数据与测试占位渲染块
这意味着:
- **可以导入工程**
- **可以继续做 Native/NAPI 联调**
- 但**还不是完整可运行的 MRP 模拟器产品**
---
## 下一阶段重点
- 把 `pullFrame()` 的占位帧替换为真实 native 帧
- 把 `loadPackage(appId)` 替换为真实 MRP 包路径/入口
- 把输入映射从 smoke path 替换为真实内核事件分发
+60
View File
@@ -0,0 +1,60 @@
# SETUP
## 目标
让别人拿到仓库后,能按固定步骤完成:
- 初始化项目
- 导入 DevEco Studio
- 继续做 ArkTS + Native/NAPI 联调
---
## 1. 准备本地文件
仓库不提交真实 `local.properties`,请自行复制:
```bash
cp local.properties.example local.properties
```
然后修改:
```properties
hwsdk.dir=/absolute/path/to/HarmonyOS/Sdk
```
---
## 2. 导入 DevEco Studio
- 打开仓库根目录:`mrp-simulator-harmonyos`
- 等待工程同步
- 若 IDE 提示补全依赖/构建环境,按 IDE 引导完成
---
## 3. 关于签名
当前仓库已移除对不存在签名文件的硬引用。
如果你要实际构建/运行:
- 在 DevEco 中配置本地 debug signing
- 或按团队规范补本地签名材料
---
## 4. 关于 hvigorw
仓库已提供:
- `hvigorw`
- `hvigorw.bat`
如果本机还没有 `hvigor`:
- 先用 DevEco Studio 打开并同步
- 或自行安装 hvigor 后再执行命令行任务
---
## 5. 最小自检清单
导入后至少确认:
- 根目录可识别为 HarmonyOS 工程
- `entry` 模块可识别
- `entry/src/main/ets` 存在
- `entry/src/main/cpp` 存在
- `entry/src/main/resources` 存在
- `EntryAbility` 与 `ShellRootPage` 可被 IDE 正常索引
-15
View File
@@ -3,7 +3,6 @@
"products": [
{
"name": "default",
"signingConfig": "default",
"compatibleSdkVersion": "5.0.0(12)",
"runtimeOS": "HarmonyOS"
}
@@ -15,20 +14,6 @@
{
"name": "release"
}
],
"signingConfigs": [
{
"name": "default",
"type": "HarmonyOS",
"material": {
"storeFile": "./AppScope/debug.p12",
"storePassword": "123456",
"keyAlias": "debugKey",
"keyPassword": "123456",
"signAlg": "SHA256withECDSA",
"profile": "./AppScope/debug.mobileprovision"
}
}
]
},
"modules": [
+25
View File
@@ -13,6 +13,31 @@ MRP 模拟器鸿蒙化
## HarmonyOS Senior Engineer Backlog
### HOS-PRIO-001 Native/NAPI/C++ 最小工程骨架(最高优先级)
交付:
- 实际目录进入主仓库:
- `entry/src/main/cpp/`
- `entry/src/main/cpp/napi/`
- `entry/src/main/cpp/runtime/`
- `entry/src/main/cpp/platform/`
- `entry/src/main/cpp/render/`
- `entry/src/main/cpp/input/`
- 最小文件骨架进入主仓库:
- `CMakeLists.txt`
- `module_init.cpp`
- `facade_binding.cpp`
- `MrpFacade.h/.cpp`
- `MrpRuntime.h/.cpp`
- `FrameBuffer.h/.cpp`
- `InputEvent.h`
- `InputDispatcher.cpp`
- 必须 **直接 commit + push 到 main**
规则:
- 这项优先级高于文档补充
- 先把 native 骨架推进仓库,再补解释文档
- 不允许继续只产出文档、不产出 native 目录和文件
### HOS-001 POC 文件级骨架清单
交付:
- ArkTS 侧骨架文件清单
+7 -1
View File
@@ -6,5 +6,11 @@
"arguments": "",
"cppFlags": "-std=c++17"
}
}
},
"targets": [
{
"name": "default",
"runtimeOS": "HarmonyOS"
}
]
}
+6
View File
@@ -0,0 +1,6 @@
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hapTasks,
plugins: []
};
+5
View File
@@ -0,0 +1,5 @@
{
"modelVersion": "5.0.0",
"dependencies": {},
"execution": {}
}
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env sh
set -eu
if [ -x "./node_modules/.bin/hvigor" ]; then
exec ./node_modules/.bin/hvigor "$@"
fi
if command -v hvigor >/dev/null 2>&1; then
exec hvigor "$@"
fi
echo "hvigor not found." >&2
echo "Open this project in DevEco Studio first, or install hvigor in your environment, then rerun ./hvigorw." >&2
exit 127
+17
View File
@@ -0,0 +1,17 @@
@echo off
setlocal
if exist .\node_modules\.bin\hvigor.cmd (
.\node_modules\.bin\hvigor.cmd %*
exit /b %errorlevel%
)
where hvigor >nul 2>nul
if %errorlevel%==0 (
hvigor %*
exit /b %errorlevel%
)
echo hvigor not found.
echo Open this project in DevEco Studio first, or install hvigor in your environment, then rerun hvigorw.bat.
exit /b 127
+4
View File
@@ -0,0 +1,4 @@
# Copy this file to local.properties and replace the path with your local HarmonyOS SDK path.
# Example (Windows): hwsdk.dir=C:\\Users\\you\\Huawei\\Sdk
# Example (macOS/Linux): hwsdk.dir=/Users/you/Huawei/Sdk
hwsdk.dir=/absolute/path/to/HarmonyOS/Sdk
+3
View File
@@ -4,3 +4,6 @@
- 样例整理脚本
- 调研辅助脚本
- 构建/验证辅助脚本
当前可用:
- `check-init-env.sh`:检查仓库是否具备最小初始化前置(工程壳、wrapper、local.properties、hwsdk.dir、hvigor/node)
+88
View File
@@ -0,0 +1,88 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT_DIR"
status() {
printf '%-32s %s\n' "$1" "$2"
}
check_file() {
local path="$1"
if [ -e "$path" ]; then
status "$path" "OK"
else
status "$path" "MISSING"
return 1
fi
}
FAILED=0
echo "[MRP HarmonyOS Init Check]"
echo "root=$ROOT_DIR"
echo "\n# Project shell files"
check_file "AppScope/app.json5" || FAILED=1
check_file "build-profile.json5" || FAILED=1
check_file "hvigorfile.ts" || FAILED=1
check_file "oh-package.json5" || FAILED=1
check_file "entry/hvigorfile.ts" || FAILED=1
check_file "entry/oh-package.json5" || FAILED=1
check_file "entry/build-profile.json5" || FAILED=1
check_file "entry/src/main/module.json5" || FAILED=1
check_file "entry/src/main/resources" || FAILED=1
check_file "entry/src/main/ets" || FAILED=1
check_file "entry/src/main/cpp" || FAILED=1
echo "\n# Wrapper / runtime tools"
if [ -x "./hvigorw" ]; then
status "./hvigorw" "OK"
else
status "./hvigorw" "NOT_EXECUTABLE"
FAILED=1
fi
if command -v hvigor >/dev/null 2>&1; then
status "hvigor" "FOUND"
else
status "hvigor" "MISSING"
FAILED=1
fi
if command -v node >/dev/null 2>&1; then
status "node" "FOUND: $(node -v)"
else
status "node" "MISSING"
FAILED=1
fi
echo "\n# Local machine files"
if [ -f "local.properties" ]; then
status "local.properties" "FOUND"
HWSDK_DIR="$(sed -n 's/^hwsdk\.dir=//p' local.properties | tail -1)"
if [ -z "$HWSDK_DIR" ]; then
status "hwsdk.dir" "EMPTY"
FAILED=1
elif [[ "$HWSDK_DIR" == "/absolute/path/to/HarmonyOS/Sdk" ]]; then
status "hwsdk.dir" "PLACEHOLDER"
FAILED=1
elif [ -d "$HWSDK_DIR" ]; then
status "hwsdk.dir" "CONFIGURED"
else
status "hwsdk.dir" "PATH_NOT_FOUND"
FAILED=1
fi
else
status "local.properties" "MISSING"
FAILED=1
fi
echo "\n# Conclusion"
if [ "$FAILED" -eq 0 ]; then
echo "INIT_PREREQUISITES_OK"
else
echo "INIT_PREREQUISITES_BLOCKED"
exit 2
fi