Files
opendance-windows/tasks/011-build-script.md
T

59 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# T-WIN-011 Windows 打包脚本
- **状态**:done
- **依赖**:T-WIN-001 ~ 010
## 目标
提供 Linux 直接导出(方案 A,推荐)与 Windows 端兜底(方案 B)两条打包路径。
## load
```
DSH.md
build/export-windows.sh
build/export-windows.ps1
export_presets.cfg
```
## 交付物
| 文件 | 说明 |
|---|---|
| `export_presets.cfg` | 导出预设(**必须在项目根目录**,Godot 硬性要求) |
| `build/export-windows.sh` | Linux 导出:定位 Godot → 检查模板 → 导入 → 导出 → **校验 PE 头** |
| `build/export-windows.ps1` | Windows 兜底:同上,产物路径与校验逻辑一致 |
## 脚本健壮性
- `GODOT_BIN` 环境变量或 PATH 自动定位 Godot,缺失时给出可执行的安装指引
- 导出模板缺失时明确报错并给出下载与安装路径
- 导出命令返回非 0 时**仍检查产物是否存在**(Godot 有时非 0 返回但产物有效)
- 读取产物前 2 字节校验 `MZ`(PE 头),防止导出静默产出空壳
## 验收(文档 §5.4)
| 验收项 | 结果 |
|---|---|
| Linux:`bash build/export-windows.sh` 成功生成 exe | ✅ 生成 `OpenDance.exe` 104 MB + `OpenDance.pck` 107 KB,PE 头校验通过 |
| Windows:`powershell build/export-windows.ps1` 成功生成 exe | ⚠️ 脚本就绪,本环境无 Windows,未实机执行 |
| 生成的 exe 在 Windows 10/11 可运行 | ⚠️ 本环境无 Windows;已校验为合法 PE32+ x86_64 可执行文件 |
| `THIRD_PARTY.md` 包含所有开源项目与源链接 | ✅ 15 项,与契约表逐条一致 |
## 打包产物
```
opendance-windows-v0.1.0.zip
├── OpenDance.exe
├── OpenDance.pck
├── THIRD_PARTY.md
├── README.txt
└── contracts/ # 契约快照
```
## 环境记录
- Godot 4.7.2.stable(`ed1daf0bf`)
- 导出模板 `4.7.2.stable`(``windows_release_x86_64.exe``)
- 首次导出失败原因:`export_presets.cfg` 放在 `build/` 下,Godot 只在**项目根目录**查找